changeset 189:71ca5bcf2307

Replaced String alias with import dwt.dwthelper.util
author Frank Benoit <benoit@tionex.de>
date Sun, 26 Oct 2008 14:57:25 +0100
parents e3780acbbf80
children df4e66472aff
files dwtx/novocode/ishell/InternalShell.d dwtx/novocode/ishell/internal/TitleBar.d dwtx/novocode/ishell/internal/TitleBarButton.d
diffstat 3 files changed, 72 insertions(+), 73 deletions(-) [+]
line wrap: on
line diff
--- a/dwtx/novocode/ishell/InternalShell.d	Sun Oct 26 14:54:39 2008 +0100
+++ b/dwtx/novocode/ishell/InternalShell.d	Sun Oct 26 14:57:25 2008 +0100
@@ -1,16 +1,17 @@
 /*******************************************************************************
  * Copyright (c) 2005 Stefan Zeiger and others.
- * All rights reserved. This program and the accompanying materials 
+ * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.novocode.com/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *     Stefan Zeiger (szeiger@novocode.com) - initial API and implementation
  *******************************************************************************/
 
 module dwtx.novocode.ishell.InternalShell;
 
+import dwt.dwthelper.utils;
 import dwt.DWT;
 import dwt.DWTException;
 import dwt.graphics.Image;
@@ -31,8 +32,6 @@
 import dwtx.novocode.ishell.internal.TitleBar;
 import dwtx.novocode.ishell.internal.TitleBarButton;
 
-alias char[] String;
-
 
 /**
  * An internal shell which can be placed on a DesktopForm.
@@ -72,7 +71,7 @@
 
   Control focusControl;
 
-  
+
   this(DesktopForm parent, int style)
   {
     super(parent, checkStyle(style));
@@ -85,7 +84,7 @@
 
     titleBar = new TitleBar(this, style & (DWT.CLOSE | DWT.RESIZE | DWT.MAX | DWT.TOOL | DWT.MIN));
     titleHeight = titleBar.computeSize(DWT.DEFAULT, DWT.DEFAULT, true).y;
-    
+
     Control leftButton = null;
 
     if((style & (DWT.CLOSE | DWT.MAX | DWT.MIN)) !is 0)
@@ -130,7 +129,7 @@
     else fd.right = new FormAttachment(100, -BORDER_SIZE);
     fd.top = new FormAttachment(0, BORDER_SIZE);
     titleBar.setLayoutData(fd);
-    
+
     contentPane = new Composite(this, DWT.NONE);
     fd = new FormData();
     fd.left = new FormAttachment(0, BORDER_SIZE);
@@ -147,15 +146,15 @@
     fd.top = new FormAttachment(0);
     fd.bottom = new FormAttachment(100);
     sizeBorder.setLayoutData(fd);
-    
+
     minHeight = titleHeight + 2*BORDER_SIZE;
     sizeBorder.setMinimumShellSize(minWidth, minHeight);
     sizeBorder.setCornerSize(titleHeight + BORDER_SIZE);
     if((style & DWT.RESIZE) is 0) sizeBorder.setEnabled(false);
-    
+
     setSize(320, 240);
     setVisible(false);
-    
+
     desktop.manage(this);
   }
 
@@ -227,8 +226,8 @@
     sizeGrip.setMinimumShellSize(minWidth, minHeight);
     if(isVisible()) layout(true);
   }
-  
-  
+
+
   public Point computeSize(int wHint, int hHint, bool changed)
   {
     Point p = super.computeSize(wHint, hHint, changed);
@@ -236,8 +235,8 @@
     if(p.y < minHeight) p.y = minHeight;
     return p;
   }
-  
-  
+
+
   public void setSize(int width, int height)
   {
     if(width < minWidth) width = minWidth;
@@ -245,7 +244,7 @@
     super.setSize(width, height);
   }
 
-  
+
   public void setBounds(int x, int y, int width, int height)
   {
     if(width < minWidth) width = minWidth;
@@ -273,30 +272,30 @@
     notifyListeners(DWT.Close, event);
     if(event.doit && !isDisposed()) dispose();
   }
-  
-  
+
+
   public void open()
   {
     desktop.activate(this);
     setVisible(true);
     setFocus();
   }
-  
-  
+
+
   public void setVisible(bool visible)
   {
     if(!visible) desktop.shellVisibilityChanged(this, false);
     super.setVisible(visible);
     if(visible) desktop.shellVisibilityChanged(this, true);
   }
-  
-  
+
+
   public void setActive()
   {
     desktop.activate(this);
   }
-  
-  
+
+
   public void setMaximized(bool maximized)
   {
     checkWidget();
@@ -305,7 +304,7 @@
     desktop.shellMaximizedOrRestored(this, maximized);
   }
 
-  
+
   public void setMinimized(bool minimized)
   {
     checkWidget();
@@ -313,14 +312,14 @@
     setVisible(!minimized);
     maximized = wasMaximized;
   }
-  
-  
+
+
   public bool getMinimized()
   {
     return getVisible();
   }
 
-  
+
   void setMaximizedWithoutNotification(bool maximized)
   {
     if(this.maximized is maximized) return;
@@ -340,14 +339,14 @@
     if(maxButton !is null && !maxButton.isDisposed()) maxButton.redraw();
   }
 
-  
+
   public bool getMaximized()
   {
     checkWidget();
     return maximized;
   }
-  
-  
+
+
   void redrawDecorationsAfterActivityChange()
   {
     // Note: This method may be called in a Dispose event for this object
@@ -356,8 +355,8 @@
     if(maxButton !is null && !maxButton.isDisposed()) maxButton.redraw();
     if(minButton !is null && !minButton.isDisposed()) minButton.redraw();
   }
-  
-  
+
+
   void desktopResized(Rectangle deskCA)
   {
     if(maximized)
@@ -370,22 +369,22 @@
     }
     else forceVisibleLocation(deskCA);
   }
-  
-  
+
+
   public bool setFocus()
   {
     if(focusControl !is null && focusControl !is this && !focusControl.isDisposed())
       return focusControl.setFocus();
     return super.setFocus();
   }
-  
-  
+
+
   public bool isActiveShell()
   {
     return desktop.getActiveShell() is this;
   }
-  
-  
+
+
   private void forceVisibleLocation(Rectangle deskCA)
   {
     Point p = getLocation();
--- a/dwtx/novocode/ishell/internal/TitleBar.d	Sun Oct 26 14:54:39 2008 +0100
+++ b/dwtx/novocode/ishell/internal/TitleBar.d	Sun Oct 26 14:57:25 2008 +0100
@@ -1,10 +1,10 @@
 /*******************************************************************************
  * Copyright (c) 2005 Stefan Zeiger and others.
- * All rights reserved. This program and the accompanying materials 
+ * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.novocode.com/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *     Stefan Zeiger (szeiger@novocode.com) - initial API and implementation
  *******************************************************************************/
