changeset 40:fbe68c33eeee

Sync layout with dwt-linux
author Frank Benoit <benoit@tionex.de>
date Tue, 07 Oct 2008 14:41:31 +0200
parents 43be986a1372
children 6337764516f1
files dwt/layout/FillData.d dwt/layout/FillLayout.d dwt/layout/FormAttachment.d dwt/layout/FormData.d dwt/layout/FormLayout.d dwt/layout/GridData.d dwt/layout/GridLayout.d dwt/layout/RowData.d dwt/layout/RowLayout.d
diffstat 9 files changed, 577 insertions(+), 506 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/layout/FillData.d	Tue Oct 07 14:41:16 2008 +0200
+++ b/dwt/layout/FillData.d	Tue Oct 07 14:41:31 2008 +0200
@@ -7,11 +7,11 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
 module dwt.layout.FillData;
 
-import dwt.dwthelper.utils;
-
 import dwt.DWT;
 import dwt.graphics.Point;
 import dwt.widgets.Control;
@@ -20,19 +20,19 @@
 
     int defaultWidth = -1, defaultHeight = -1;
     int currentWhint, currentHhint, currentWidth = -1, currentHeight = -1;
-    
-Point computeSize (Control control, int wHint, int hHint, bool flushCache) {
-    if (flushCache) flushCache();
+
+Point computeSize (Control control, int wHint, int hHint, bool flushCache_) {
+    if (flushCache_) flushCache();
     if (wHint is DWT.DEFAULT && hHint is DWT.DEFAULT) {
         if (defaultWidth is -1 || defaultHeight is -1) {
-            Point size = control.computeSize (wHint, hHint, flushCache);
+            Point size = control.computeSize (wHint, hHint, flushCache_);
             defaultWidth = size.x;
             defaultHeight = size.y;
         }
         return new Point(defaultWidth, defaultHeight);
     }
     if (currentWidth is -1 || currentHeight is -1 || wHint !is currentWhint || hHint !is currentHhint) {
-        Point size = control.computeSize (wHint, hHint, flushCache);
+        Point size = control.computeSize (wHint, hHint, flushCache_);
         currentWhint = wHint;
         currentHhint = hHint;
         currentWidth = size.x;
--- a/dwt/layout/FillLayout.d	Tue Oct 07 14:41:16 2008 +0200
+++ b/dwt/layout/FillLayout.d	Tue Oct 07 14:41:31 2008 +0200
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
  * 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
@@ -7,36 +7,40 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
 module dwt.layout.FillLayout;
 
-import dwt.dwthelper.utils;
-
 import dwt.DWT;
 import dwt.graphics.Point;
 import dwt.graphics.Rectangle;
-import dwt.widgets.Composite;
 import dwt.widgets.Control;
 import dwt.widgets.Layout;
+import dwt.widgets.Composite;
 import dwt.widgets.Scrollable;
+import dwt.layout.FillData;
+
+import tango.util.Convert;
+import dwt.dwthelper.utils;
 
 /**
- * <code>FillLayout</code> is the simplest layout class. It lays out 
- * controls in a single row or column, forcing them to be the same size. 
+ * <code>FillLayout</code> is the simplest layout class. It lays out
+ * controls in a single row or column, forcing them to be the same size.
  * <p>
- * Initially, the controls will all be as tall as the tallest control, 
- * and as wide as the widest. <code>FillLayout</code> does not wrap, 
- * but you can specify margins and spacing. You might use it to 
- * lay out buttons in a task bar or tool bar, or to stack checkboxes 
- * in a <code>Group</code>. <code>FillLayout</code> can also be used 
- * when a <code>Composite</code> only has one child. For example, 
- * if a <code>Shell</code> has a single <code>Group</code> child, 
- * <code>FillLayout</code> will cause the <code>Group</code> to 
+ * Initially, the controls will all be as tall as the tallest control,
+ * and as wide as the widest. <code>FillLayout</code> does not wrap,
+ * but you can specify margins and spacing. You might use it to
+ * lay out buttons in a task bar or tool bar, or to stack checkboxes
+ * in a <code>Group</code>. <code>FillLayout</code> can also be used
+ * when a <code>Composite</code> only has one child. For example,
+ * if a <code>Shell</code> has a single <code>Group</code> child,
+ * <code>FillLayout</code> will cause the <code>Group</code> to
  * completely fill the <code>Shell</code> (if margins are 0).
  * </p>
  * <p>
  * Example code: first a <code>FillLayout</code> is created and
- * its type field is set, and then the layout is set into the 
+ * its type field is set, and then the layout is set into the
  * <code>Composite</code>. Note that in a <code>FillLayout</code>,
  * children are always the same size, and they fill all available space.
  * <pre>
@@ -45,10 +49,13 @@
  *      shell.setLayout(fillLayout);
  * </pre>
  * </p>
+ *
+ * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Example: LayoutExample</a>
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
  */
 public final class FillLayout : Layout {
     /**
-     * type specifies how controls will be positioned 
+     * type specifies how controls will be positioned
      * within the layout.
      *
      * The default value is HORIZONTAL.
@@ -59,37 +66,37 @@
      * </ul>
      */
     public int type = DWT.HORIZONTAL;
-    
+
     /**
      * marginWidth specifies the number of pixels of horizontal margin
      * that will be placed along the left and right edges of the layout.
      *
      * The default value is 0.
-     * 
+     *
      * @since 3.0
      */
     public int marginWidth = 0;
-    
+
     /**
      * marginHeight specifies the number of pixels of vertical margin
      * that will be placed along the top and bottom edges of the layout.
      *
      * The default value is 0.
-     * 
+     *
      * @since 3.0
      */
     public int marginHeight = 0;
-    
+
     /**
      * spacing specifies the number of pixels between the edge of one cell
      * and the edge of its neighbouring cell.
      *
      * The default value is 0.
-     * 
+     *
      * @since 3.0
      */
     public int spacing = 0;
-    
+
 /**
  * Constructs a new instance of this class.
  */
@@ -100,14 +107,14 @@
  * Constructs a new instance of this class given the type.
  *
  * @param type the type of fill layout
- * 
+ *
  * @since 2.0
  */
 public this (int type) {
     this.type = type;
 }
 
-protected Point computeSize (Composite composite, int wHint, int hHint, bool flushCache) {
+override protected Point computeSize (Composite composite, int wHint, int hHint, bool flushCache) {
     Control [] children = composite.getChildren ();
     int count = children.length;
     int maxWidth = 0, maxHeight = 0;
@@ -155,8 +162,8 @@
     } else {
         // TEMPORARY CODE
         int trimX, trimY;
-        if ( null !is cast(Scrollable)control ) {
-            Rectangle rect = (cast(Scrollable) control).computeTrim (0, 0, 0, 0);
+        if ( auto sa = cast(Scrollable)control ) {
+            Rectangle rect = sa.computeTrim (0, 0, 0, 0);
             trimX = rect.width;
             trimY = rect.height;
         } else {
@@ -169,20 +176,20 @@
     return size;
 }
 
-protected bool flushCache (Control control) {
+override protected bool flushCache (Control control) {
     Object data = control.getLayoutData();
     if (data !is null) (cast(FillData)data).flushCache();
     return true;
 }
 
 String getName () {
-    String string = getClass ().getName ();
-    int index = string.lastIndexOf ('.');
-    if (index is -1) return string;
-    return string.substring (index + 1, string.length ());
+    String string = this.classinfo.name;
+    int index = string.lastIndexOf( '.');
+    if (index is -1 ) return string;
+    return string[ index + 1 .. string.length ];
 }
 
-protected void layout (Composite composite, bool flushCache) {
+override protected void layout (Composite composite, bool flushCache) {
     Rectangle rect = composite.getClientArea ();
     Control [] children = composite.getChildren ();
     int count = children.length;
@@ -228,14 +235,14 @@
  *
  * @return a string representation of the layout
  */
-public String toString () {
-    String string = getName ()+" {";
-    string += "type="+((type is DWT.VERTICAL) ? "DWT.VERTICAL" : "DWT.HORIZONTAL")+" ";
-    if (marginWidth !is 0) string += "marginWidth="+marginWidth+" ";
-    if (marginHeight !is 0) string += "marginHeight="+marginHeight+" ";
-    if (spacing !is 0) string += "spacing="+spacing+" ";
+override public String toString () {
+    String string = getName () ~ " {";
+    string ~= "type="~((type is DWT.VERTICAL) ? "DWT.VERTICAL" : "DWT.HORIZONTAL")~" ";
+    if (marginWidth !is 0) string ~= "marginWidth="~to!(String)(marginWidth)~" ";
+    if (marginHeight !is 0) string ~= "marginHeight="~to!(String)(marginHeight)~" ";
+    if (spacing !is 0) string ~= "spacing="~to!(String)(spacing)~" ";
     string = string.trim();
-    string += "}";
+    string ~= "}";
     return string;
 }
 }
--- a/dwt/layout/FormAttachment.d	Tue Oct 07 14:41:16 2008 +0200
+++ b/dwt/layout/FormAttachment.d	Tue Oct 07 14:41:31 2008 +0200
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
  * 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
@@ -7,17 +7,22 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
 module dwt.layout.FormAttachment;
 
-import dwt.dwthelper.utils;
-
 import dwt.DWT;
 import dwt.widgets.Control;
+import dwt.layout.FormLayout;
+import dwt.layout.FormData;
+
+import tango.text.convert.Format;
+import dwt.dwthelper.utils;
 
 /**
  * Instances of this class are used to define the edges of a control
- * within a <code>FormLayout</code>. 
+ * within a <code>FormLayout</code>.
  * <p>
  * <code>FormAttachments</code> are set into the top, bottom, left,
  * and right fields of the <code>FormData</code> for a control.
@@ -33,10 +38,10 @@
  * </p>
  * <p>
  * A <code>FormAttachment</code> defines where to attach the side of
- * a control by using the equation, y = ax + b. The "a" term represents 
+ * a control by using the equation, y = ax + b. The "a" term represents
  * a fraction of the parent composite's width (from the left) or height
  * (from the top). It can be defined using a numerator and denominator,
- * or just a percentage value. If a percentage is used, the denominator 
+ * or just a percentage value. If a percentage is used, the denominator
  * is set to 100. The "b" term in the equation represents an offset, in
  * pixels, from the attachment position. For example:
  * <pre>
@@ -52,8 +57,8 @@
  *      FormAttachment attach = new FormAttachment (button, 10);
  * </pre>
  * specifies that the side to which the <code>FormAttachment</code>
- * object belongs will lie in the same position as the adjacent side of 
- * the <code>button</code> control, plus 10 pixels. The control side can 
+ * object belongs will lie in the same position as the adjacent side of
+ * the <code>button</code> control, plus 10 pixels. The control side can
  * also be attached to the opposite side of the specified control.
  * For example:
  * <pre>
@@ -61,8 +66,8 @@
  *      data.left = new FormAttachment (button, 0, DWT.LEFT);
  * </pre>
  * specifies that the left side of the control will lie in the same position
- * as the left side of the <code>button</code> control. The control can also 
- * be attached in a position that will center the control on the specified 
+ * as the left side of the <code>button</code> control. The control can also
+ * be attached in a position that will center the control on the specified
  * control. For example:
  * <pre>
  *      data.left = new FormAttachment (button, 0, DWT.CENTER);
@@ -71,10 +76,11 @@
  * centered between the left and right sides of the <code>button</code> control.
  * If the alignment is not specified, the default is to attach to the adjacent side.
  * </p>
- * 
+ *
  * @see FormLayout
  * @see FormData
- * 
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
+ *
  * @since 2.0
  */
 public final class FormAttachment {
@@ -83,15 +89,15 @@
      * equation, y = ax + b, which defines the attachment.
      */
     public int numerator;
-    
+
     /**
      * denominator specifies the denominator of the "a" term in the
      * equation, y = ax + b, which defines the attachment.
-     * 
+     *
      * The default value is 100.
      */
     public int denominator = 100;
-    
+
     /**
      * offset specifies the offset, in pixels, of the control side
      * from the attachment position.
@@ -99,34 +105,34 @@
      * to the right of or below the attachment position. If it is
      * negative, then the control side is offset to the left of or
      * above the attachment position.
-     * 
+     *
      * This is equivalent to the "b" term in the equation y = ax + b.
      * The default value is 0.
      */
     public int offset;
-    
+
     /**
      * control specifies the control to which the control side is
      * attached.
      */
     public Control control;
-    
+
     /**
      * alignment specifies the alignment of the control side that is
      * attached to a control.
      * <p>
-     * For top and bottom attachments, TOP, BOTTOM and CENTER are used. For left 
+     * For top and bottom attachments, TOP, BOTTOM and CENTER are used. For left
      * and right attachments, LEFT, RIGHT and CENTER are used. If any other case
      * occurs, the default will be used instead.
      * </p>
-     * 
+     *
      * <br>Possible values are: <ul>
-     *    <li>TOP: Attach the side to the top side of the specified control.</li>
-     *    <li>BOTTOM : Attach the side to the bottom side of the specified control.</li>
-     *    <li>LEFT: Attach the side to the left side of the specified control.</li>
-     *    <li>RIGHT: Attach the side to the right side of the specified control.</li>
-     *    <li>CENTER: Attach the side at a position which will center the control on the specified control.</li>
-     *    <li>DEFAULT: Attach the side to the adjacent side of the specified control.</li>
+     *    <li>{@link DWT#TOP}: Attach the side to the top side of the specified control.</li>
+     *    <li>{@link DWT#BOTTOM}: Attach the side to the bottom side of the specified control.</li>
+     *    <li>{@link DWT#LEFT}: Attach the side to the left side of the specified control.</li>
+     *    <li>{@link DWT#RIGHT}: Attach the side to the right side of the specified control.</li>
+     *    <li>{@link DWT#CENTER}: Attach the side at a position which will center the control on the specified control.</li>
+     *    <li>{@link DWT#DEFAULT}: Attach the side to the adjacent side of the specified control.</li>
      * </ul>
      */
     public int alignment;
@@ -137,7 +143,7 @@
  * the attachment is treated as a percentage of the form.
  * The numerator is zero, the denominator is 100 and the
  * offset is zero.
- * 
+ *
  * @since 3.2
  */
 public this () {
@@ -146,11 +152,11 @@
 /**
  * Constructs a new instance of this class given a numerator
  * Since no denominator or offset is specified, the default
- * is to treat the numerator as a percentage of the form, with a 
+ * is to treat the numerator as a percentage of the form, with a
  * denominator of 100. The offset is zero.
- * 
+ *
  * @param numerator the percentage of the position
- * 
+ *
  * @since 3.0
  */
 public this (int numerator) {
@@ -160,9 +166,9 @@
 /**
  * Constructs a new instance of this class given a numerator
  * and an offset. Since no denominator is specified, the default
- * is to treat the numerator as a percentage of the form, with a 
+ * is to treat the numerator as a percentage of the form, with a
  * denominator of 100.
- * 
+ *
  * @param numerator the percentage of the position
  * @param offset the offset of the side from the position
  */
@@ -171,7 +177,7 @@
 }
 
 /**
- * Constructs a new instance of this class given a numerator 
+ * Constructs a new instance of this class given a numerator
  * and denominator and an offset. The position of the side is
  * given by the fraction of the form defined by the numerator
  * and denominator.
@@ -190,10 +196,10 @@
 /**
  * Constructs a new instance of this class given a control.
  * Since no alignment is specified, the default alignment is
- * to attach the side to the adjacent side of the specified 
+ * to attach the side to the adjacent side of the specified
  * control. Since no offset is specified, an offset of 0 is
  * used.
- * 
+ *
  * @param control the control the side is attached to
  */
 public this (Control control) {
@@ -203,9 +209,9 @@
 /**
  * Constructs a new instance of this class given a control
  * and an offset. Since no alignment is specified, the default
- * alignment is to attach the side to the adjacent side of the 
+ * alignment is to attach the side to the adjacent side of the
  * specified control.
- * 
+ *
  * @param control the control the side is attached to
  * @param offset the offset of the side from the control
  */
@@ -215,11 +221,26 @@
 
 /**
  * Constructs a new instance of this class given a control,
- * an offset and an alignment.
- * 
+ * an offset and an alignment.  The possible alignment values are:
+ * <dl>
+ * <dt><b>{@link DWT#TOP}</b></dt>
+ * <dd>the side will be attached to the top side of the specified control</dd>
+ * <dt><b>{@link DWT#BOTTOM}</b></dt>
+ * <dd>the side will be attached to the bottom side of the specified control</dd>
+ * <dt><b>{@link DWT#LEFT}</b></dt>
+ * <dd>the side will be attached to the left side of the specified control</dd>
+ * <dt><b>{@link DWT#RIGHT}</b></dt>
+ * <dd>the side will be attached to the right side of the specified control</dd>
+ * <dt><b>{@link DWT#CENTER}</b></dt>
+ * <dd>the side will be centered on the same side of the specified control</dd>
+ * <dt><b>{@link DWT#DEFAULT}</b></dt>
+ * <dd>the side will be attached to the adjacent side of the specified control</dd>
+ * </dl>
+ *
  * @param control the control the side is attached to
  * @param offset the offset of the side from the control
- * @param alignment the alignment of the side to the control it is attached to
+ * @param alignment the alignment of the side to the control it is attached to,
+ *      one of TOP, BOTTOM, LEFT, RIGHT, CENTER, or DEFAULT
  */
 public this (Control control, int offset, int alignment) {
     this.control = control;
@@ -287,16 +308,16 @@
     if (numerator is 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO);
     return (value - offset) * denominator / numerator;
 }
-    
+
 /**
  * Returns a string containing a concise, human-readable
  * description of the receiver.
  *
  * @return a string representation of the FormAttachment
  */
-public String toString () {
-    String string = control !is null ? control.toString () : numerator + "/" + denominator;
-    return "{y = (" + string + (offset >= 0 ? ")x + " + offset: ")x - " + (-offset))+"}";
+public override String toString () {
+    String string = control !is null ? control.toString () : Format( "{}/{}", numerator, denominator );
+    return Format("{{y = ({})x + {}}", string, ( offset >= 0 ? Format(")x + {}", offset ) : Format( ")x - {}", -offset)));
 }
 
 }
--- a/dwt/layout/FormData.d	Tue Oct 07 14:41:16 2008 +0200
+++ b/dwt/layout/FormData.d	Tue Oct 07 14:41:31 2008 +0200
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
  * 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
@@ -7,22 +7,26 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
 module dwt.layout.FormData;
 
-import dwt.dwthelper.utils;
 
- 
 import dwt.DWT;
 import dwt.graphics.Point;
 import dwt.widgets.Control;
+import dwt.layout.FormAttachment;
+
+import tango.util.Convert;
+import dwt.dwthelper.utils;
 
 /**
- * Instances of this class are used to define the attachments 
- * of a control in a <code>FormLayout</code>. 
+ * Instances of this class are used to define the attachments
+ * of a control in a <code>FormLayout</code>.
  * <p>
- * To set a <code>FormData</code> object into a control, you use the 
- * <code>setLayoutData ()</code> method. To define attachments for the 
+ * To set a <code>FormData</code> object into a control, you use the
+ * <code>setLayoutData ()</code> method. To define attachments for the
  * <code>FormData</code>, set the fields directly, like this:
  * <pre>
  *      FormData data = new FormData();
@@ -32,22 +36,23 @@
  * </pre>
  * </p>
  * <p>
- * <code>FormData</code> contains the <code>FormAttachments</code> for 
+ * <code>FormData</code> contains the <code>FormAttachments</code> for
  * each edge of the control that the <code>FormLayout</code> uses to
  * determine the size and position of the control. <code>FormData</code>
  * objects also allow you to set the width and height of controls within
- * a <code>FormLayout</code>. 
+ * a <code>FormLayout</code>.
  * </p>
- * 
+ *
  * @see FormLayout
  * @see FormAttachment
- * 
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
+ *
  * @since 2.0
  */
 public final class FormData {
     /**
      * width specifies the preferred width in pixels. This value
-     * is the wHint passed into Control.computeSize(int, int, bool) 
+     * is the wHint passed into Control.computeSize(int, int, bool)
      * to determine the preferred size of the control.
      *
      * The default value is DWT.DEFAULT.
@@ -57,7 +62,7 @@
     public int width = DWT.DEFAULT;
     /**
      * height specifies the preferred height in pixels. This value
-     * is the hHint passed into Control.computeSize(int, int, bool) 
+     * is the hHint passed into Control.computeSize(int, int, bool)
      * to determine the preferred size of the control.
      *
      * The default value is DWT.DEFAULT.
@@ -66,7 +71,7 @@
      */
     public int height = DWT.DEFAULT;
     /**
-     * left specifies the attachment of the left side of 
+     * left specifies the attachment of the left side of
      * the control.
      */
     public FormAttachment left;
@@ -84,25 +89,25 @@
      * control.
      */
     public FormAttachment bottom;
-    
+
     int cacheWidth = -1, cacheHeight = -1;
     int defaultWhint, defaultHhint, defaultWidth = -1, defaultHeight = -1;
     int currentWhint, currentHhint, currentWidth = -1, currentHeight = -1;
     FormAttachment cacheLeft, cacheRight, cacheTop, cacheBottom;
     bool isVisited, needed;
-    
+
 /**
  * Constructs a new instance of FormData using
  * default values.
  */
 public this () {
 }
-    
+
 /**
  * Constructs a new instance of FormData according to the parameters.
  * A value of DWT.DEFAULT indicates that no minimum width or
  * no minimum height is specified.
- * 
+ *
  * @param width a minimum width for the control
  * @param height a minimum height for the control
  */
@@ -111,11 +116,11 @@
     this.height = height;
 }
 
-void computeSize (Control control, int wHint, int hHint, bool flushCache) {
+void computeSize (Control control, int wHint, int hHint, bool flushCache_) {
     if (cacheWidth !is -1 && cacheHeight !is -1) return;
     if (wHint is this.width && hHint is this.height) {
         if (defaultWidth is -1 || defaultHeight is -1 || wHint !is defaultWhint || hHint !is defaultHhint) {
-            Point size =  control.computeSize (wHint, hHint, flushCache);
+            Point size =  control.computeSize (wHint, hHint, flushCache_);
             defaultWhint = wHint;
             defaultHhint = hHint;
             defaultWidth = size.x;
@@ -126,7 +131,7 @@
         return;
     }
     if (currentWidth is -1 || currentHeight is -1 || wHint !is currentWhint || hHint !is currentHhint) {
-        Point size =  control.computeSize (wHint, hHint, flushCache);
+        Point size =  control.computeSize (wHint, hHint, flushCache_);
         currentWhint = wHint;
         currentHhint = hHint;
         currentWidth = size.x;
@@ -175,7 +180,7 @@
     FormData bottomData = cast(FormData) bottomControl.getLayoutData ();
     FormAttachment bottomAttachment = bottomData.getBottomAttachment (bottomControl, spacing, flushCache);
     switch (bottom.alignment) {
-        case DWT.BOTTOM: 
+        case DWT.BOTTOM:
             cacheBottom = bottomAttachment.plus (bottom.offset);
             break;
         case DWT.CENTER: {
@@ -186,7 +191,7 @@
         }
         default: {
             FormAttachment topAttachment = bottomData.getTopAttachment (bottomControl, spacing, flushCache);
-            cacheBottom = topAttachment.plus (bottom.offset - spacing); 
+            cacheBottom = topAttachment.plus (bottom.offset - spacing);
             break;
         }
     }
@@ -227,18 +232,18 @@
         }
         default: {
             FormAttachment rightAttachment = leftData.getRightAttachment (leftControl, spacing, flushCache);
-            cacheLeft = rightAttachment.plus (left.offset + spacing); 
+            cacheLeft = rightAttachment.plus (left.offset + spacing);
         }
     }
-    isVisited = false; 
+    isVisited = false;
     return cacheLeft;
 }
-    
+
 String getName () {
-    String string = getClass ().getName ();
-    int index = string.lastIndexOf ('.');
-    if (index is -1) return string;
-    return string.substring (index + 1, string.length ());
+    String string = this.classinfo.name;
+    int index = string.lastIndexOf( '.');
+    if (index is -1 ) return string;
+    return string[ index + 1 .. string.length ];
 }
 
 FormAttachment getRightAttachment (Control control, int spacing, bool flushCache) {
@@ -263,7 +268,7 @@
     FormData rightData = cast(FormData) rightControl.getLayoutData ();
     FormAttachment rightAttachment = rightData.getRightAttachment (rightControl, spacing, flushCache);
     switch (right.alignment) {
-        case DWT.RIGHT: 
+        case DWT.RIGHT:
             cacheRight = rightAttachment.plus (right.offset);
             break;
         case DWT.CENTER: {
@@ -329,16 +334,16 @@
  *
  * @return a string representation of the FormData object
  */
-public String toString () {
-    String string = getName()+" {";
-    if (width !is DWT.DEFAULT) string += "width="+width+" ";
-    if (height !is DWT.DEFAULT) string += "height="+height+" ";
-    if (left !is null) string += "left="+left+" ";
-    if (right !is null) string += "right="+right+" ";
-    if (top !is null) string += "top="+top+" ";
-    if (bottom !is null) string += "bottom="+bottom+" ";
+override public String toString () {
+    String string = getName()~" {";
+    if (width !is DWT.DEFAULT) string ~= "width="~to!(String)(width)~" ";
+    if (height !is DWT.DEFAULT) string ~= "height="~to!(String)(height)~" ";
+    if (left !is null) string ~= "left="~to!(String)(left)~" ";
+    if (right !is null) string ~= "right="~to!(String)(right)~" ";
+    if (top !is null) string ~= "top="~to!(String)(top)~" ";
+    if (bottom !is null) string ~= "bottom="~to!(String)(bottom)~" ";
     string = string.trim();
-    string += "}";
+    string ~= "}";
     return string;
 }
 
--- a/dwt/layout/FormLayout.d	Tue Oct 07 14:41:16 2008 +0200
+++ b/dwt/layout/FormLayout.d	Tue Oct 07 14:41:31 2008 +0200
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
  * 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
@@ -7,21 +7,27 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
 module dwt.layout.FormLayout;
 
-import dwt.dwthelper.utils;
-
+import dwt.layout.FormAttachment;
+import dwt.layout.FormData;
 import dwt.DWT;
 import dwt.graphics.Point;
 import dwt.graphics.Rectangle;
-import dwt.widgets.Composite;
 import dwt.widgets.Control;
 import dwt.widgets.Layout;
+import dwt.widgets.Composite;
 import dwt.widgets.Scrollable;
 
+import tango.util.Convert;
+import Math = tango.math.Math;
+import dwt.dwthelper.utils;
+
 /**
- * Instances of this class control the position and size of the 
+ * Instances of this class control the position and size of the
  * children of a composite control by using <code>FormAttachments</code>
  * to optionally configure the left, top, right and bottom edges of
  * each child.
@@ -57,7 +63,7 @@
  * </pre>
  * </p>
  * <p>
- * Each side of a child control can be attached to a position in the parent 
+ * Each side of a child control can be attached to a position in the parent
  * composite, or to other controls within the <code>Composite</code> by
  * creating instances of <code>FormAttachment</code> and setting them into
  * the top, bottom, left, and right fields of the child's <code>FormData</code>.
@@ -83,15 +89,17 @@
  * <code>button1</code>.  This will over constrain the layout, causing undefined
  * behavior.  The algorithm will terminate, but the results are undefined.
  * </p>
- * 
+ *
  * @see FormData
  * @see FormAttachment
- * 
+ * @see <a href="http://www.eclipse.org/swt/snippets/#formlayout">FormLayout snippets</a>
+ * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Example: LayoutExample</a>
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> 
+ *
  * @since 2.0
- * 
  */
 public final class FormLayout : Layout {
-    
+
     /**
      * marginWidth specifies the number of pixels of horizontal margin
      * that will be placed along the left and right edges of the layout.
@@ -99,7 +107,7 @@
      * The default value is 0.
      */
     public int marginWidth = 0;
-    
+
     /**
      * marginHeight specifies the number of pixels of vertical margin
      * that will be placed along the top and bottom edges of the layout.
@@ -107,14 +115,14 @@
      * The default value is 0.
      */
     public int marginHeight = 0;
- 
+
 
     /**
      * marginLeft specifies the number of pixels of horizontal margin
      * that will be placed along the left edge of the layout.
      *
      * The default value is 0.
-     * 
+     *
      * @since 3.1
      */
     public int marginLeft = 0;
@@ -124,7 +132,7 @@
      * that will be placed along the top edge of the layout.
      *
      * The default value is 0.
-     * 
+     *
      * @since 3.1
      */
     public int marginTop = 0;
@@ -134,7 +142,7 @@
      * that will be placed along the right edge of the layout.
      *
      * The default value is 0.
-     * 
+     *
      * @since 3.1
      */
     public int marginRight = 0;
@@ -144,7 +152,7 @@
      * that will be placed along the bottom edge of the layout.
      *
      * The default value is 0.
-     * 
+     *
      * @since 3.1
      */
     public int marginBottom = 0;
@@ -154,11 +162,11 @@
      * and the edge of its neighbouring control.
      *
      * The default value is 0.
-     * 
+     *
      * @since 3.0
      */
     public int spacing = 0;
-    
+
 /**
  * Constructs a new instance of this class.
  */
@@ -168,28 +176,28 @@
 /*
  * Computes the preferred height of the form with
  * respect to the preferred height of the control.
- * 
- * Given that the equations for top cast(T) and bottom cast(B)
- * of the control in terms of the height of the form cast(X)
+ *
+ * Given that the equations for top (T) and bottom (B)
+ * of the control in terms of the height of the form (X)
  * are:
  *      T = AX + B
  *      B = CX + D
- * 
- * The equation for the height of the control cast(H)
- * is bottom cast(B) minus top cast(T) or (H = B - T) or:
- * 
+ *
+ * The equation for the height of the control (H)
+ * is bottom (B) minus top (T) or (H = B - T) or:
+ *
  *      H = (CX + D) - (AX + B)
- * 
- * Solving for cast(X), the height of the form, we get:
- * 
+ *
+ * Solving for (X), the height of the form, we get:
+ *
  *      X = (H + B - D) / (C - A)
- * 
+ *
  * When (A = C), (C - A = 0) and the equation has no
  * solution for X.  This is a special case meaning that
  * the control does not constrain the height of the
  * form.  In this case, we need to arbitrarily define
- * the height of the form cast(X):
- * 
+ * the height of the form (X):
+ *
  * Case 1: A = C, A = 0, C = 0
  *
  *      Let X = D, the distance from the top of the form
@@ -197,9 +205,9 @@
  *      the control was attached to the top of the form
  *      and the form needs to be large enough to show the
  *      bottom edge of the control.
- * 
+ *
  * Case 2: A = C, A = 1, C = 1
- * 
+ *
  *      Let X = -B, the distance from the bottom of the
  *      form to the top edge of the control.  In this case,
  *      the control was attached to the bottom of the form
@@ -208,21 +216,21 @@
  *      positive, there is no possible height for the form
  *      that will show the control as it will always be
  *      below the bottom edge of the form.
- * 
+ *
  * Case 3: A = C, A !is 0, C !is 0 and A !is 1, C !is 0
- * 
- *      Let X = D / (1 - C), the distance from the top of the 
- *      form to the bottom edge of the control.  In this case, 
- *      since C is not 0 or 1, it must be a fraction, U / V.  
- *      The offset D is the distance from CX to the bottom edge 
- *      of the control.  This represents a fraction of the form 
- *      (1 - C)X. Since the height of a fraction of the form is 
+ *
+ *      Let X = D / (1 - C), the distance from the top of the
+ *      form to the bottom edge of the control.  In this case,
+ *      since C is not 0 or 1, it must be a fraction, U / V.
+ *      The offset D is the distance from CX to the bottom edge
+ *      of the control.  This represents a fraction of the form
+ *      (1 - C)X. Since the height of a fraction of the form is
  *      known, the height of the entire form can be found by setting
- *      (1 - C)X = D.  We solve this equation for X in terms of U 
- *      and V, giving us X = (U * D) / (U - V). Similarly, if the 
+ *      (1 - C)X = D.  We solve this equation for X in terms of U
+ *      and V, giving us X = (U * D) / (U - V). Similarly, if the
  *      offset D is negative, the control is positioned above CX.
  *      The offset -B is the distance from the top edge of the control
- *      to CX. We can find the height of the entire form by setting 
+ *      to CX. We can find the height of the entire form by setting
  *      CX = -B. Solving in terms of U and V gives us X = (-B * V) / U.
  */
 int computeHeight (Control control, FormData data, bool flushCache) {
@@ -235,30 +243,30 @@
         if (bottom.offset <= 0) {
             return -top.offset * top.denominator / bottom.numerator;
         }
-        int divider = bottom.denominator - bottom.numerator; 
+        int divider = bottom.denominator - bottom.numerator;
         return bottom.denominator * bottom.offset / divider;
     }
     return height.solveY (data.getHeight (control, flushCache));
 }
 
-protected Point computeSize (Composite composite, int wHint, int hHint, bool flushCache) {
+override protected Point computeSize (Composite composite, int wHint, int hHint, bool flushCache) {
     Point size = layout (composite, false, 0, 0, wHint, hHint, flushCache);
     if (wHint !is DWT.DEFAULT) size.x = wHint;
     if (hHint !is DWT.DEFAULT) size.y = hHint;
     return size;
 }
 
-protected bool flushCache (Control control) {
+override protected bool flushCache (Control control) {
     Object data = control.getLayoutData ();
     if (data !is null) (cast(FormData) data).flushCache ();
     return true;
 }
 
 String getName () {
-    String string = getClass ().getName ();
-    int index = string.lastIndexOf ('.');
-    if (index is -1) return string;
-    return string.substring (index + 1, string.length ());
+    String string = this.classinfo.name;
+    int index = string.lastIndexOf('.');
+    if (index is -1 ) return string;
+    return string[ index + 1 .. string.length ];
 }
 
 /*
@@ -275,13 +283,13 @@
         if (right.offset <= 0) {
             return -left.offset * left.denominator / left.numerator;
         }
-        int divider = right.denominator - right.numerator; 
+        int divider = right.denominator - right.numerator;
         return right.denominator * right.offset / divider;
     }
     return width.solveY (data.getWidth (control, flushCache));
 }
 
-protected void layout (Composite composite, bool flushCache) {
+override protected void layout (Composite composite, bool flushCache) {
     Rectangle rect = composite.getClientArea ();
     int x = rect.x + marginLeft + marginWidth;
     int y = rect.y + marginTop + marginHeight;
@@ -313,8 +321,8 @@
             if (data.height is DWT.DEFAULT && !data.needed) {
                 int trim = 0;
                 //TEMPORARY CODE
-                if ( null !is cast(Scrollable)child ) {
-                    Rectangle rect = (cast(Scrollable) child).computeTrim (0, 0, 0, 0);
+                if ( auto sa = cast(Scrollable)child) {
+                    Rectangle rect = sa.computeTrim (0, 0, 0, 0);
                     trim = rect.width;
                 } else {
                     trim = child.getBorderWidth () * 2;
@@ -373,17 +381,17 @@
  *
  * @return a string representation of the layout
  */
-public String toString () {
-    String string =  getName ()+" {";
-    if (marginWidth !is 0) string += "marginWidth="+marginWidth+" ";
-    if (marginHeight !is 0) string += "marginHeight="+marginHeight+" ";
-    if (marginLeft !is 0) string += "marginLeft="+marginLeft+" ";
-    if (marginRight !is 0) string += "marginRight="+marginRight+" ";
-    if (marginTop !is 0) string += "marginTop="+marginTop+" ";
-    if (marginBottom !is 0) string += "marginBottom="+marginBottom+" ";
-    if (spacing !is 0) string += "spacing="+spacing+" ";
+override public String toString () {
+    String string =  getName ()~" {";
+    if (marginWidth !is 0) string ~= "marginWidth="~to!(String)(marginWidth)~" ";
+    if (marginHeight !is 0) string ~= "marginHeight="~to!(String)(marginHeight)~" ";
+    if (marginLeft !is 0) string ~= "marginLeft="~to!(String)(marginLeft)~" ";
+    if (marginRight !is 0) string ~= "marginRight="~to!(String)(marginRight)~" ";
+    if (marginTop !is 0) string ~= "marginTop="~to!(String)(marginTop)~" ";
+    if (marginBottom !is 0) string ~= "marginBottom="~to!(String)(marginBottom)~" ";
+    if (spacing !is 0) string ~= "spacing="~to!(String)(spacing)~" ";
     string = string.trim();
-    string += "}";
+    string ~= "}";
     return string;
-}   
 }
+}
--- a/dwt/layout/GridData.d	Tue Oct 07 14:41:16 2008 +0200
+++ b/dwt/layout/GridData.d	Tue Oct 07 14:41:31 2008 +0200
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
  * 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
@@ -7,21 +7,24 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
 module dwt.layout.GridData;
 
-import dwt.dwthelper.utils;
-
 import dwt.DWT;
 import dwt.graphics.Point;
 import dwt.widgets.Control;
 
+import tango.util.Convert;
+import dwt.dwthelper.utils;
+
 /**
- * <code>GridData</code> is the layout data object associated with 
- * <code>GridLayout</code>. To set a <code>GridData</code> object into a 
- * control, you use the <code>Control.setLayoutData(Object)</code> method. 
+ * <code>GridData</code> is the layout data object associated with
+ * <code>GridLayout</code>. To set a <code>GridData</code> object into a
+ * control, you use the <code>Control.setLayoutData(Object)</code> method.
  * <p>
- * There are two ways to create a <code>GridData</code> object with certain 
+ * There are two ways to create a <code>GridData</code> object with certain
  * fields set. The first is to set the fields directly, like this:
  * <pre>
  *      GridData gridData = new GridData();
@@ -29,27 +32,28 @@
  *      gridData.grabExcessHorizontalSpace = true;
  *      button1.setLayoutData(gridData);
  * </pre>
- * The second is to take advantage of convenience style bits defined 
+ * The second is to take advantage of convenience style bits defined
  * by <code>GridData</code>:
  * <pre>
  *      button1.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
  * </pre>
  * </p>
  * <p>
- * NOTE: Do not reuse <code>GridData</code> objects. Every control in a 
+ * NOTE: Do not reuse <code>GridData</code> objects. Every control in a
  * <code>Composite</code> that is managed by a <code>GridLayout</code>
- * must have a unique <code>GridData</code> object. If the layout data 
- * for a control in a <code>GridLayout</code> is null at layout time, 
+ * must have a unique <code>GridData</code> object. If the layout data
+ * for a control in a <code>GridLayout</code> is null at layout time,
  * a unique <code>GridData</code> object is created for it.
  * </p>
- * 
+ *
  * @see GridLayout
  * @see Control#setLayoutData
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
  */
 public final class GridData {
     /**
-     * verticalAlignment specifies how controls will be positioned 
-     * vertically within a cell. 
+     * verticalAlignment specifies how controls will be positioned
+     * vertically within a cell.
      *
      * The default value is CENTER.
      *
@@ -61,10 +65,10 @@
      * </ul>
      */
     public int verticalAlignment = CENTER;
-    
+
     /**
-     * horizontalAlignment specifies how controls will be positioned 
-     * horizontally within a cell. 
+     * horizontalAlignment specifies how controls will be positioned
+     * horizontally within a cell.
      *
      * The default value is BEGINNING.
      *
@@ -76,29 +80,29 @@
      * </ul>
      */
     public int horizontalAlignment = BEGINNING;
-    
+
     /**
      * widthHint specifies the preferred width in pixels. This value
-     * is the wHint passed into Control.computeSize(int, int, bool) 
+     * is the wHint passed into Control.computeSize(int, int, bool)
      * to determine the preferred size of the control.
      *
      * The default value is DWT.DEFAULT.
-     * 
+     *
      * @see Control#computeSize(int, int, bool)
      */
     public int widthHint = DWT.DEFAULT;
-    
+
     /**
      * heightHint specifies the preferred height in pixels. This value
-     * is the hHint passed into Control.computeSize(int, int, bool) 
+     * is the hHint passed into Control.computeSize(int, int, bool)
      * to determine the preferred size of the control.
      *
      * The default value is DWT.DEFAULT.
-     * 
+     *
      * @see Control#computeSize(int, int, bool)
      */
     public int heightHint = DWT.DEFAULT;
-    
+
     /**
      * horizontalIndent specifies the number of pixels of indentation
      * that will be placed along the left side of the cell.
@@ -106,17 +110,17 @@
      * The default value is 0.
      */
     public int horizontalIndent = 0;
-    
+
     /**
      * verticalIndent specifies the number of pixels of indentation
      * that will be placed along the top side of the cell.
      *
      * The default value is 0.
-     * 
+     *
      * @since 3.1
      */
     public int verticalIndent = 0;
-    
+
     /**
      * horizontalSpan specifies the number of column cells that the control
      * will take up.
@@ -124,7 +128,7 @@
      * The default value is 1.
      */
     public int horizontalSpan = 1;
-    
+
     /**
      * verticalSpan specifies the number of row cells that the control
      * will take up.
@@ -132,74 +136,74 @@
      * The default value is 1.
      */
     public int verticalSpan = 1;
-    
+
     /**
-     * <p>grabExcessHorizontalSpace specifies whether the width of the cell 
-     * changes depending on the size of the parent Composite.  If 
+     * <p>grabExcessHorizontalSpace specifies whether the width of the cell
+     * changes depending on the size of the parent Composite.  If
      * grabExcessHorizontalSpace is <code>true</code>, the following rules
      * apply to the width of the cell:</p>
      * <ul>
-     * <li>If extra horizontal space is available in the parent, the cell will 
-     * grow to be wider than its preferred width.  The new width 
-     * will be "preferred width + delta" where delta is the extra 
+     * <li>If extra horizontal space is available in the parent, the cell will
+     * grow to be wider than its preferred width.  The new width
+     * will be "preferred width + delta" where delta is the extra
      * horizontal space divided by the number of grabbing columns.</li>
-     * <li>If there is not enough horizontal space available in the parent, the 
-     * cell will shrink until it reaches its minimum width as specified by 
-     * GridData.minimumWidth. The new width will be the maximum of 
-     * "minimumWidth" and "preferred width - delta", where delta is 
+     * <li>If there is not enough horizontal space available in the parent, the
+     * cell will shrink until it reaches its minimum width as specified by
+     * GridData.minimumWidth. The new width will be the maximum of
+     * "minimumWidth" and "preferred width - delta", where delta is
      * the amount of space missing divided by the number of grabbing columns.</li>
-     * <li>If the parent is packed, the cell will be its preferred width 
+     * <li>If the parent is packed, the cell will be its preferred width
      * as specified by GridData.widthHint.</li>
-     * <li>If the control spans multiple columns and there are no other grabbing 
+     * <li>If the control spans multiple columns and there are no other grabbing
      * controls in any of the spanned columns, the last column in the span will
      * grab the extra space.  If there is at least one other grabbing control
-     * in the span, the grabbing will be spread over the columns already 
+     * in the span, the grabbing will be spread over the columns already
      * marked as grabExcessHorizontalSpace.</li>
      * </ul>
-     * 
+     *
      * <p>The default value is false.</p>
-     * 
+     *
      * @see GridData#minimumWidth
      * @see GridData#widthHint
-     */ 
+     */
     public bool grabExcessHorizontalSpace = false;
-    
+
     /**
-     * <p>grabExcessVerticalSpace specifies whether the height of the cell 
-     * changes depending on the size of the parent Composite.  If 
+     * <p>grabExcessVerticalSpace specifies whether the height of the cell
+     * changes depending on the size of the parent Composite.  If
      * grabExcessVerticalSpace is <code>true</code>, the following rules
      * apply to the height of the cell:</p>
      * <ul>
-     * <li>If extra vertical space is available in the parent, the cell will 
-     * grow to be taller than its preferred height.  The new height 
-     * will be "preferred height + delta" where delta is the extra 
+     * <li>If extra vertical space is available in the parent, the cell will
+     * grow to be taller than its preferred height.  The new height
+     * will be "preferred height + delta" where delta is the extra
      * vertical space divided by the number of grabbing rows.</li>
-     * <li>If there is not enough vertical space available in the parent, the 
-     * cell will shrink until it reaches its minimum height as specified by 
-     * GridData.minimumHeight. The new height will be the maximum of 
-     * "minimumHeight" and "preferred height - delta", where delta is 
+     * <li>If there is not enough vertical space available in the parent, the
+     * cell will shrink until it reaches its minimum height as specified by
+     * GridData.minimumHeight. The new height will be the maximum of
+     * "minimumHeight" and "preferred height - delta", where delta is
      * the amount of space missing divided by the number of grabbing rows.</li>
-     * <li>If the parent is packed, the cell will be its preferred height 
+     * <li>If the parent is packed, the cell will be its preferred height
      * as specified by GridData.heightHint.</li>
-     * <li>If the control spans multiple rows and there are no other grabbing 
+     * <li>If the control spans multiple rows and there are no other grabbing
      * controls in any of the spanned rows, the last row in the span will
      * grab the extra space.  If there is at least one other grabbing control
-     * in the span, the grabbing will be spread over the rows already 
+     * in the span, the grabbing will be spread over the rows already
      * marked as grabExcessVerticalSpace.</li>
      * </ul>
-     * 
+     *
      * <p>The default value is false.</p>
-     * 
+     *
      * @see GridData#minimumHeight
      * @see GridData#heightHint
-     */ 
+     */
     public bool grabExcessVerticalSpace = false;
 
     /**
      * minimumWidth specifies the minimum width in pixels.  This value
-     * applies only if grabExcessHorizontalSpace is true. A value of 
+     * applies only if grabExcessHorizontalSpace is true. A value of
      * DWT.DEFAULT means that the minimum width will be the result
-     * of Control.computeSize(int, int, bool) where wHint is 
+     * of Control.computeSize(int, int, bool) where wHint is
      * determined by GridData.widthHint.
      *
      * The default value is 0.
@@ -209,12 +213,12 @@
      * @see GridData#widthHint
      */
     public int minimumWidth = 0;
-    
+
     /**
      * minimumHeight specifies the minimum height in pixels.  This value
-     * applies only if grabExcessVerticalSpace is true.  A value of 
+     * applies only if grabExcessVerticalSpace is true.  A value of
      * DWT.DEFAULT means that the minimum height will be the result
-     * of Control.computeSize(int, int, bool) where hHint is 
+     * of Control.computeSize(int, int, bool) where hHint is
      * determined by GridData.heightHint.
      *
      * The default value is 0.
@@ -224,170 +228,170 @@
      * @see GridData#heightHint
      */
     public int minimumHeight = 0;
-    
+
     /**
      * exclude informs the layout to ignore this control when sizing
      * and positioning controls.  If this value is <code>true</code>,
      * the size and position of the control will not be managed by the
-     * layout.  If this value is <code>false</code>, the size and 
+     * layout.  If this value is <code>false</code>, the size and
      * position of the control will be computed and assigned.
-     * 
+     *
      * The default value is <code>false</code>.
-     * 
+     *
      * @since 3.1
      */
     public bool exclude = false;
-    
+
     /**
      * Value for horizontalAlignment or verticalAlignment.
      * Position the control at the top or left of the cell.
      * Not recommended. Use DWT.BEGINNING, DWT.TOP or DWT.LEFT instead.
      */
-    public static final int BEGINNING = DWT.BEGINNING;
-    
+    public static const int BEGINNING = DWT.BEGINNING;
+
     /**
      * Value for horizontalAlignment or verticalAlignment.
      * Position the control in the vertical or horizontal center of the cell
      * Not recommended. Use DWT.CENTER instead.
      */
-    public static final int CENTER = 2;
-    
+    public static const int CENTER = 2;
+
     /**
      * Value for horizontalAlignment or verticalAlignment.
      * Position the control at the bottom or right of the cell
      * Not recommended. Use DWT.END, DWT.BOTTOM or DWT.RIGHT instead.
      */
-    public static final int END = 3;
-    
+    public static const int END = 3;
+
     /**
      * Value for horizontalAlignment or verticalAlignment.
      * Resize the control to fill the cell horizontally or vertically.
      * Not recommended. Use DWT.FILL instead.
      */
-    public static final int FILL = DWT.FILL;
+    public static const int FILL = DWT.FILL;
 
     /**
      * Style bit for <code>new GridData(int)</code>.
      * Position the control at the top of the cell.
-     * Not recommended. Use 
+     * Not recommended. Use
      * <code>new GridData(int, DWT.BEGINNING, bool, bool)</code>
      * instead.
      */
-    public static final int VERTICAL_ALIGN_BEGINNING =  1 << 1;
-    
+    public static const int VERTICAL_ALIGN_BEGINNING =  1 << 1;
+
     /**
-     * Style bit for <code>new GridData(int)</code> to position the 
+     * Style bit for <code>new GridData(int)</code> to position the
      * control in the vertical center of the cell.
      * Not recommended. Use
      * <code>new GridData(int, DWT.CENTER, bool, bool)</code>
      * instead.
      */
-    public static final int VERTICAL_ALIGN_CENTER = 1 << 2;
-    
+    public static const int VERTICAL_ALIGN_CENTER = 1 << 2;
+
     /**
-     * Style bit for <code>new GridData(int)</code> to position the 
+     * Style bit for <code>new GridData(int)</code> to position the
      * control at the bottom of the cell.
      * Not recommended. Use
      * <code>new GridData(int, DWT.END, bool, bool)</code>
      * instead.
      */
-    public static final int VERTICAL_ALIGN_END = 1 << 3;
-    
+    public static const int VERTICAL_ALIGN_END = 1 << 3;
+
     /**
-     * Style bit for <code>new GridData(int)</code> to resize the 
+     * Style bit for <code>new GridData(int)</code> to resize the
      * control to fill the cell vertically.
      * Not recommended. Use
      * <code>new GridData(int, DWT.FILL, bool, bool)</code>
      * instead
      */
-    public static final int VERTICAL_ALIGN_FILL = 1 << 4;
-    
+    public static const int VERTICAL_ALIGN_FILL = 1 << 4;
+
     /**
-     * Style bit for <code>new GridData(int)</code> to position the 
+     * Style bit for <code>new GridData(int)</code> to position the
      * control at the left of the cell.
      * Not recommended. Use
      * <code>new GridData(DWT.BEGINNING, int, bool, bool)</code>
      * instead.
      */
-    public static final int HORIZONTAL_ALIGN_BEGINNING =  1 << 5;
-    
+    public static const int HORIZONTAL_ALIGN_BEGINNING =  1 << 5;
+
     /**
-     * Style bit for <code>new GridData(int)</code> to position the 
+     * Style bit for <code>new GridData(int)</code> to position the
      * control in the horizontal center of the cell.
      * Not recommended. Use
      * <code>new GridData(DWT.CENTER, int, bool, bool)</code>
      * instead.
      */
-    public static final int HORIZONTAL_ALIGN_CENTER = 1 << 6;
-    
+    public static const int HORIZONTAL_ALIGN_CENTER = 1 << 6;
+
     /**
-     * Style bit for <code>new GridData(int)</code> to position the 
+     * Style bit for <code>new GridData(int)</code> to position the
      * control at the right of the cell.
      * Not recommended. Use
      * <code>new GridData(DWT.END, int, bool, bool)</code>
      * instead.
      */
-    public static final int HORIZONTAL_ALIGN_END = 1 << 7;
-    
+    public static const int HORIZONTAL_ALIGN_END = 1 << 7;
+
     /**
-     * Style bit for <code>new GridData(int)</code> to resize the 
+     * Style bit for <code>new GridData(int)</code> to resize the
      * control to fill the cell horizontally.
      * Not recommended. Use
      * <code>new GridData(DWT.FILL, int, bool, bool)</code>
      * instead.
      */
-    public static final int HORIZONTAL_ALIGN_FILL = 1 << 8;
-    
+    public static const int HORIZONTAL_ALIGN_FILL = 1 << 8;
+
     /**
-     * Style bit for <code>new GridData(int)</code> to resize the 
+     * Style bit for <code>new GridData(int)</code> to resize the
      * control to fit the remaining horizontal space.
      * Not recommended. Use
      * <code>new GridData(int, int, true, bool)</code>
      * instead.
      */
-    public static final int GRAB_HORIZONTAL = 1 << 9;
-    
+    public static const int GRAB_HORIZONTAL = 1 << 9;
+
     /**
-     * Style bit for <code>new GridData(int)</code> to resize the 
+     * Style bit for <code>new GridData(int)</code> to resize the
      * control to fit the remaining vertical space.
      * Not recommended. Use
      * <code>new GridData(int, int, bool, true)</code>
      * instead.
      */
-    public static final int GRAB_VERTICAL = 1 << 10;
-    
+    public static const int GRAB_VERTICAL = 1 << 10;
+
     /**
-     * Style bit for <code>new GridData(int)</code> to resize the 
+     * Style bit for <code>new GridData(int)</code> to resize the
      * control to fill the cell vertically and to fit the remaining
      * vertical space.
      * FILL_VERTICAL = VERTICAL_ALIGN_FILL | GRAB_VERTICAL
      * Not recommended. Use
      * <code>new GridData(int, DWT.FILL, bool, true)</code>
      * instead.
-     */ 
-    public static final int FILL_VERTICAL = VERTICAL_ALIGN_FILL | GRAB_VERTICAL;
-    
+     */
+    public static const int FILL_VERTICAL = VERTICAL_ALIGN_FILL | GRAB_VERTICAL;
+
     /**
-     * Style bit for <code>new GridData(int)</code> to resize the 
+     * Style bit for <code>new GridData(int)</code> to resize the
      * control to fill the cell horizontally and to fit the remaining
      * horizontal space.
      * FILL_HORIZONTAL = HORIZONTAL_ALIGN_FILL | GRAB_HORIZONTAL
      * Not recommended. Use
      * <code>new GridData(DWT.FILL, int, true, bool)</code>
      * instead.
-     */ 
-    public static final int FILL_HORIZONTAL = HORIZONTAL_ALIGN_FILL | GRAB_HORIZONTAL;
-    
+     */
+    public static const int FILL_HORIZONTAL = HORIZONTAL_ALIGN_FILL | GRAB_HORIZONTAL;
+
     /**
-     * Style bit for <code>new GridData(int)</code> to resize the 
-     * control to fill the cell horizontally and vertically and 
+     * Style bit for <code>new GridData(int)</code> to resize the
+     * control to fill the cell horizontally and vertically and
      * to fit the remaining horizontal and vertical space.
      * FILL_BOTH = FILL_VERTICAL | FILL_HORIZONTAL
      * Not recommended. Use
      * <code>new GridData(DWT.FILL, DWT.FILL, true, true)</code>
      * instead.
-     */ 
-    public static final int FILL_BOTH = FILL_VERTICAL | FILL_HORIZONTAL;
+     */
+    public static const int FILL_BOTH = FILL_VERTICAL | FILL_HORIZONTAL;
 
     int cacheWidth = -1, cacheHeight = -1;
     int defaultWhint, defaultHhint, defaultWidth = -1, defaultHeight = -1;
@@ -398,17 +402,15 @@
  * default values.
  */
 public this () {
-    super ();
 }
 
 /**
  * Constructs a new instance based on the GridData style.
  * This constructor is not recommended.
- * 
+ *
  * @param style the GridData style
  */
 public this (int style) {
-    super ();
     if ((style & VERTICAL_ALIGN_BEGINNING) !is 0) verticalAlignment = BEGINNING;
     if ((style & VERTICAL_ALIGN_CENTER) !is 0) verticalAlignment = CENTER;
     if ((style & VERTICAL_ALIGN_FILL) !is 0) verticalAlignment = FILL;
@@ -423,12 +425,14 @@
 
 /**
  * Constructs a new instance of GridData according to the parameters.
- * 
- * @param horizontalAlignment how control will be positioned horizontally within a cell
- * @param verticalAlignment how control will be positioned vertically within a cell
+ *
+ * @param horizontalAlignment how control will be positioned horizontally within a cell,
+ *      one of: DWT.BEGINNING (or DWT.LEFT), DWT.CENTER, DWT.END (or DWT.RIGHT), or DWT.FILL
+ * @param verticalAlignment how control will be positioned vertically within a cell,
+ *      one of: DWT.BEGINNING (or DWT.TOP), DWT.CENTER, DWT.END (or DWT.BOTTOM), or DWT.FILL
  * @param grabExcessHorizontalSpace whether cell will be made wide enough to fit the remaining horizontal space
  * @param grabExcessVerticalSpace whether cell will be made high enough to fit the remaining vertical space
- * 
+ *
  * @since 3.0
  */
 public this (int horizontalAlignment, int verticalAlignment, bool grabExcessHorizontalSpace, bool grabExcessVerticalSpace) {
@@ -437,18 +441,19 @@
 
 /**
  * Constructs a new instance of GridData according to the parameters.
- *  
- * @param horizontalAlignment how control will be positioned horizontally within a cell
- * @param verticalAlignment how control will be positioned vertically within a cell
+ *
+ * @param horizontalAlignment how control will be positioned horizontally within a cell,
+ *      one of: DWT.BEGINNING (or DWT.LEFT), DWT.CENTER, DWT.END (or DWT.RIGHT), or DWT.FILL
+ * @param verticalAlignment how control will be positioned vertically within a cell,
+ *      one of: DWT.BEGINNING (or DWT.TOP), DWT.CENTER, DWT.END (or DWT.BOTTOM), or DWT.FILL
  * @param grabExcessHorizontalSpace whether cell will be made wide enough to fit the remaining horizontal space
  * @param grabExcessVerticalSpace whether cell will be made high enough to fit the remaining vertical space
  * @param horizontalSpan the number of column cells that the control will take up
  * @param verticalSpan the number of row cells that the control will take up
- * 
+ *
  * @since 3.0
  */
 public this (int horizontalAlignment, int verticalAlignment, bool grabExcessHorizontalSpace, bool grabExcessVerticalSpace, int horizontalSpan, int verticalSpan) {
-    super ();
     this.horizontalAlignment = horizontalAlignment;
     this.verticalAlignment = verticalAlignment;
     this.grabExcessHorizontalSpace = grabExcessHorizontalSpace;
@@ -461,14 +466,13 @@
  * Constructs a new instance of GridData according to the parameters.
  * A value of DWT.DEFAULT indicates that no minimum width or
  * no minimum height is specified.
- * 
+ *
  * @param width a minimum width for the column
  * @param height a minimum height for the row
- * 
+ *
  * @since 3.0
  */
 public this (int width, int height) {
-    super ();
     this.widthHint = width;
     this.heightHint = height;
 }
@@ -505,10 +509,10 @@
 }
 
 String getName () {
-    String string = getClass ().getName ();
-    int index = string.lastIndexOf ('.');
-    if (index is -1) return string;
-    return string.substring (index + 1, string.length ());
+    String string = this.classinfo.name;
+    int index = string.lastIndexOf('.');
+    if (index is -1 ) return string;
+    return string[ index + 1 .. string.length ];
 }
 
 /**
@@ -517,7 +521,7 @@
  *
  * @return a string representation of the GridData object
  */
-public String toString () {
+override public String toString () {
     String hAlign = "";
     switch (horizontalAlignment) {
         case DWT.FILL: hAlign = "DWT.FILL"; break;
@@ -528,7 +532,7 @@
         case DWT.RIGHT: hAlign = "DWT.RIGHT"; break;
         case DWT.CENTER: hAlign = "DWT.CENTER"; break;
         case CENTER: hAlign = "GridData.CENTER"; break;
-        default: hAlign = "Undefined "+horizontalAlignment; break;
+        default: hAlign = "Undefined "~to!(String)(horizontalAlignment); break;
     }
     String vAlign = "";
     switch (verticalAlignment) {
@@ -540,24 +544,24 @@
         case DWT.BOTTOM: vAlign = "DWT.BOTTOM"; break;
         case DWT.CENTER: vAlign = "DWT.CENTER"; break;
         case CENTER: vAlign = "GridData.CENTER"; break;
-        default: vAlign = "Undefined "+verticalAlignment; break;
+        default: vAlign = "Undefined "~to!(String)(verticalAlignment); break;
     }
-    String string = getName()+" {";
-    string += "horizontalAlignment="+hAlign+" ";
-    if (horizontalIndent !is 0) string += "horizontalIndent="+horizontalIndent+" ";
-    if (horizontalSpan !is 1) string += "horizontalSpan="+horizontalSpan+" ";
-    if (grabExcessHorizontalSpace) string += "grabExcessHorizontalSpace="+grabExcessHorizontalSpace+" ";
-    if (widthHint !is DWT.DEFAULT) string += "widthHint="+widthHint+" ";
-    if (minimumWidth !is 0) string += "minimumWidth="+minimumWidth+" ";
-    string += "verticalAlignment="+vAlign+" ";
-    if (verticalIndent !is 0) string += "verticalIndent="+verticalIndent+" ";
-    if (verticalSpan !is 1) string += "verticalSpan="+verticalSpan+" ";
-    if (grabExcessVerticalSpace) string += "grabExcessVerticalSpace="+grabExcessVerticalSpace+" ";
-    if (heightHint !is DWT.DEFAULT) string += "heightHint="+heightHint+" ";
-    if (minimumHeight !is 0) string += "minimumHeight="+minimumHeight+" ";
-    if (exclude) string += "exclude="+exclude+" ";
+    String string = getName()~" {";
+    string ~= "horizontalAlignment="~to!(String)(hAlign)~" ";
+    if (horizontalIndent !is 0) string ~= "horizontalIndent="~to!(String)(horizontalIndent)~" ";
+    if (horizontalSpan !is 1) string ~= "horizontalSpan="~to!(String)(horizontalSpan)~" ";
+    if (grabExcessHorizontalSpace) string ~= "grabExcessHorizontalSpace="~to!(String)(grabExcessHorizontalSpace)~" ";
+    if (widthHint !is DWT.DEFAULT) string ~= "widthHint="~to!(String)(widthHint)~" ";
+    if (minimumWidth !is 0) string ~= "minimumWidth="~to!(String)(minimumWidth)~" ";
+    string ~= "verticalAlignment="~vAlign~" ";
+    if (verticalIndent !is 0) string ~= "verticalIndent="~to!(String)(verticalIndent)~" ";
+    if (verticalSpan !is 1) string ~= "verticalSpan="~to!(String)(verticalSpan)~" ";
+    if (grabExcessVerticalSpace) string ~= "grabExcessVerticalSpace="~to!(String)(grabExcessVerticalSpace)~" ";
+    if (heightHint !is DWT.DEFAULT) string ~= "heightHint="~to!(String)(heightHint)~" ";
+    if (minimumHeight !is 0) string ~= "minimumHeight="~to!(String)(minimumHeight)~" ";
+    if (exclude) string ~= "exclude="~to!(String)(exclude)~" ";
     string = string.trim();
-    string += "}";
+    string ~= "}";
     return string;
 }
 }
--- a/dwt/layout/GridLayout.d	Tue Oct 07 14:41:16 2008 +0200
+++ b/dwt/layout/GridLayout.d	Tue Oct 07 14:41:31 2008 +0200
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
  * 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
@@ -7,27 +7,35 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
 module dwt.layout.GridLayout;
 
-import dwt.dwthelper.utils;
-
+import dwt.layout.GridData;
 import dwt.DWT;
 import dwt.graphics.Point;
 import dwt.graphics.Rectangle;
+import dwt.widgets.Control;
 import dwt.widgets.Composite;
-import dwt.widgets.Control;
 import dwt.widgets.Layout;
 import dwt.widgets.Scrollable;
 
+import dwt.dwthelper.System;
+
+import tango.util.Convert;
+import Math = tango.math.Math;
+import dwt.dwthelper.utils;
+
+
 /**
- * Instances of this class lay out the control children of a 
- * <code>Composite</code> in a grid. 
+ * Instances of this class lay out the control children of a
+ * <code>Composite</code> in a grid.
  * <p>
- * <code>GridLayout</code> has a number of configuration fields, and the 
- * controls it lays out can have an associated layout data object, called 
- * <code>GridData</code>. The power of <code>GridLayout</code> lies in the 
- * ability to configure <code>GridData</code> for each control in the layout. 
+ * <code>GridLayout</code> has a number of configuration fields, and the
+ * controls it lays out can have an associated layout data object, called
+ * <code>GridData</code>. The power of <code>GridLayout</code> lies in the
+ * ability to configure <code>GridData</code> for each control in the layout.
  * </p>
  * <p>
  * The following code creates a shell managed by a <code>GridLayout</code>
@@ -39,16 +47,19 @@
  *      gridLayout.numColumns = 3;
  *      shell.setLayout(gridLayout);
  * </pre>
- * The <code>numColumns</code> field is the most important field in a 
- * <code>GridLayout</code>. Widgets are laid out in columns from left 
- * to right, and a new row is created when <code>numColumns</code> + 1 
+ * The <code>numColumns</code> field is the most important field in a
+ * <code>GridLayout</code>. Widgets are laid out in columns from left
+ * to right, and a new row is created when <code>numColumns</code> + 1
  * controls are added to the <code>Composite<code>.
  * </p>
- * 
+ *
  * @see GridData
+ * @see <a href="http://www.eclipse.org/swt/snippets/#gridlayout">GridLayout snippets</a>
+ * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Example: LayoutExample</a>
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
  */
 public final class GridLayout : Layout {
- 
+
     /**
      * numColumns specifies the number of cell columns in the layout.
      * If numColumns has a value less than 1, the layout will not
@@ -65,7 +76,7 @@
      * The default value is false.
      */
     public bool makeColumnsEqualWidth = false;
-    
+
     /**
      * marginWidth specifies the number of pixels of horizontal margin
      * that will be placed along the left and right edges of the layout.
@@ -73,7 +84,7 @@
      * The default value is 5.
      */
     public int marginWidth = 5;
-    
+
     /**
      * marginHeight specifies the number of pixels of vertical margin
      * that will be placed along the top and bottom edges of the layout.
@@ -87,7 +98,7 @@
      * that will be placed along the left edge of the layout.
      *
      * The default value is 0.
-     * 
+     *
      * @since 3.1
      */
     public int marginLeft = 0;
@@ -97,7 +108,7 @@
      * that will be placed along the top edge of the layout.
      *
      * The default value is 0.
-     * 
+     *
      * @since 3.1
      */
     public int marginTop = 0;
@@ -107,7 +118,7 @@
      * that will be placed along the right edge of the layout.
      *
      * The default value is 0.
-     * 
+     *
      * @since 3.1
      */
     public int marginRight = 0;
@@ -117,7 +128,7 @@
      * that will be placed along the bottom edge of the layout.
      *
      * The default value is 0.
-     * 
+     *
      * @since 3.1
      */
     public int marginBottom = 0;
@@ -138,7 +149,7 @@
      * The default value is 5.
      */
     public int verticalSpacing = 5;
- 
+
 /**
  * Constructs a new instance of this class.
  */
@@ -153,7 +164,7 @@
  *
  * @param numColumns the number of columns in the grid
  * @param makeColumnsEqualWidth whether or not the columns will have equal width
- * 
+ *
  * @since 2.0
  */
 public this (int numColumns, bool makeColumnsEqualWidth) {
@@ -161,14 +172,14 @@
     this.makeColumnsEqualWidth = makeColumnsEqualWidth;
 }
 
-protected Point computeSize (Composite composite, int wHint, int hHint, bool flushCache) {
-    Point size = layout (composite, false, 0, 0, wHint, hHint, flushCache);
+override protected Point computeSize (Composite composite, int wHint, int hHint, bool flushCache_) {
+    Point size = layout (composite, false, 0, 0, wHint, hHint, flushCache_);
     if (wHint !is DWT.DEFAULT) size.x = wHint;
     if (hHint !is DWT.DEFAULT) size.y = hHint;
     return size;
 }
 
-protected bool flushCache (Control control) {
+override protected bool flushCache (Control control) {
     Object data = control.getLayoutData ();
     if (data !is null) (cast(GridData) data).flushCache ();
     return true;
@@ -191,12 +202,12 @@
     return null;
 }
 
-protected void layout (Composite composite, bool flushCache) {
+override protected void layout (Composite composite, bool flushCache_) {
     Rectangle rect = composite.getClientArea ();
-    layout (composite, true, rect.x, rect.y, rect.width, rect.height, flushCache);
+    layout (composite, true, rect.x, rect.y, rect.width, rect.height, flushCache_);
 }
 
-Point layout (Composite composite, bool move, int x, int y, int width, int height, bool flushCache) {
+Point layout (Composite composite, bool move, int x, int y, int width, int height, bool flushCache_) {
     if (numColumns < 1) {
         return new Point (marginLeft + marginWidth * 2 + marginRight, marginTop + marginHeight * 2 + marginBottom);
     }
@@ -207,7 +218,7 @@
         GridData data = cast(GridData) control.getLayoutData ();
         if (data is null || !data.exclude) {
             children [count++] = children [i];
-        } 
+        }
     }
     if (count is 0) {
         return new Point (marginLeft + marginWidth * 2 + marginRight, marginTop + marginHeight * 2 + marginBottom);
@@ -216,14 +227,14 @@
         Control child = children [i];
         GridData data = cast(GridData) child.getLayoutData ();
         if (data is null) child.setLayoutData (data = new GridData ());
-        if (flushCache) data.flushCache ();
-        data.computeSize (child, data.widthHint, data.heightHint, flushCache);
+        if (flushCache_) data.flushCache ();
+        data.computeSize (child, data.widthHint, data.heightHint, flushCache_);
         if (data.grabExcessHorizontalSpace && data.minimumWidth > 0) {
             if (data.cacheWidth < data.minimumWidth) {
                 int trim = 0;
                 //TEMPORARY CODE
-                if ( null !is cast(Scrollable)child ) {
-                    Rectangle rect = (cast(Scrollable) child).computeTrim (0, 0, 0, 0);
+                if ( auto sa = cast(Scrollable)child ) {
+                    Rectangle rect = sa.computeTrim (0, 0, 0, 0);
                     trim = rect.width;
                 } else {
                     trim = child.getBorderWidth () * 2;
@@ -239,8 +250,8 @@
 
     /* Build the grid */
     int row = 0, column = 0, rowCount = 0, columnCount = numColumns;
-    Control [][] grid = new Control [4] [columnCount];
-    for (int i=0; i<count; i++) {   
+    Control [][] grid = new Control [][]( 4, columnCount );
+    for (int i=0; i<count; i++) {
         Control child = children [i];
         GridData data = cast(GridData) child.getLayoutData ();
         int hSpan = Math.max (1, Math.min (data.horizontalSpan, columnCount));
@@ -248,8 +259,8 @@
         while (true) {
             int lastRow = row + vSpan;
             if (lastRow >= grid.length) {
-                Control [][] newGrid = new Control [lastRow + 4] [columnCount];
-                System.arraycopy (grid, 0, newGrid, 0, grid.length);
+                Control [][] newGrid = new Control[][]( lastRow + 4, columnCount );
+                SimpleType!(Control[]).arraycopy (grid, 0, newGrid, 0, grid.length);
                 grid = newGrid;
             }
             if (grid [row] is null) {
@@ -406,7 +417,7 @@
                     }
                 }
                 if (last > -1) widths [last] += remainder;
-                
+
                 for (int j=0; j<columnCount; j++) {
                     for (int i=0; i<rowCount; i++) {
                         GridData data = getData (grid, i, j, rowCount, columnCount, false);
@@ -432,7 +443,7 @@
                                                     widths [last2=j-k] += delta2;
                                                 }
                                             }
-                                            if (last2 > -1) widths [last2] += remainder2;   
+                                            if (last2 > -1) widths [last2] += remainder2;
                                         }
                                     }
                                 }
@@ -471,8 +482,8 @@
                         currentWidth += (hSpan - 1) * horizontalSpacing - data.horizontalIndent;
                         if ((currentWidth !is data.cacheWidth && data.horizontalAlignment is DWT.FILL) || (data.cacheWidth > currentWidth)) {
                             int trim = 0;
-                            if ( null !is cast(Scrollable)child ) {
-                                Rectangle rect = (cast(Scrollable) child).computeTrim (0, 0, 0, 0);
+                            if ( auto sa = cast(Scrollable)child ) {
+                                Rectangle rect = sa.computeTrim (0, 0, 0, 0);
                                 trim = rect.width;
                             } else {
                                 trim = child.getBorderWidth () * 2;
@@ -544,7 +555,7 @@
                                     heights [last=i-k] += delta;
                                 }
                             }
-                            if (last > -1) heights [last] += remainder; 
+                            if (last > -1) heights [last] += remainder;
                         }
                     }
                     if (!data.grabExcessVerticalSpace || data.minimumHeight !is 0) {
@@ -561,7 +572,7 @@
                                         minHeights [last=i-k] += delta;
                                     }
                                 }
-                                if (last > -1) minHeights [last] += remainder;  
+                                if (last > -1) minHeights [last] += remainder;
                             }
                         }
                     }
@@ -591,7 +602,7 @@
                 }
             }
             if (last > -1) heights [last] += remainder;
-            
+
             for (int i=0; i<rowCount; i++) {
                 for (int j=0; j<columnCount; j++) {
                     GridData data = getData (grid, i, j, rowCount, columnCount, false);
@@ -669,6 +680,7 @@
                         case DWT.FILL:
                             childWidth = cellWidth - data.horizontalIndent;
                             break;
+                        default:
                     }
                     cellHeight += verticalSpacing * (vSpan - 1);
                     int childY = gridY + data.verticalIndent;
@@ -686,6 +698,7 @@
                         case DWT.FILL:
                             childHeight = cellHeight - data.verticalIndent;
                             break;
+                        default:
                     }
                     Control child = grid [i][j];
                     if (child !is null) {
@@ -717,10 +730,10 @@
 }
 
 String getName () {
-    String string = getClass ().getName ();
-    int index = string.lastIndexOf ('.');
-    if (index is -1) return string;
-    return string.substring (index + 1, string.length ());
+    String string = this.classinfo.name;
+    int index = string.lastIndexOf('.');
+    if (index is -1 ) return string;
+    return string[ index + 1 .. string.length ];
 }
 
 /**
@@ -729,20 +742,20 @@
  *
  * @return a string representation of the layout
  */
-public String toString () {
-    String string = getName ()+" {";
-    if (numColumns !is 1) string += "numColumns="+numColumns+" ";
-    if (makeColumnsEqualWidth) string += "makeColumnsEqualWidth="+makeColumnsEqualWidth+" ";
-    if (marginWidth !is 0) string += "marginWidth="+marginWidth+" ";
-    if (marginHeight !is 0) string += "marginHeight="+marginHeight+" ";
-    if (marginLeft !is 0) string += "marginLeft="+marginLeft+" ";
-    if (marginRight !is 0) string += "marginRight="+marginRight+" ";
-    if (marginTop !is 0) string += "marginTop="+marginTop+" ";
-    if (marginBottom !is 0) string += "marginBottom="+marginBottom+" ";
-    if (horizontalSpacing !is 0) string += "horizontalSpacing="+horizontalSpacing+" ";
-    if (verticalSpacing !is 0) string += "verticalSpacing="+verticalSpacing+" ";
+override public String toString () {
+    String string = getName ()~" {";
+    if (numColumns !is 1) string ~= "numColumns="~to!(String)(numColumns)~" ";
+    if (makeColumnsEqualWidth) string ~= "makeColumnsEqualWidth="~to!(String)(makeColumnsEqualWidth)~" ";
+    if (marginWidth !is 0) string ~= "marginWidth="~to!(String)(marginWidth)~" ";
+    if (marginHeight !is 0) string ~= "marginHeight="~to!(String)(marginHeight)~" ";
+    if (marginLeft !is 0) string ~= "marginLeft="~to!(String)(marginLeft)~" ";
+    if (marginRight !is 0) string ~= "marginRight="~to!(String)(marginRight)~" ";
+    if (marginTop !is 0) string ~= "marginTop="~to!(String)(marginTop)~" ";
+    if (marginBottom !is 0) string ~= "marginBottom="~to!(String)(marginBottom)~" ";
+    if (horizontalSpacing !is 0) string ~= "horizontalSpacing="~to!(String)(horizontalSpacing)~" ";
+    if (verticalSpacing !is 0) string ~= "verticalSpacing="~to!(String)(verticalSpacing)~" ";
     string = string.trim();
-    string += "}";
+    string ~= "}";
     return string;
 }
 }
--- a/dwt/layout/RowData.d	Tue Oct 07 14:41:16 2008 +0200
+++ b/dwt/layout/RowData.d	Tue Oct 07 14:41:31 2008 +0200
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
  * 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
@@ -7,17 +7,21 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
 module dwt.layout.RowData;
 
-import dwt.dwthelper.utils;
-
 import dwt.DWT;
 import dwt.graphics.Point;
+import dwt.widgets.Control;
+
+import tango.util.Convert;
+import dwt.dwthelper.utils;
 
 /**
- * Each control controlled by a <code>RowLayout</code> can have its initial 
- * width and height specified by setting a <code>RowData</code> object 
+ * Each control controlled by a <code>RowLayout</code> can have its initial
+ * width and height specified by setting a <code>RowData</code> object
  * into the control.
  * <p>
  * The following code uses a <code>RowData</code> object to change the initial
@@ -31,13 +35,14 @@
  *      button1.setLayoutData(new RowData(50, 40));
  * </pre>
  * </p>
- * 
+ *
  * @see RowLayout
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
  */
 public final class RowData {
     /**
      * width specifies the desired width in pixels. This value
-     * is the wHint passed into Control.computeSize(int, int, bool) 
+     * is the wHint passed into Control.computeSize(int, int, bool)
      * to determine the preferred size of the control.
      *
      * The default value is DWT.DEFAULT.
@@ -47,7 +52,7 @@
     public int width = DWT.DEFAULT;
     /**
      * height specifies the preferred height in pixels. This value
-     * is the hHint passed into Control.computeSize(int, int, bool) 
+     * is the hHint passed into Control.computeSize(int, int, bool)
      * to determine the preferred size of the control.
      *
      * The default value is DWT.DEFAULT.
@@ -55,20 +60,20 @@
      * @see dwt.widgets.Control#computeSize(int, int, bool)
      */
     public int height = DWT.DEFAULT;
-    
+
     /**
      * exclude informs the layout to ignore this control when sizing
      * and positioning controls.  If this value is <code>true</code>,
      * the size and position of the control will not be managed by the
-     * layout.  If this value is <code>false</code>, the size and 
+     * layout.  If this value is <code>false</code>, the size and
      * position of the control will be computed and assigned.
-     * 
+     *
      * The default value is <code>false</code>.
-     * 
+     *
      * @since 3.1
      */
     public bool exclude = false;
-    
+
 /**
  * Constructs a new instance of RowData using
  * default values.
@@ -80,7 +85,7 @@
  * Constructs a new instance of RowData according to the parameters.
  * A value of DWT.DEFAULT indicates that no minimum width or
  * no minimum height is specified.
- * 
+ *
  * @param width a minimum width for the control
  * @param height a minimum height for the control
  */
@@ -93,7 +98,7 @@
  * Constructs a new instance of RowData according to the parameter.
  * A value of DWT.DEFAULT indicates that no minimum width or
  * no minimum height is specified.
- * 
+ *
  * @param point a point whose x coordinate specifies a minimum width for the control
  * and y coordinate specifies a minimum height for the control
  */
@@ -102,10 +107,10 @@
 }
 
 String getName () {
-    String string = getClass ().getName ();
-    int index = string.lastIndexOf ('.');
-    if (index is -1) return string;
-    return string.substring (index + 1, string.length ());
+    String string = this.classinfo.name;
+    int index = string.lastIndexOf('.');
+    if (index is -1 ) return string;
+    return string[ index + 1 .. string.length ];
 }
 
 /**
@@ -114,13 +119,13 @@
  *
  * @return a string representation of the RowData object
  */
-public String toString () {
-    String string = getName ()+" {";
-    if (width !is DWT.DEFAULT) string += "width="+width+" ";
-    if (height !is DWT.DEFAULT) string += "height="+height+" ";
-    if (exclude) string += "exclude="+exclude+" ";
+override public String toString () {
+    String string = getName ()~" {";
+    if (width !is DWT.DEFAULT) string ~= "width="~to!(String)(width)~" ";
+    if (height !is DWT.DEFAULT) string ~= "height="~to!(String)(height)~" ";
+    if (exclude) string ~= "exclude="~to!(String)(exclude)~" ";
     string = string.trim();
-    string += "}";
+    string ~= "}";
     return string;
 }
 }
--- a/dwt/layout/RowLayout.d	Tue Oct 07 14:41:16 2008 +0200
+++ b/dwt/layout/RowLayout.d	Tue Oct 07 14:41:31 2008 +0200
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
  * 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
@@ -7,35 +7,40 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
 module dwt.layout.RowLayout;
 
-import dwt.dwthelper.utils;
-
 import dwt.DWT;
 import dwt.graphics.Point;
 import dwt.graphics.Rectangle;
-import dwt.widgets.Composite;
 import dwt.widgets.Control;
 import dwt.widgets.Layout;
+import dwt.widgets.Composite;
+import dwt.layout.RowData;
+import tango.util.Convert;
+import Math = tango.math.Math;
+import dwt.dwthelper.utils;
+
 
 /**
- * Instances of this class determine the size and position of the 
- * children of a <code>Composite</code> by placing them either in 
- * horizontal rows or vertical columns within the parent <code>Composite</code>. 
+ * Instances of this class determine the size and position of the
+ * children of a <code>Composite</code> by placing them either in
+ * horizontal rows or vertical columns within the parent <code>Composite</code>.
  * <p>
  * <code>RowLayout</code> aligns all controls in one row if the
  * <code>type</code> is set to horizontal, and one column if it is
- * set to vertical. It has the ability to wrap, and provides configurable 
- * margins and spacing. <code>RowLayout</code> has a number of configuration 
- * fields. In addition, the height and width of each control in a 
+ * set to vertical. It has the ability to wrap, and provides configurable
+ * margins and spacing. <code>RowLayout</code> has a number of configuration
+ * fields. In addition, the height and width of each control in a
  * <code>RowLayout</code> can be specified by setting a <code>RowData</code>
  * object into the control using <code>setLayoutData ()</code>.
  * </p>
  * <p>
- * The following example code creates a <code>RowLayout</code>, sets all 
- * of its fields to non-default values, and then sets it into a 
- * <code>Shell</code>. 
+ * The following example code creates a <code>RowLayout</code>, sets all
+ * of its fields to non-default values, and then sets it into a
+ * <code>Shell</code>.
  * <pre>
  *      RowLayout rowLayout = new RowLayout();
  *      rowLayout.wrap = false;
@@ -54,42 +59,45 @@
  *      shell.setLayout(new RowLayout());
  * </pre>
  * </p>
- * 
+ *
  * @see RowData
+ * @see <a href="http://www.eclipse.org/swt/snippets/#rowlayout">RowLayout snippets</a>
+ * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Example: LayoutExample</a>
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
  */
 public final class RowLayout : Layout {
-    
+
     /**
-     * type specifies whether the layout places controls in rows or 
+     * type specifies whether the layout places controls in rows or
      * columns.
-     * 
+     *
      * The default value is HORIZONTAL.
-     * 
+     *
      * Possible values are: <ul>
      *    <li>HORIZONTAL: Position the controls horizontally from left to right</li>
      *    <li>VERTICAL: Position the controls vertically from top to bottom</li>
      * </ul>
-     * 
+     *
      * @since 2.0
      */
     public int type = DWT.HORIZONTAL;
-    
+
     /**
      * marginWidth specifies the number of pixels of horizontal margin
      * that will be placed along the left and right edges of the layout.
      *
      * The default value is 0.
-     * 
+     *
      * @since 3.0
      */
     public int marginWidth = 0;
-    
+
     /**
      * marginHeight specifies the number of pixels of vertical margin
      * that will be placed along the top and bottom edges of the layout.
      *
      * The default value is 0.
-     * 
+     *
      * @since 3.0
      */
     public int marginHeight = 0;
@@ -101,7 +109,7 @@
      * The default value is 3.
      */
     public int spacing = 3;
-            
+
     /**
      * wrap specifies whether a control will be wrapped to the next
      * row if there is insufficient space on the current row.
@@ -112,22 +120,22 @@
 
     /**
      * pack specifies whether all controls in the layout take
-     * their preferred size.  If pack is false, all controls will 
-     * have the same size which is the size required to accommodate the 
-     * largest preferred height and the largest preferred width of all 
+     * their preferred size.  If pack is false, all controls will
+     * have the same size which is the size required to accommodate the
+     * largest preferred height and the largest preferred width of all
      * the controls in the layout.
      *
      * The default value is true.
      */
     public bool pack = true;
-    
+
     /**
      * fill specifies whether the controls in a row should be
      * all the same height for horizontal layouts, or the same
      * width for vertical layouts.
      *
      * The default value is false.
-     * 
+     *
      * @since 3.0
      */
     public bool fill = false;
@@ -193,56 +201,56 @@
  * Constructs a new instance of this class given the type.
  *
  * @param type the type of row layout
- * 
+ *
  * @since 2.0
  */
 public this (int type) {
     this.type = type;
 }
 
-protected Point computeSize (Composite composite, int wHint, int hHint, bool flushCache) {
+override protected Point computeSize (Composite composite, int wHint, int hHint, bool flushCache_) {
     Point extent;
     if (type is DWT.HORIZONTAL) {
-        extent = layoutHorizontal (composite, false, (wHint !is DWT.DEFAULT) && wrap, wHint, flushCache);
+        extent = layoutHorizontal (composite, false, (wHint !is DWT.DEFAULT) && wrap, wHint, flushCache_);
     } else {
-        extent = layoutVertical (composite, false, (hHint !is DWT.DEFAULT) && wrap, hHint, flushCache);
+        extent = layoutVertical (composite, false, (hHint !is DWT.DEFAULT) && wrap, hHint, flushCache_);
     }
     if (wHint !is DWT.DEFAULT) extent.x = wHint;
     if (hHint !is DWT.DEFAULT) extent.y = hHint;
     return extent;
 }
 
-Point computeSize (Control control, bool flushCache) {
+Point computeSize (Control control, bool flushCache_) {
     int wHint = DWT.DEFAULT, hHint = DWT.DEFAULT;
     RowData data = cast(RowData) control.getLayoutData ();
     if (data !is null) {
         wHint = data.width;
         hHint = data.height;
     }
-    return control.computeSize (wHint, hHint, flushCache);
+    return control.computeSize (wHint, hHint, flushCache_);
 }
 
-protected bool flushCache (Control control) {
+override protected bool flushCache (Control control) {
     return true;
 }
 
 String getName () {
-    String string = getClass ().getName ();
-    int index = string.lastIndexOf ('.');
-    if (index is -1) return string;
-    return string.substring (index + 1, string.length ());
+    String string = this.classinfo.name;
+    int index = string.lastIndexOf('.');
+    if (index is -1 ) return string;
+    return string[ index + 1 .. string.length ];
 }
 
-protected void layout (Composite composite, bool flushCache) {
+override protected void layout (Composite composite, bool flushCache_) {
     Rectangle clientArea = composite.getClientArea ();
     if (type is DWT.HORIZONTAL) {
-        layoutHorizontal (composite, true, wrap, clientArea.width, flushCache);
+        layoutHorizontal (composite, true, wrap, clientArea.width, flushCache_);
     } else {
-        layoutVertical (composite, true, wrap, clientArea.height, flushCache);
+        layoutVertical (composite, true, wrap, clientArea.height, flushCache_);
     }
 }
 
-Point layoutHorizontal (Composite composite, bool move, bool wrap, int width, bool flushCache) {
+Point layoutHorizontal (Composite composite, bool move, bool wrap, int width, bool flushCache_) {
     Control [] children = composite.getChildren ();
     int count = 0;
     for (int i=0; i<children.length; i++) {
@@ -250,7 +258,7 @@
         RowData data = cast(RowData) control.getLayoutData ();
         if (data is null || !data.exclude) {
             children [count++] = children [i];
-        } 
+        }
     }
     if (count is 0) {
         return new Point (marginLeft + marginWidth * 2 + marginRight, marginTop + marginHeight * 2 + marginBottom);
@@ -259,7 +267,7 @@
     if (!pack) {
         for (int i=0; i<count; i++) {
             Control child = children [i];
-            Point size = computeSize (child, flushCache);
+            Point size = computeSize (child, flushCache_);
             childWidth = Math.max (childWidth, size.x);
             childHeight = Math.max (childHeight, size.y);
         }
@@ -282,7 +290,7 @@
     for (int i=0; i<count; i++) {
         Control child = children [i];
         if (pack) {
-            Point size = computeSize (child, flushCache);
+            Point size = computeSize (child, flushCache_);
             childWidth = size.x;
             childHeight = size.y;
         }
@@ -361,7 +369,7 @@
     return new Point (maxX, y + maxHeight + marginBottom + marginHeight);
 }
 
-Point layoutVertical (Composite composite, bool move, bool wrap, int height, bool flushCache) {
+Point layoutVertical (Composite composite, bool move, bool wrap, int height, bool flushCache_) {
     Control [] children = composite.getChildren ();
     int count = 0;
     for (int i=0; i<children.length; i++) {
@@ -369,7 +377,7 @@
         RowData data = cast(RowData) control.getLayoutData ();
         if (data is null || !data.exclude) {
             children [count++] = children [i];
-        } 
+        }
     }
     if (count is 0) {
         return new Point (marginLeft + marginWidth * 2 + marginRight, marginTop + marginHeight * 2 + marginBottom);
@@ -378,7 +386,7 @@
     if (!pack) {
         for (int i=0; i<count; i++) {
             Control child = children [i];
-            Point size = computeSize (child, flushCache);
+            Point size = computeSize (child, flushCache_);
             childWidth = Math.max (childWidth, size.x);
             childHeight = Math.max (childHeight, size.y);
         }
@@ -401,7 +409,7 @@
     for (int i=0; i<count; i++) {
         Control child = children [i];
         if (pack) {
-            Point size = computeSize (child, flushCache);
+            Point size = computeSize (child, flushCache_);
             childWidth = size.x;
             childHeight = size.y;
         }
@@ -487,22 +495,22 @@
  *
  * @return a string representation of the layout
  */
-public String toString () {
-    String string = getName ()+" {";
-    string += "type="+((type !is DWT.HORIZONTAL) ? "DWT.VERTICAL" : "DWT.HORIZONTAL")+" ";
-    if (marginWidth !is 0) string += "marginWidth="+marginWidth+" ";
-    if (marginHeight !is 0) string += "marginHeight="+marginHeight+" ";
-    if (marginLeft !is 0) string += "marginLeft="+marginLeft+" ";
-    if (marginTop !is 0) string += "marginTop="+marginTop+" ";
-    if (marginRight !is 0) string += "marginRight="+marginRight+" ";
-    if (marginBottom !is 0) string += "marginBottom="+marginBottom+" ";
-    if (spacing !is 0) string += "spacing="+spacing+" ";
-    string += "wrap="+wrap+" ";
-    string += "pack="+pack+" ";
-    string += "fill="+fill+" ";
-    string += "justify="+justify+" ";
+override public String toString () {
+    String string = getName ()~" {";
+    string ~= "type="~((type !is DWT.HORIZONTAL) ? "DWT.VERTICAL" : "DWT.HORIZONTAL")~" ";
+    if (marginWidth !is 0) string ~= "marginWidth="~to!(String)(marginWidth)~" ";
+    if (marginHeight !is 0) string ~= "marginHeight="~to!(String)(marginHeight)~" ";
+    if (marginLeft !is 0) string ~= "marginLeft="~to!(String)(marginLeft)~" ";
+    if (marginTop !is 0) string ~= "marginTop="~to!(String)(marginTop)~" ";
+    if (marginRight !is 0) string ~= "marginRight="~to!(String)(marginRight)~" ";
+    if (marginBottom !is 0) string ~= "marginBottom="~to!(String)(marginBottom)~" ";
+    if (spacing !is 0) string ~= "spacing="~to!(String)(spacing)~" ";
+    string ~= "wrap="~to!(String)(wrap)~" ";
+    string ~= "pack="~to!(String)(pack)~" ";
+    string ~= "fill="~to!(String)(fill)~" ";
+    string ~= "justify="~to!(String)(justify)~" ";
     string = string.trim();
-    string += "}";
+    string ~= "}";
     return string;
 }
 }