@@ -38,12 +38,12 @@
 import dwtx.novocode.ishell.DesktopForm;
 import dwtx.novocode.ishell.InternalShell;
 
-alias char[] String;
+import dwt.dwthelper.utils;
 
 
 /**
  * A title bar for an InternalShell.
- * 
+ *
  * @author Stefan Zeiger (szeiger@novocode.com)
  * @since Jan 21, 2005
  * @version $Id: TitleBar.java 342 2005-07-09 20:37:13 +0000 (Sat, 09 Jul 2005) szeiger $
@@ -131,7 +131,7 @@
     maximizeItem.setText("Ma&ximize");
     maximizeItem.setImage(maximizeImage);
     maximizeItem.addListener(DWT.Selection, dgListener(&maximizeListener));
-    
+
     new MenuItem(defaultPopup, DWT.SEPARATOR);
 
     closeItem = new MenuItem(defaultPopup, DWT.PUSH);
@@ -151,7 +151,7 @@
     deactivateListener = dgListener(&onDeactivateListener);
     shell.addListener(DWT.Activate, activateListener);
     shell.addListener(DWT.Deactivate, deactivateListener);
-    
+
     addListener(DWT.Dispose, dgListener(&onDispose));
   }
 
@@ -184,14 +184,14 @@
   {
         Rectangle r = getClientArea();
         if(r.width is 0 || r.height is 0) return;
-        
+
         bool active = (shell is display.getActiveShell() && ishell.isActiveShell());
 
         GC gc = event.gc;
         gc.setForeground(active ? gradStartColor : inactiveGradStartColor);
         gc.setBackground(active ? gradEndColor : inactiveGradEndColor);
         gc.fillGradientRectangle(r.x, r.y, r.width, r.height, false);
-        
+
         int textLeftPadding = LEFT_PADDING;
         if(image !is null)
         {
@@ -202,7 +202,7 @@
             gc.drawImage(image, LEFT_PADDING + (IMAGE_SIZE-imageBounds.width)/2, (r.height-imageBounds.height)/2);
           textLeftPadding += IMAGE_SIZE + LEFT_PADDING;
         }
-        
+
         if(text !is null && text.length() > 0)
         {
           gc.setForeground(active ? textColor : inactiveTextColor);
@@ -393,8 +393,8 @@
 
     if(newX !is p.x || newY !is p.y) ishell.setLocation(newX, newY);
   }
-  
-  
+
+
   public Point getMinGrabSize()
   {
     return minGrabSize;
@@ -438,19 +438,19 @@
     checkWidget();
     return false;
   }
-  
-  
+
+
   public void setText(String text)
   {
     checkWidget();
     this.text = text;
     redraw();
   }
-  
-  
+
+
   public String getText() { return text; }
-  
-  
+
+
   public void setImage(Image image)
   {
     checkWidget();
@@ -460,8 +460,8 @@
     if(image !is null) minGrabSize.x += LEFT_PADDING + IMAGE_SIZE;
     redraw();
   }
-  
-  
+
+
   public Image getImage() { return image; }
 
 
@@ -475,8 +475,8 @@
     }
     return new Font(getDisplay(), fds);
   }
-  
-  
+
+
   private void instrumentDefaultPopup(bool onImage)
   {
     restoreItem.setEnabled(styleMax && ishell.getMaximized());
@@ -492,8 +492,8 @@
     }
     defaultPopup.setDefaultItem(def);
   }
-  
-  
+
+
   private static const int IMAGE_TYPE_CLOSE    = 1;
   private static const int IMAGE_TYPE_MAXIMIZE = 2;
   private static const int IMAGE_TYPE_RESTORE  = 3;
@@ -507,7 +507,7 @@
     final Color fg = getForeground();
     final Color white = getDisplay().getSystemColor(DWT.COLOR_WHITE);
     final RGB blackRGB = new RGB(0,0,0);
-    
+
     ImageData id = new ImageData(imgWidth, size.y, 1, new PaletteData([ blackRGB, fg.getRGB() ]));
     ImageData maskid = new ImageData(imgWidth, size.y, 1, new PaletteData([ blackRGB, white.getRGB() ]));
 
@@ -516,7 +516,7 @@
     gc.setForeground(fg);
     drawMenuImage(gc, size, type);
     gc.dispose();
-    
+
     Image maskimg = new Image(getDisplay(), maskid);
     gc = new GC(maskimg);
     gc.setForeground(white);
--- a/dwtx/novocode/ishell/internal/TitleBarButton.d	Sun Oct 26 14:54:39 2008 +0100
+++ b/dwtx/novocode/ishell/internal/TitleBarButton.d	Sun Oct 26 14:57:25 2008 +0100
@@ -1,10 +1,10 @@
 /*******************************************************************************
  * Copyright (c) 2005 Stefan Zeiger and others.
- * All rights reserved. This program and the accompanying materials 
+ * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.novocode.com/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *     Stefan Zeiger (szeiger@novocode.com) - initial API and implementation
  *******************************************************************************/
@@ -59,15 +59,15 @@
     inactiveGradEndColor = display.getSystemColor(DWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT);
     widgetBackgroundColor = display.getSystemColor(DWT.COLOR_WIDGET_BACKGROUND);
     widgetForegroundColor = display.getSystemColor(DWT.COLOR_WIDGET_FOREGROUND);
-    
+
     if((style & (DWT.CLOSE | DWT.MAX)) !is 0) rightOff = 2;
     else leftOff = 2;
-    
+
     activateListener = dgListener(&onActivateListener);
     deactivateListener = dgListener(&onDeactivateListener);
     shell.addListener(DWT.Activate, activateListener);
     shell.addListener(DWT.Deactivate, deactivateListener);
-    
+
     addListener(DWT.Dispose, dgListener(&onDispose));
   }
 
@@ -96,7 +96,7 @@
     return style;
   }
 
-  
+
   protected void onPaint(Event event, bool pressed)
   {
     Point size = getSize();
@@ -143,8 +143,8 @@
       drawImage(gc, size, 0);
     }
   }
-  
-  
+
+
   private void drawImage(GC gc, Point size, int pOff)
   {
     if((style & DWT.CLOSE) !is 0) drawCloseImage(gc, size, pOff);
@@ -167,8 +167,8 @@
     gc.drawLine(x, y, x + w - 1, y);
     gc.drawLine(x, y, x, y + h - 1);
   }
-  
-  
+
+
   private void drawCloseImage(GC gc, Point size, int pOff)
   {
     gc.drawLine(pOff+leftOff+4, pOff+5, pOff+size.x-leftOff-rightOff-6, pOff+size.y-7);