changeset 103:0179b2e17eb2

Package custom compiles
author Frank Benoit <benoit@tionex.de>
date Fri, 18 Jan 2008 17:00:39 +0100
parents 12e3e0e477cd
children 62a654ba5276
files dwt/custom/CTabFolder.d dwt/custom/CTabFolderEvent.d dwt/custom/CTabFolderLayout.d dwt/custom/CTabItem.d dwt/custom/DefaultContent.d dwt/custom/ExtendedModifyEvent.d dwt/custom/LineBackgroundEvent.d dwt/custom/LineStyleEvent.d dwt/custom/MovementEvent.d dwt/custom/PaintObjectEvent.d dwt/custom/PopupList.d dwt/custom/SashForm.d dwt/custom/SashFormData.d dwt/custom/SashFormLayout.d dwt/custom/ScrolledComposite.d dwt/custom/ScrolledCompositeLayout.d dwt/custom/StackLayout.d dwt/custom/StyledText.d dwt/custom/StyledTextDropTargetEffect.d dwt/custom/StyledTextListener.d dwt/custom/StyledTextRenderer.d dwt/custom/TableCursor.d dwt/custom/TableTree.d dwt/custom/TableTreeEditor.d dwt/custom/TableTreeItem.d dwt/custom/TreeEditor.d dwt/custom/ViewForm.d dwt/custom/ViewFormLayout.d dwt/dwthelper/utils.d dwt/internal/BidiUtil.d dwt/widgets/Table.d
diffstat 31 files changed, 577 insertions(+), 427 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/custom/CTabFolder.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/CTabFolder.d	Fri Jan 18 17:00:39 2008 +0100
@@ -43,6 +43,13 @@
 import dwt.custom.CTabItem;
 import dwt.custom.CTabFolder2Listener;
 import dwt.custom.CTabFolderListener;
+import dwt.custom.CTabFolderLayout;
+import dwt.custom.CTabFolderEvent;
+
+import dwt.dwthelper.utils;
+import dwt.dwthelper.Integer;
+import tango.util.Convert;
+static import tango.text.convert.Utf;
 
 /**
  *
@@ -109,7 +116,7 @@
      *
      * @deprecated drop shadow border is no longer drawn in 3.0
      */
-    public static RGB borderInsideRGB  = new RGB (132, 130, 132);
+    public static RGB borderInsideRGB;
     /**
      * Color of middle line of drop shadow border.
      *
@@ -118,7 +125,7 @@
      *
      * @deprecated drop shadow border is no longer drawn in 3.0
      */
-    public static RGB borderMiddleRGB  = new RGB (143, 141, 138);
+    public static RGB borderMiddleRGB;
     /**
      * Color of outermost line of drop shadow border.
      *
@@ -127,7 +134,7 @@
      *
      * @deprecated drop shadow border is no longer drawn in 3.0
      */
-    public static RGB borderOutsideRGB = new RGB (171, 168, 165);
+    public static RGB borderOutsideRGB;
 
     /* sizing, positioning */
     int xClient, yClient;
@@ -139,17 +146,17 @@
     int minChars = 20;
 
     /* item management */
-    CTabItem items[] = new CTabItem[0];
+    CTabItem items[];
     int firstIndex = -1; // index of the left most visible tab.
     int selectedIndex = -1;
-    int[] priority = new int[0];
+    int[] priority;
     bool mru = false;
     Listener listener;
 
     /* External Listener management */
-    CTabFolder2Listener[] folderListeners = new CTabFolder2Listener[0];
+    CTabFolder2Listener[] folderListeners;
     // support for deprecated listener mechanism
-    CTabFolderListener[] tabListeners = new CTabFolderListener[0];
+    CTabFolderListener[] tabListeners;
 
     /* Selected item appearance */
     Image selectionBgImage;
@@ -182,23 +189,23 @@
     bool showClose = false;
     bool showUnselectedClose = true;
 
-    Rectangle chevronRect = new Rectangle(0, 0, 0, 0);
+    Rectangle chevronRect;
     int chevronImageState = NORMAL;
     bool showChevron = false;
     Menu showMenu;
 
     bool showMin = false;
-    Rectangle minRect = new Rectangle(0, 0, 0, 0);
+    Rectangle minRect;
     bool minimized = false;
     int minImageState = NORMAL;
 
     bool showMax = false;
-    Rectangle maxRect = new Rectangle(0, 0, 0, 0);
+    Rectangle maxRect;
     bool maximized = false;
     int maxImageState = NORMAL;
 
     Control topRight;
-    Rectangle topRightRect = new Rectangle(0, 0, 0, 0);
+    Rectangle topRightRect;
     int topRightAlignment = DWT.RIGHT;
 
     // borders and shapes
@@ -226,55 +233,61 @@
     Font oldFont;
 
     // internal constants
-    static final int DEFAULT_WIDTH = 64;
-    static final int DEFAULT_HEIGHT = 64;
-    static final int BUTTON_SIZE = 18;
+    static const int DEFAULT_WIDTH = 64;
+    static const int DEFAULT_HEIGHT = 64;
+    static const int BUTTON_SIZE = 18;
 
-    static final int[] TOP_LEFT_CORNER = [0,6, 1,5, 1,4, 4,1, 5,1, 6,0];
+    static const int[] TOP_LEFT_CORNER = [0,6, 1,5, 1,4, 4,1, 5,1, 6,0];
 
     //TOP_LEFT_CORNER_HILITE is laid out in reverse (ie. top to bottom)
     //so can fade in same direction as right swoop curve
-    static final int[] TOP_LEFT_CORNER_HILITE = [5,2, 4,2, 3,3, 2,4, 2,5, 1,6];
+    static const int[] TOP_LEFT_CORNER_HILITE = [5,2, 4,2, 3,3, 2,4, 2,5, 1,6];
 
-    static final int[] TOP_RIGHT_CORNER = [-6,0, -5,1, -4,1, -1,4, -1,5, 0,6];
-    static final int[] BOTTOM_LEFT_CORNER = [0,-6, 1,-5, 1,-4, 4,-1, 5,-1, 6,0];
-    static final int[] BOTTOM_RIGHT_CORNER = [-6,0, -5,-1, -4,-1, -1,-4, -1,-5, 0,-6];
+    static const int[] TOP_RIGHT_CORNER = [-6,0, -5,1, -4,1, -1,4, -1,5, 0,6];
+    static const int[] BOTTOM_LEFT_CORNER = [0,-6, 1,-5, 1,-4, 4,-1, 5,-1, 6,0];
+    static const int[] BOTTOM_RIGHT_CORNER = [-6,0, -5,-1, -4,-1, -1,-4, -1,-5, 0,-6];
 
-    static final int[] SIMPLE_TOP_LEFT_CORNER = [0,2, 1,1, 2,0];
-    static final int[] SIMPLE_TOP_RIGHT_CORNER = [-2,0, -1,1, 0,2];
-    static final int[] SIMPLE_BOTTOM_LEFT_CORNER = [0,-2, 1,-1, 2,0];
-    static final int[] SIMPLE_BOTTOM_RIGHT_CORNER = [-2,0, -1,-1, 0,-2];
-    static final int[] SIMPLE_UNSELECTED_INNER_CORNER = [0,0];
+    static const int[] SIMPLE_TOP_LEFT_CORNER = [0,2, 1,1, 2,0];
+    static const int[] SIMPLE_TOP_RIGHT_CORNER = [-2,0, -1,1, 0,2];
+    static const int[] SIMPLE_BOTTOM_LEFT_CORNER = [0,-2, 1,-1, 2,0];
+    static const int[] SIMPLE_BOTTOM_RIGHT_CORNER = [-2,0, -1,-1, 0,-2];
+    static const int[] SIMPLE_UNSELECTED_INNER_CORNER = [0,0];
 
-    static final int[] TOP_LEFT_CORNER_BORDERLESS = [0,6, 1,5, 1,4, 4,1, 5,1, 6,0];
-    static final int[] TOP_RIGHT_CORNER_BORDERLESS = [-7,0, -6,1, -5,1, -2,4, -2,5, -1,6];
-    static final int[] BOTTOM_LEFT_CORNER_BORDERLESS = [0,-6, 1,-6, 1,-5, 2,-4, 4,-2, 5,-1, 6,-1, 6,0];
-    static final int[] BOTTOM_RIGHT_CORNER_BORDERLESS = [-7,0, -7,-1, -6,-1, -5,-2, -3,-4, -2,-5, -2,-6, -1,-6];
+    static const int[] TOP_LEFT_CORNER_BORDERLESS = [0,6, 1,5, 1,4, 4,1, 5,1, 6,0];
+    static const int[] TOP_RIGHT_CORNER_BORDERLESS = [-7,0, -6,1, -5,1, -2,4, -2,5, -1,6];
+    static const int[] BOTTOM_LEFT_CORNER_BORDERLESS = [0,-6, 1,-6, 1,-5, 2,-4, 4,-2, 5,-1, 6,-1, 6,0];
+    static const int[] BOTTOM_RIGHT_CORNER_BORDERLESS = [-7,0, -7,-1, -6,-1, -5,-2, -3,-4, -2,-5, -2,-6, -1,-6];
+
+    static const int[] SIMPLE_TOP_LEFT_CORNER_BORDERLESS = [0,2, 1,1, 2,0];
+    static const int[] SIMPLE_TOP_RIGHT_CORNER_BORDERLESS= [-3,0, -2,1, -1,2];
+    static const int[] SIMPLE_BOTTOM_LEFT_CORNER_BORDERLESS = [0,-3, 1,-2, 2,-1, 3,0];
+    static const int[] SIMPLE_BOTTOM_RIGHT_CORNER_BORDERLESS = [-4,0, -3,-1, -2,-2, -1,-3];
 
-    static final int[] SIMPLE_TOP_LEFT_CORNER_BORDERLESS = [0,2, 1,1, 2,0];
-    static final int[] SIMPLE_TOP_RIGHT_CORNER_BORDERLESS= [-3,0, -2,1, -1,2];
-    static final int[] SIMPLE_BOTTOM_LEFT_CORNER_BORDERLESS = [0,-3, 1,-2, 2,-1, 3,0];
-    static final int[] SIMPLE_BOTTOM_RIGHT_CORNER_BORDERLESS = [-4,0, -3,-1, -2,-2, -1,-3];
+    static const int SELECTION_FOREGROUND = DWT.COLOR_LIST_FOREGROUND;
+    static const int SELECTION_BACKGROUND = DWT.COLOR_LIST_BACKGROUND;
+    static const int BORDER1_COLOR = DWT.COLOR_WIDGET_NORMAL_SHADOW;
+    static const int FOREGROUND = DWT.COLOR_WIDGET_FOREGROUND;
+    static const int BACKGROUND = DWT.COLOR_WIDGET_BACKGROUND;
+    static const int BUTTON_BORDER = DWT.COLOR_WIDGET_DARK_SHADOW;
+    static const int BUTTON_FILL = DWT.COLOR_LIST_BACKGROUND;
 
-    static final int SELECTION_FOREGROUND = DWT.COLOR_LIST_FOREGROUND;
-    static final int SELECTION_BACKGROUND = DWT.COLOR_LIST_BACKGROUND;
-    static final int BORDER1_COLOR = DWT.COLOR_WIDGET_NORMAL_SHADOW;
-    static final int FOREGROUND = DWT.COLOR_WIDGET_FOREGROUND;
-    static final int BACKGROUND = DWT.COLOR_WIDGET_BACKGROUND;
-    static final int BUTTON_BORDER = DWT.COLOR_WIDGET_DARK_SHADOW;
-    static final int BUTTON_FILL = DWT.COLOR_LIST_BACKGROUND;
+    static const int NONE = 0;
+    static const int NORMAL = 1;
+    static const int HOT = 2;
+    static const int SELECTED = 3;
+    static const RGB CLOSE_FILL;
 
-    static final int NONE = 0;
-    static final int NORMAL = 1;
-    static final int HOT = 2;
-    static final int SELECTED = 3;
-    static final RGB CLOSE_FILL = new RGB(252, 160, 160);
+    static const int CHEVRON_CHILD_ID = 0;
+    static const int MINIMIZE_CHILD_ID = 1;
+    static const int MAXIMIZE_CHILD_ID = 2;
+    static const int EXTRA_CHILD_ID_COUNT = 3;
 
-    static final int CHEVRON_CHILD_ID = 0;
-    static final int MINIMIZE_CHILD_ID = 1;
-    static final int MAXIMIZE_CHILD_ID = 2;
-    static final int EXTRA_CHILD_ID_COUNT = 3;
-
+static this(){
+    borderInsideRGB  = new RGB (132, 130, 132);
+    borderMiddleRGB  = new RGB (143, 141, 138);
+    borderOutsideRGB = new RGB (171, 168, 165);
+    CLOSE_FILL = new RGB(252, 160, 160);
+}
 
 /**
  * Constructs a new instance of this class given its parent
@@ -308,6 +321,10 @@
  * @see #getStyle()
  */
 public this(Composite parent, int style) {
+    chevronRect = new Rectangle(0, 0, 0, 0);
+    minRect = new Rectangle(0, 0, 0, 0);
+    maxRect = new Rectangle(0, 0, 0, 0);
+    topRightRect = new Rectangle(0, 0, 0, 0);
     super(parent, checkStyle (parent, style));
     super.setLayout(new CTabFolderLayout());
     int style2 = super.getStyle();
@@ -394,7 +411,7 @@
      * that use double buffering which is true in both of these cases.
      */
     char[] platform = DWT.getPlatform();
-    if ("carbon".equals(platform) || "gtk".equals(platform)) return style; //$NON-NLS-1$ //$NON-NLS-2$
+    if ("carbon"==platform || "gtk"==platform) return style; //$NON-NLS-1$ //$NON-NLS-2$
 
     //TEMPORARY CODE
     /*
@@ -446,7 +463,7 @@
     if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
     // add to array
     CTabFolder2Listener[] newListeners = new CTabFolder2Listener[folderListeners.length + 1];
-    System.arraycopy(folderListeners, 0, newListeners, 0, folderListeners.length);
+    SimpleType!(CTabFolder2Listener).arraycopy(folderListeners, 0, newListeners, 0, folderListeners.length);
     folderListeners = newListeners;
     folderListeners[folderListeners.length - 1] = listener;
 }
@@ -474,7 +491,7 @@
     if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
     // add to array
     CTabFolderListener[] newTabListeners = new CTabFolderListener[tabListeners.length + 1];
-    System.arraycopy(tabListeners, 0, newTabListeners, 0, tabListeners.length);
+    SimpleType!(CTabFolderListener).arraycopy(tabListeners, 0, newTabListeners, 0, tabListeners.length);
     tabListeners = newTabListeners;
     tabListeners[tabListeners.length - 1] = listener;
     // display close button to be backwards compatible
@@ -520,7 +537,7 @@
 void antialias (int[] shape, RGB lineRGB, RGB innerRGB, RGB outerRGB, GC gc){
     // Don't perform anti-aliasing on Mac and WPF because the platform
     // already does it.  The simple style also does not require anti-aliasing.
-    if (simple || "carbon".equals(DWT.getPlatform()) || "wpf".equals(DWT.getPlatform())) return; //$NON-NLS-1$
+    if (simple || "carbon"==DWT.getPlatform() || "wpf"==DWT.getPlatform()) return; //$NON-NLS-1$
     // Don't perform anti-aliasing on low resolution displays
     if (getDisplay().getDepth() < 15) return;
     if (outerRGB !is null) {
@@ -759,7 +776,7 @@
         }
     } else {
         // draw a solid background using default background in shape
-        if ((getStyle() & DWT.NO_BACKGROUND) !is 0 || !defaultBackground.equals(getBackground())) {
+        if ((getStyle() & DWT.NO_BACKGROUND) !is 0 || defaultBackground!=getBackground()) {
             gc.setBackground(defaultBackground);
             gc.fillRectangle(x, y, width, height);
         }
@@ -1275,29 +1292,29 @@
  * an '&' character in the given string. If there are no '&'
  * characters in the given string, return '\0'.
  */
-char _findMnemonic (char[] string) {
+dchar _findMnemonic (char[] string) {
     if (string is null) return '\0';
     int index = 0;
-    int length = string.length ();
+    int length_ = string.length;
     do {
-        while (index < length && string.charAt (index) !is '&') index++;
-        if (++index >= length) return '\0';
-        if (string.charAt (index) !is '&') return Character.toLowerCase (string.charAt (index));
+        while (index < length_ && string[index] !is '&') index++;
+        if (++index >= length_) return '\0';
+        if (string[index] !is '&') return CharacterToLower(getFirstCodepoint( string[index..$]));
         index++;
-    } while (index < length);
+    } while (index < length_);
     return '\0';
 }
 char[] stripMnemonic (char[] string) {
     int index = 0;
-    int length = string.length ();
+    int length_ = string.length;
     do {
-        while ((index < length) && (string.charAt (index) !is '&')) index++;
-        if (++index >= length) return string;
-        if (string.charAt (index) !is '&') {
-            return string.substring(0, index-1) + string.substring(index, length);
+        while ((index < length_) && (string[index] !is '&')) index++;
+        if (++index >= length_) return string;
+        if (string[index] !is '&') {
+            return string[0 .. index-1] ~ string[index .. length_];
         }
         index++;
-    } while (index < length);
+    } while (index < length_);
     return string;
 }
 /**
@@ -1651,9 +1668,9 @@
             if (childID >= 0 && childID < items.length) {
                 char[] text = items[childID].getText();
                 if (text !is null) {
-                    char mnemonic = _findMnemonic(text);
+                    dchar mnemonic = _findMnemonic(text);
                     if (mnemonic !is '\0') {
-                        shortcut = "Alt+"+mnemonic; //$NON-NLS-1$
+                        shortcut = "Alt+"~tango.text.convert.Utf.toString([mnemonic]); //$NON-NLS-1$
                     }
                 }
             }
@@ -1923,12 +1940,12 @@
     }
 }
 bool onMnemonic (Event event) {
-    char key = event.character;
+    auto key = event.character;
     for (int i = 0; i < items.length; i++) {
         if (items[i] !is null) {
-            char mnemonic = _findMnemonic (items[i].getText ());
+            auto mnemonic = _findMnemonic (items[i].getText ());
             if (mnemonic !is '\0') {
-                if (Character.toLowerCase (key) is mnemonic) {
+                if ( CharacterToLower(key) is mnemonic) {
                     setSelection(i, true);
                     return true;
                 }
@@ -2267,7 +2284,7 @@
 void onPaint(Event event) {
     if (inDispose) return;
     Font font = getFont();
-    if (oldFont is null || !oldFont.equals(font)) {
+    if (oldFont is null || oldFont!=font) {
         // handle case where  default font changes
         oldFont = font;
         if (!updateTabHeight(false)) {
@@ -2388,8 +2405,8 @@
         return;
     }
     CTabFolder2Listener[] newTabListeners = new CTabFolder2Listener[folderListeners.length - 1];
-    System.arraycopy(folderListeners, 0, newTabListeners, 0, index);
-    System.arraycopy(folderListeners, index + 1, newTabListeners, index, folderListeners.length - index - 1);
+    SimpleType!(CTabFolder2Listener).arraycopy(folderListeners, 0, newTabListeners, 0, index);
+    SimpleType!(CTabFolder2Listener).arraycopy(folderListeners, index + 1, newTabListeners, index, folderListeners.length - index - 1);
     folderListeners = newTabListeners;
 }
 /**
@@ -2425,8 +2442,8 @@
         return;
     }
     CTabFolderListener[] newTabListeners = new CTabFolderListener[tabListeners.length - 1];
-    System.arraycopy(tabListeners, 0, newTabListeners, 0, index);
-    System.arraycopy(tabListeners, index + 1, newTabListeners, index, tabListeners.length - index - 1);
+    SimpleType!(CTabFolderListener).arraycopy(tabListeners, 0, newTabListeners, 0, index);
+    SimpleType!(CTabFolderListener).arraycopy(tabListeners, index + 1, newTabListeners, index, tabListeners.length - index - 1);
     tabListeners = newTabListeners;
 }
 /**
@@ -2547,7 +2564,7 @@
                 if (gradientColors[i] is null) {
                     same = colors[i] is null;
                 } else {
-                    same = gradientColors[i].equals(colors[i]);
+                    same = cast(bool)(gradientColors[i]==colors[i]);
                 }
                 if (!same) break;
             }
@@ -2627,7 +2644,7 @@
     Rectangle rectBefore = getClientArea();
     updateItems();
     Rectangle rectAfter = getClientArea();
-    if (!rectBefore.equals(rectAfter)) {
+    if (rectBefore!=rectAfter) {
         notifyListeners(DWT.Resize, new Event());
     }
     redraw();
@@ -2782,7 +2799,7 @@
 }
 public void setFont(Font font) {
     checkWidget();
-    if (font !is null && font.equals(getFont())) return;
+    if (font !is null && font==getFont()) return;
     super.setFont(font);
     oldFont = getFont();
     if (!updateTabHeight(false)) {
@@ -3386,7 +3403,7 @@
                 if (selectionGradientColors[i] is null) {
                     same = colors[i] is null;
                 } else {
-                    same = selectionGradientColors[i].equals(colors[i]);
+                    same = cast(bool)(selectionGradientColors[i]==colors[i]);
                 }
                 if (!same) break;
             }
@@ -3470,7 +3487,7 @@
     Color highlightBegin = selectionHighlightGradientColorsCache[0];
     Color highlightEnd = selectionHighlightGradientColorsCache[selectionHighlightGradientColorsCache.length - 1];
 
-    if(! highlightBegin.equals(start))
+    if( highlightBegin!=start)
         return false;
 
     //Compare number of colours we have vs. we'd compute
@@ -3478,7 +3495,7 @@
         return false;
 
     //Compare existing highlight end to what it would be (selectionBackground)
-    if(! highlightEnd.equals(selectionBackground))
+    if( highlightEnd!=selectionBackground)
         return false;
 
     return true;
@@ -3597,7 +3614,7 @@
         Rectangle rectBefore = getClientArea();
         updateItems();
         Rectangle rectAfter = getClientArea();
-        if (!rectBefore.equals(rectAfter)) {
+        if (rectBefore!=rectAfter) {
             notifyListeners(DWT.Resize, new Event());
         }
         redraw();
@@ -3629,7 +3646,7 @@
         Rectangle rectBefore = getClientArea();
         updateItems();
         Rectangle rectAfter = getClientArea();
-        if (!rectBefore.equals(rectAfter)) {
+        if (rectBefore!=rectAfter) {
             notifyListeners(DWT.Resize, new Event());
         }
         redraw();
@@ -3683,7 +3700,7 @@
         Rectangle rectBefore = getClientArea();
         updateItems();
         Rectangle rectAfter = getClientArea();
-        if (!rectBefore.equals(rectAfter)) {
+        if (rectBefore!=rectAfter) {
             notifyListeners(DWT.Resize, new Event());
         }
         redraw();
@@ -3886,7 +3903,7 @@
 void _setToolTipText (int x, int y) {
     char[] oldTip = getToolTipText();
     char[] newTip = _getToolTip(x, y);
-    if (newTip is null || !newTip.equals(oldTip)) {
+    if (newTip is null || newTip!=oldTip) {
         setToolTipText(newTip);
     }
 }
--- a/dwt/custom/CTabFolderEvent.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/CTabFolderEvent.d	Fri Jan 18 17:00:39 2008 +0100
@@ -15,6 +15,8 @@
 import dwt.events.TypedEvent;
 import dwt.widgets.Widget;
 
+import tango.util.Convert;
+
 /**
  *
  */
@@ -79,13 +81,13 @@
  */
 public char[] toString() {
     char[] string = super.toString ();
-    return string.substring (0, string.length() - 1) // remove trailing '}'
-        + " item=" + item
-        + " doit=" + doit
-        + " x=" + x
-        + " y=" + y
-        + " width=" + width
-        + " height=" + height
-        + "}";
+    return string[0.. $ - 1] // remove trailing '}'
+        ~ " item=" ~ to!(char[])(item)
+        ~ " doit=" ~ to!(char[])(doit)
+        ~ " x=" ~ to!(char[])(x)
+        ~ " y=" ~ to!(char[])(y)
+        ~ " width=" ~ to!(char[])(width)
+        ~ " height=" ~ to!(char[])(height)
+        ~ "}";
 }
 }
--- a/dwt/custom/CTabFolderLayout.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/CTabFolderLayout.d	Fri Jan 18 17:00:39 2008 +0100
@@ -17,6 +17,8 @@
 import dwt.widgets.Composite;
 import dwt.widgets.Control;
 import dwt.widgets.Layout;
+import dwt.custom.CTabFolder;
+import dwt.custom.CTabItem;
 
 /**
  * This class provides the layout for CTabFolder
--- a/dwt/custom/CTabItem.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/CTabItem.d	Fri Jan 18 17:00:39 2008 +0100
@@ -54,7 +54,7 @@
     Font font;
     Image disabledImage;
 
-    Rectangle closeRect = new Rectangle(0, 0, 0, 0);
+    Rectangle closeRect;
     int closeImageState = CTabFolder.NONE;
     bool showClose = false;
     bool showing = false;
@@ -130,6 +130,7 @@
  * @see Widget#getStyle()
  */
 public this (CTabFolder parent, int style, int index) {
+    closeRect = new Rectangle(0, 0, 0, 0);
     super (parent, checkStyle(style));
     showClose = (style & DWT.CLOSE) !is 0;
     parent.createItem (this, index);
@@ -154,17 +155,17 @@
 char[] shortenText(GC gc, char[] text, int width, char[] ellipses) {
     if (gc.textExtent(text, FLAGS).x <= width) return text;
     int ellipseWidth = gc.textExtent(ellipses, FLAGS).x;
-    int length = text.length();
+    int length = text.length;
     int end = length - 1;
     while (end > 0) {
-        text = text.substring(0, end);
+        text = text[ 0 .. end ];
         int l = gc.textExtent(text, FLAGS).x;
         if (l + ellipseWidth <= width) {
-            return text + ellipses;
+            return text ~ ellipses;
         }
         end--;
     }
-    return text.substring(0,1);
+    return text[ 0 .. 1 ];
 }
 
 public void dispose() {
@@ -776,7 +777,7 @@
     checkWidget();
     if (toolTipText is null && shortenedText !is null) {
         char[] text = getText();
-        if (!shortenedText.equals(text)) return text;
+        if (shortenedText!=text) return text;
     }
     return toolTipText;
 }
@@ -831,14 +832,14 @@
     if (minimum) {
         int minChars = parent.minChars;
         text = minChars is 0 ? null : getText();
-        if (text !is null && text.length() > minChars) {
+        if (text !is null && text.length > minChars) {
             if (useEllipses()) {
-                int end = minChars < ELLIPSIS.length() + 1 ? minChars : minChars - ELLIPSIS.length();
-                text = text.substring(0, end);
-                if (minChars > ELLIPSIS.length() + 1) text += ELLIPSIS;
+                int end = minChars < ELLIPSIS.length + 1 ? minChars : minChars - ELLIPSIS.length;
+                text = text[ 0 .. end ];
+                if (minChars > ELLIPSIS.length + 1) text ~= ELLIPSIS;
             } else {
                 int end = minChars;
-                text = text.substring(0, end);
+                text = text[ 0 .. end ];
             }
         }
     } else {
@@ -941,7 +942,7 @@
         DWT.error(DWT.ERROR_INVALID_ARGUMENT);
     }
     if (font is null && this.font is null) return;
-    if (font !is null && font.equals(this.font)) return;
+    if (font !is null && font==this.font) return;
     this.font = font;
     if (!parent.updateTabHeight(false)) {
         parent.updateItems();
@@ -955,7 +956,7 @@
     }
     Image oldImage = getImage();
     if (image is null && oldImage is null) return;
-    if (image !is null && image.equals(oldImage)) return;
+    if (image !is null && image==oldImage) return;
     super.setImage(image);
     if (!parent.updateTabHeight(false)) {
         // If image is the same size as before,
@@ -995,7 +996,7 @@
 public void setText (char[] string) {
     checkWidget();
     if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
-    if (string.equals(getText())) return;
+    if (string==getText()) return;
     super.setText(string);
     shortenedText = null;
     shortenedTextWidth = 0;
--- a/dwt/custom/DefaultContent.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/DefaultContent.d	Fri Jan 18 17:00:39 2008 +0100
@@ -17,19 +17,26 @@
 import dwt.custom.StyledTextContent;
 import dwt.custom.TextChangeListener;
 import dwt.custom.StyledTextEvent;
+import dwt.custom.StyledTextListener;
+import dwt.custom.StyledText;
+
+static import tango.io.FileConst;
+static import tango.text.Text;
+
+alias tango.text.Text.Text!(char) StringBuffer;
 
 class DefaultContent : StyledTextContent {
-    private final static char[] LineDelimiter = System.getProperty("line.separator");
+    private final static char[] LineDelimiter = tango.io.FileConst.FileConst.NewlineString;
 
-    TextChangeListener[] textListeners; // stores text listeners for event sending
-    char[] textStore = new char[0]; // stores the actual text
+    StyledTextListener[] textListeners; // stores text listeners for event sending
+    char[] textStore; // stores the actual text
     int gapStart = -1;  // the character position start of the gap
     int gapEnd = -1;    // the character position after the end of the gap
     int gapLine = -1;   // the line on which the gap exists, the gap will always be associated with one line
     int highWatermark = 300;
     int lowWatermark = 50;
 
-    int[][] lines = new int[50][2]; // array of character positions and lengths representing the lines of text
+    int[][] lines; // array of character positions and lengths representing the lines of text
     int lineCount_ = 0;  // the number of lines of text
     int expandExp = 1;  // the expansion exponent, used to increase the lines array exponentially
     int replaceExpandExp = 1;   // the expansion exponent, used to increase the lines array exponentially
@@ -39,7 +46,7 @@
  * at least one empty line.
  */
 this() {
-    super();
+    lines = new int[][]( 50, 2 );
     setText("");
 }
 /**
@@ -54,7 +61,7 @@
     int size = lines.length;
     if (lineCount_ is size) {
         // expand the lines by powers of 2
-        int[][] newLines = new int[size+Compatibility.pow2(expandExp)][2];
+        int[][] newLines = new int[][]( size+Compatibility.pow2(expandExp), 2 );
         System.arraycopy(lines, 0, newLines, 0, size);
         lines = newLines;
         expandExp++;
@@ -78,7 +85,7 @@
     int size = linesArray.length;
     int[][] newLines = linesArray;
     if (count is size) {
-        newLines = new int[size+Compatibility.pow2(replaceExpandExp)][2];
+        newLines = new int[][]( size+Compatibility.pow2(replaceExpandExp), 2 );
         replaceExpandExp++;
         System.arraycopy(linesArray, 0, newLines, 0, size);
     }
@@ -102,7 +109,7 @@
 public void addTextChangeListener(TextChangeListener listener) {
     if (listener is null) error(DWT.ERROR_NULL_ARGUMENT);
     StyledTextListener typedListener = new StyledTextListener(listener);
-    textListeners.addElement(typedListener);
+    textListeners ~= typedListener;
 }
 /**
  * Adjusts the gap to accommodate a text change that is occurring.
@@ -182,26 +189,26 @@
         // inserting text, see if the \r\n line delimiter is being split
         if (start is 0) return true;
         if (start is getCharCount()) return true;
-        char before = getTextRange(start - 1, 1).charAt(0);
+        char before = getTextRange(start - 1, 1)[0];
         if (before is '\r') {
-            char after = getTextRange(start, 1).charAt(0);
+            char after = getTextRange(start, 1)[0];
             if (after is '\n') return false;
         }
     } else {
         // deleting text, see if part of a \r\n line delimiter is being deleted
-        char startChar = getTextRange(start, 1).charAt(0);
+        char startChar = getTextRange(start, 1)[0];
         if (startChar is '\n') {
             // see if char before delete position is \r
             if (start !is 0) {
-                char before = getTextRange(start - 1, 1).charAt(0);
+                char before = getTextRange(start - 1, 1)[0];
                 if (before is '\r') return false;
             }
         }
-        char endChar = getTextRange(start + replaceLength - 1, 1).charAt(0);
+        char endChar = getTextRange(start + replaceLength - 1, 1)[0];
         if (endChar is '\r') {
             // see if char after delete position is \n
             if (start + replaceLength !is getCharCount()) {
-                char after = getTextRange(start + replaceLength, 1).charAt(0);
+                char after = getTextRange(start + replaceLength, 1)[0];
                 if (after is '\n') return false;
             }
         }
@@ -220,7 +227,7 @@
  *  a length
  */
 int[][] indexLines(int offset, int length, int numLines){
-    int[][] indexedLines = new int[numLines][2];
+    int[][] indexedLines = new int[][]( numLines, 2 );
     int start = 0;
     int lineCount_ = 0;
     int i;
@@ -249,7 +256,7 @@
             }
         }
     }
-    int[][] newLines = new int[lineCount_+1][2];
+    int[][] newLines = new int[][]( lineCount_+1, 2 );
     System.arraycopy(indexedLines, 0, newLines, 0, lineCount_);
     int[] range = [start, i - start];
     newLines[lineCount_] = range;
@@ -263,10 +270,10 @@
  * @param text the text to insert
  */
 void insert(int position, char[] text) {
-    if (text.length() is 0) return;
+    if (text.length is 0) return;
 
     int startLine = getLineAtOffset(position);
-    int change = text.length();
+    int change = text.length;
     bool endInsert = position is getCharCount();
     adjustGap(position, change, startLine);
 
@@ -276,13 +283,13 @@
     int startLineOffset = getOffsetAtLine(startLine);
     // at this point, startLineLength will include the start line
     // and all of the newly inserted text
-    int startLineLength = getPhysicalLine(startLine).length();
+    int startLineLength = getPhysicalLine(startLine).length;
 
     if (change > 0) {
         // shrink gap
         gapStart += (change);
-        for (int i = 0; i < text.length(); i++) {
-            textStore[position + i]= text.charAt(i);
+        for (int i = 0; i < text.length; i++) {
+            textStore[position + i]= text[i];
         }
     }
 
@@ -446,11 +453,11 @@
  */
 int lineCount(char[] text){
     int lineCount_ = 0;
-    int length = text.length();
+    int length = text.length;
     for (int i = 0; i < length; i++) {
-        char ch = text.charAt(i);
+        char ch = text[i];
         if (ch is DWT.CR) {
-            if (i + 1 < length && text.charAt(i + 1) is DWT.LF) {
+            if (i + 1 < length && text[i + 1] is DWT.LF) {
                 i++;
             }
             lineCount_++;
@@ -480,25 +487,25 @@
 public char[] getLine(int index) {
     if ((index >= lineCount_) || (index < 0)) error(DWT.ERROR_INVALID_ARGUMENT);
     int start = lines[index][0];
-    int length = lines[index][1];
-    int end = start + length - 1;
+    int length_ = lines[index][1];
+    int end = start + length_ - 1;
     if (!gapExists() || (end < gapStart) || (start >= gapEnd)) {
         // line is before or after the gap
-        while ((length - 1 >= 0) && isDelimiter(textStore[start+length-1])) {
-            length--;
+        while ((length_ - 1 >= 0) && isDelimiter(textStore[start+length_-1])) {
+            length_--;
         }
-        return new char[](textStore, start, length);
+        return textStore[ start .. start + length_].dup;
     } else {
         // gap is in the specified range, strip out the gap
         StringBuffer buf = new StringBuffer();
         int gapLength = gapEnd - gapStart;
-        buf.append(textStore, start, gapStart - start);
-        buf.append(textStore, gapEnd, length - gapLength - (gapStart - start));
-        length = buf.length();
-        while ((length - 1 >=0) && isDelimiter(buf.charAt(length - 1))) {
-            length--;
+        buf.append(textStore[ start .. gapStart ] );
+        buf.append(textStore[ gapEnd .. gapEnd + length_ - gapLength - (gapStart - start) ]);
+        length_ = buf.length;
+        while ((length_ - 1 >=0) && isDelimiter(buf.slice[length_ - 1])) {
+            length_--;
         }
-        return buf.toString().substring(0, length);
+        return buf.toString()[ 0 .. length_ ].dup;
     }
 }
 /**
@@ -521,18 +528,18 @@
  */
 char[] getFullLine(int index) {
     int start = lines[index][0];
-    int length = lines[index][1];
-    int end = start + length - 1;
+    int length_ = lines[index][1];
+    int end = start + length_ - 1;
     if (!gapExists() || (end < gapStart) || (start >= gapEnd)) {
         // line is before or after the gap
-        return new char[](textStore, start, length);
+        return textStore[ start .. start + length_ ].dup;
     } else {
         // gap is in the specified range, strip out the gap
         StringBuffer buffer = new StringBuffer();
         int gapLength = gapEnd - gapStart;
-        buffer.append(textStore, start, gapStart - start);
-        buffer.append(textStore, gapEnd, length - gapLength - (gapStart - start));
-        return buffer.toString();
+        buffer.append(textStore[ start .. gapStart ]);
+        buffer.append(textStore[ gapEnd .. gapEnd + length_ - gapLength - (gapStart - start) ]);
+        return buffer.toString().dup;
     }
 }
 /**
@@ -544,8 +551,8 @@
  */
 char[] getPhysicalLine(int index) {
     int start = lines[index][0];
-    int length = lines[index][1];
-    return getPhysicalText(start, length);
+    int length_ = lines[index][1];
+    return getPhysicalText(start, length_);
 }
 /**
  * @return the number of lines in the text store
@@ -659,7 +666,7 @@
     if (size - lineCount_ >= numLines) {
         return;
     }
-    int[][] newLines = new int[size+Math.max(10, numLines)][2];
+    int[][] newLines = new int[][]( size+Math.max(10, numLines), 2 );
     System.arraycopy(lines, 0, newLines, 0, size);
     lines = newLines;
 }
@@ -690,8 +697,8 @@
  * @param length the physical length of the text to return
  * @return the text
  */
-char[] getPhysicalText(int start, int length) {
-    return new char[](textStore, start, length);
+char[] getPhysicalText(int start, int length_) {
+    return textStore[ start .. start + length_ ].dup;
 }
 /**
  * Returns a string representing the logical content of
@@ -702,22 +709,22 @@
  * @param length the logical length of the text to return
  * @return the text
  */
-public char[] getTextRange(int start, int length) {
+public char[] getTextRange(int start, int length_) {
     if (textStore is null)
         return "";
-    if (length is 0)
+    if (length_ is 0)
         return "";
-    int end= start + length;
+    int end= start + length_;
     if (!gapExists() || (end < gapStart))
-        return new char[](textStore, start, length);
+        return textStore[ start .. start + length_].dup;
     if (gapStart < start) {
         int gapLength= gapEnd - gapStart;
-        return new char[](textStore, start + gapLength , length);
+        return textStore[ start + gapLength .. start + gapLength + length_ ].dup;
     }
     StringBuffer buf = new StringBuffer();
-    buf.append(textStore, start, gapStart - start);
-    buf.append(textStore, gapEnd, end - gapStart);
-    return buf.toString();
+    buf.append(textStore[ start .. start + gapStart - start ] );
+    buf.append(textStore[ gapEnd .. gapEnd + end - gapStart ] );
+    return buf.toString().dup;
 }
 /**
  * Removes the specified <code>TextChangeListener</code>.
@@ -730,10 +737,10 @@
  */
 public void removeTextChangeListener(TextChangeListener listener){
     if (listener is null) error(DWT.ERROR_NULL_ARGUMENT);
-    for (int i = 0; i < textListeners.size(); i++) {
-        TypedListener typedListener = cast(TypedListener) textListeners.elementAt(i);
+    for (int i = 0; i < textListeners.length; i++) {
+        TypedListener typedListener = cast(TypedListener) textListeners[i];
         if (typedListener.getEventListener () is listener) {
-            textListeners.removeElementAt(i);
+            textListeners = textListeners[ 0 .. i ] ~ textListeners[ i+1 .. $ ];
             break;
         }
     }
@@ -777,7 +784,7 @@
     event.text = newText;
     event.newLineCount = lineCount(newText);
     event.replaceCharCount = replaceLength;
-    event.newCharCount = newText.length();
+    event.newCharCount = newText.length;
     sendTextEvent(event);
 
     // first delete the text to be replaced
@@ -793,8 +800,8 @@
  * Sends the text listeners the TextChanged event.
  */
 void sendTextEvent(StyledTextEvent event) {
-    for (int i = 0; i < textListeners.size(); i++) {
-        (cast(StyledTextListener)textListeners.elementAt(i)).handleEvent(event);
+    for (int i = 0; i < textListeners.length; i++) {
+        (cast(StyledTextListener)textListeners[i]).handleEvent(event);
     }
 }
 /**
@@ -805,7 +812,7 @@
  * @param text the text
  */
 public void setText (char[] text){
-    textStore = text.toCharArray();
+    textStore = text.dup;
     gapStart = -1;
     gapEnd = -1;
     expandExp = 1;
@@ -822,31 +829,31 @@
  * @param length the length of the text to delete
  * @param numLines the number of lines that are being deleted
  */
-void delete_(int position, int length, int numLines) {
-    if (length is 0) return;
+void delete_(int position, int length_, int numLines) {
+    if (length_ is 0) return;
 
     int startLine = getLineAtOffset(position);
     int startLineOffset = getOffsetAtLine(startLine);
-    int endLine = getLineAtOffset(position + length);
+    int endLine = getLineAtOffset(position + length_);
 
     char[] endText = "";
     bool splittingDelimiter = false;
-    if (position + length < getCharCount()) {
-        endText = getTextRange(position + length - 1, 2);
-        if ((endText.charAt(0) is DWT.CR) && (endText.charAt(1) is DWT.LF)) {
+    if (position + length_ < getCharCount()) {
+        endText = getTextRange(position + length_ - 1, 2);
+        if ((endText[0] is DWT.CR) && (endText[1] is DWT.LF)) {
             splittingDelimiter = true;
         }
     }
 
-    adjustGap(position + length, -length, startLine);
-    int [][] oldLines = indexLines(position, length + (gapEnd - gapStart), numLines);
+    adjustGap(position + length_, -length_, startLine);
+    int [][] oldLines = indexLines(position, length_ + (gapEnd - gapStart), numLines);
 
     // enlarge the gap - the gap can be enlarged either to the
     // right or left
-    if (position + length is gapStart) {
-        gapStart -= length;
+    if (position + length_ is gapStart) {
+        gapStart -= length_;
     } else {
-        gapEnd += length;
+        gapEnd += length_;
     }
 
     // figure out the length of the new concatenated line, do so by
--- a/dwt/custom/ExtendedModifyEvent.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/ExtendedModifyEvent.d	Fri Jan 18 17:00:39 2008 +0100
@@ -27,7 +27,7 @@
     static final long serialVersionUID = 3258696507027830832L;
 
 public this(StyledTextEvent e) {
-    super(e);
+    super(cast(Object)e);
     start = e.start;
     length = e.end - e.start;
     replacedText = e.text;
--- a/dwt/custom/LineBackgroundEvent.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/LineBackgroundEvent.d	Fri Jan 18 17:00:39 2008 +0100
@@ -38,7 +38,7 @@
     static final long serialVersionUID = 3978711687853324342L;
 
 public this(StyledTextEvent e) {
-    super(e);
+    super(cast(Object)e);
     lineOffset = e.detail;
     lineText = e.text;
 }
--- a/dwt/custom/LineStyleEvent.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/LineStyleEvent.d	Fri Jan 18 17:00:39 2008 +0100
@@ -84,7 +84,7 @@
     static final long serialVersionUID = 3906081274027192884L;
 
 public this(StyledTextEvent e) {
-    super(e);
+    super(cast(Object)e);
     lineOffset = e.detail;
     lineText = e.text;
     alignment = e.alignment;
--- a/dwt/custom/MovementEvent.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/MovementEvent.d	Fri Jan 18 17:00:39 2008 +0100
@@ -55,7 +55,7 @@
     static final long serialVersionUID = 3978765487853324342L;
 
 public this(StyledTextEvent e) {
-    super(e);
+    super(cast(Object)e);
     lineOffset = e.detail;
     lineText = e.text;
     movement = e.count;
--- a/dwt/custom/PaintObjectEvent.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/PaintObjectEvent.d	Fri Jan 18 17:00:39 2008 +0100
@@ -67,7 +67,7 @@
     static final long serialVersionUID = 3906081274027192855L;
 
 public this(StyledTextEvent e) {
-    super(e);
+    super(cast(Object)e);
     gc = e.gc;
     x = e.x;
     y = e.y;
--- a/dwt/custom/PopupList.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/PopupList.d	Fri Jan 18 17:00:39 2008 +0100
@@ -221,7 +221,7 @@
     // specified string
     if (string !is null){
         for (int i = 0; i < items.length; i++) {
-            if (items[i].startsWith(string)){
+            if ( tango.text.Util.locatePattern( items[i], string) is 0 ){
                 int index = list.indexOf(items[i]);
                 list.select(index);
                 break;
--- a/dwt/custom/SashForm.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/SashForm.d	Fri Jan 18 17:00:39 2008 +0100
@@ -22,6 +22,8 @@
 import dwt.widgets.Layout;
 import dwt.widgets.Listener;
 import dwt.widgets.Sash;
+import dwt.custom.SashFormLayout;
+import dwt.custom.SashFormData;
 
 /**
  * The SashForm is a composite control that lays out its children in a
@@ -41,17 +43,17 @@
     public int SASH_WIDTH = 3;
 
     int sashStyle;
-    Sash[] sashes = new Sash[0];
+    Sash[] sashes;
     // Remember background and foreground
     // colors to determine whether to set
     // sashes to the default color (null) or
     // a specific color
     Color background = null;
     Color foreground = null;
-    Control[] controls = new Control[0];
+    Control[] controls;
     Control maxControl = null;
     Listener sashListener;
-    static final int DRAG_MINIMUM = 20;
+    static const int DRAG_MINIMUM = 20;
 
 /**
  * Constructs a new instance of this class given its parent
--- a/dwt/custom/SashFormData.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/SashFormData.d	Fri Jan 18 17:00:39 2008 +0100
@@ -10,15 +10,18 @@
  *******************************************************************************/
 module dwt.custom.SashFormData;
 
+static import tango.text.Util;
+import tango.util.Convert;
+
 class SashFormData {
 
     long weight;
 
 char[] getName () {
-    char[] string = getClass ().getName ();
-    int index = string.lastIndexOf ('.');
-    if (index is -1) return string;
-    return string.substring (index + 1, string.length ());
+    char[] string = this.classinfo.name;
+    int index = tango.text.Util.locatePrior( string ,'.' );
+    if (index is string.length ) return string;
+    return string[ index + 1 .. $ ];
 }
 
 /**
@@ -28,6 +31,6 @@
  * @return a string representation of the event
  */
 public char[] toString () {
-    return getName()+" {weight="+weight+"}"; //$NON-NLS-2$
+    return getName()~" {weight="~to!(char[])(weight)~"}"; //$NON-NLS-2$
 }
 }
--- a/dwt/custom/SashFormLayout.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/SashFormLayout.d	Fri Jan 18 17:00:39 2008 +0100
@@ -18,6 +18,8 @@
 import dwt.widgets.Control;
 import dwt.widgets.Layout;
 import dwt.widgets.Sash;
+import dwt.custom.SashForm;
+import dwt.custom.SashFormData;
 
 /**
  * This class provides the layout for SashForm
--- a/dwt/custom/ScrolledComposite.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/ScrolledComposite.d	Fri Jan 18 17:00:39 2008 +0100
@@ -21,6 +21,7 @@
 import dwt.widgets.Layout;
 import dwt.widgets.Listener;
 import dwt.widgets.ScrollBar;
+import dwt.custom.ScrolledCompositeLayout;
 
 /**
  * A ScrolledComposite provides scrollbars and will scroll its content when the user
--- a/dwt/custom/ScrolledCompositeLayout.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/ScrolledCompositeLayout.d	Fri Jan 18 17:00:39 2008 +0100
@@ -18,6 +18,9 @@
 import dwt.widgets.Control;
 import dwt.widgets.Layout;
 import dwt.widgets.ScrollBar;
+import dwt.custom.ScrolledComposite;
+
+import Math = tango.math.Math;
 
 /**
  * This class provides the layout for ScrolledComposite
--- a/dwt/custom/StackLayout.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/StackLayout.d	Fri Jan 18 17:00:39 2008 +0100
@@ -19,6 +19,9 @@
 import dwt.widgets.Control;
 import dwt.widgets.Layout;
 
+import tango.util.Convert;
+static import tango.text.Util;
+
 /**
  * This Layout stacks all the controls one on top of the other and resizes all controls
  * to have the same size and location.
@@ -124,10 +127,10 @@
 }
 
 char[] getName () {
-    char[] string = getClass ().getName ();
-    int index = string.lastIndexOf ('.');
-    if (index is -1) return string;
-    return string.substring (index + 1, string.length ());
+    char[] string = this.classinfo.name;
+    int index = tango.text.Util.locatePrior( string ,'.');
+    if (index is string.length ) return string;
+    return string[ index + 1 .. $ ];
 }
 
 /**
@@ -137,12 +140,12 @@
  * @return a string representation of the layout
  */
 public char[] toString () {
-    char[] string = getName ()+" {";
-    if (marginWidth !is 0) string += "marginWidth="+marginWidth+" ";
-    if (marginHeight !is 0) string += "marginHeight="+marginHeight+" ";
-    if (topControl !is null) string += "topControl="+topControl+" ";
-    string = string.trim();
-    string += "}";
+    char[] string = getName ()~" {";
+    if (marginWidth !is 0) string ~= "marginWidth="~to!(char[])(marginWidth)~" ";
+    if (marginHeight !is 0) string ~= "marginHeight="~to!(char[])(marginHeight)~" ";
+    if (topControl !is null) string ~= "topControl="~to!(char[])(topControl)~" ";
+    string = tango.text.Util.trim(string);
+    string ~= "}";
     return string;
 }
 }
--- a/dwt/custom/StyledText.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/StyledText.d	Fri Jan 18 17:00:39 2008 +0100
@@ -39,6 +39,7 @@
 import dwt.graphics.GC;
 import dwt.graphics.GlyphMetrics;
 import dwt.graphics.Image;
+import dwt.graphics.Device;
 import dwt.graphics.Point;
 import dwt.graphics.Rectangle;
 import dwt.graphics.Resource;
@@ -73,8 +74,18 @@
 import dwt.custom.StyleRange;
 import dwt.custom.TextChangedEvent;
 import dwt.custom.TextChangingEvent;
+import dwt.custom.DefaultContent;
+import dwt.custom.StyledTextDropTargetEffect;
+import dwt.custom.StyledTextListener;
+import dwt.custom.ST;
+import dwt.dwthelper.Runnable;
 
 static import tango.text.Text;
+static import tango.text.Util;
+static import tango.io.FileConst;
+static import tango.text.convert.Utf;
+import tango.util.Convert;
+
 alias tango.text.Text.Text!(char) StringBuffer;
 
 /**
@@ -130,28 +141,28 @@
  * </p>
  */
 public class StyledText : Canvas {
-    static final char TAB = '\t';
-    static final char[] PlatformLineDelimiter = System.getProperty("line.separator");
-    static final int BIDI_CARET_WIDTH = 3;
-    static final int DEFAULT_WIDTH  = 64;
-    static final int DEFAULT_HEIGHT = 64;
-    static final int V_SCROLL_RATE = 50;
-    static final int H_SCROLL_RATE = 10;
+    static const char TAB = '\t';
+    static const char[] PlatformLineDelimiter = tango.io.FileConst.FileConst.NewlineString;
+    static const int BIDI_CARET_WIDTH = 3;
+    static const int DEFAULT_WIDTH  = 64;
+    static const int DEFAULT_HEIGHT = 64;
+    static const int V_SCROLL_RATE = 50;
+    static const int H_SCROLL_RATE = 10;
 
-    static final int ExtendedModify = 3000;
-    static final int LineGetBackground = 3001;
-    static final int LineGetStyle = 3002;
-    static final int TextChanging = 3003;
-    static final int TextSet = 3004;
-    static final int VerifyKey = 3005;
-    static final int TextChanged = 3006;
-    static final int LineGetSegments = 3007;
-    static final int PaintObject = 3008;
-    static final int WordNext = 3009;
-    static final int WordPrevious = 3010;
+    static const int ExtendedModify = 3000;
+    static const int LineGetBackground = 3001;
+    static const int LineGetStyle = 3002;
+    static const int TextChanging = 3003;
+    static const int TextSet = 3004;
+    static const int VerifyKey = 3005;
+    static const int TextChanged = 3006;
+    static const int LineGetSegments = 3007;
+    static const int PaintObject = 3008;
+    static const int WordNext = 3009;
+    static const int WordPrevious = 3010;
 
-    static final int PREVIOUS_OFFSET_TRAILING = 0;
-    static final int OFFSET_LEADING = 1;
+    static const int PREVIOUS_OFFSET_TRAILING = 0;
+    static const int OFFSET_LEADING = 1;
 
     Color selectionBackground;  // selection background color
     Color selectionForeground;  // selection foreground color
@@ -173,7 +184,7 @@
     int columnX;                        // keep track of the horizontal caret position when changing lines/pages. Fixes bug 5935
     int caretOffset = 0;
     int caretAlignment;
-    Point selection = new Point(0, 0);  // x and y are start and end caret offsets of selection
+    Point selection;                    // x and y are start and end caret offsets of selection
     Point clipboardSelection;           // x and y are start and end caret offsets of previous selection
     int selectionAnchor;                // position of selection anchor. 0 based offset from beginning of text
     Point doubleClickSelection;         // selection after last mouse double click
@@ -203,19 +214,19 @@
     Caret defaultCaret = null;
     bool updateCaretDirection = true;
     bool fixedLineHeight;
-    bool dragDetect = true;
+    bool dragDetect_ = true;
 
     int alignment;
     bool justify;
     int indent;
     int lineSpacing;
 
-    final static bool IS_CARBON, IS_GTK, IS_MOTIF;
+    const static bool IS_CARBON, IS_GTK, IS_MOTIF;
     static this(){
         char[] platform = DWT.getPlatform();
-        IS_CARBON = "carbon".equals(platform);
-        IS_GTK = "gtk".equals(platform);
-        IS_MOTIF = "motif".equals(platform);
+        IS_CARBON = ("carbon" == platform);
+        IS_GTK    = ("gtk"    == platform);
+        IS_MOTIF  = ("motif"  == platform);
     }
 
     /**
@@ -225,9 +236,9 @@
      * invoked from any thread.
      */
     static class Printing : Runnable {
-        final static int LEFT = 0;                      // left aligned header/footer segment
-        final static int CENTER = 1;                    // centered header/footer segment
-        final static int RIGHT = 2;                     // right aligned header/footer segment
+        const static int LEFT = 0;                      // left aligned header/footer segment
+        const static int CENTER = 1;                    // centered header/footer segment
+        const static int RIGHT = 2;                     // right aligned header/footer segment
 
         Printer printer;
         StyledTextRenderer printerRenderer;
@@ -264,7 +275,7 @@
         this.mirrored = (styledText.getStyle() & DWT.MIRRORED) !is 0;
         singleLine = styledText.isSingleLine();
         startPage = 1;
-        endPage = Integer.MAX_VALUE;
+        endPage = int.max;
         PrinterData data = printer.getPrinterData();
         if (data.scope_ is PrinterData.PAGE_RANGE) {
             startPage = data.startPage;
@@ -328,7 +339,7 @@
                 if (printOptions.printLineBackground) {
                     Color printerColor;
                     if ( auto p = color in resources ) {
-                        printerColor = *p;
+                        printerColor = cast(Color)*p;
                     }
                     else {
                         printerColor = new Color (printer, color.getRGB());
@@ -351,7 +362,7 @@
             if (style.font !is null) {
                 Font printerFont;
                 if ( auto p = font in resources ) {
-                    printerFont = *p;
+                    printerFont = cast(Font)*p;
                 }
                 else {
                     printerFont = new Font (printer, font.getFontData());
@@ -364,7 +375,7 @@
                 if (printOptions.printTextForeground) {
                     Color printerColor;
                     if ( auto p = color in resources ) {
-                        printerColor = *p;
+                        printerColor = cast(Color)*p;
                     }
                     else {
                         printerColor = new Color (printer, color.getRGB());
@@ -380,7 +391,7 @@
                 if (printOptions.printTextBackground) {
                     Color printerColor;
                     if ( auto p = color in resources ) {
-                        printerColor = *p;
+                        printerColor = cast(Color)*p;
                     }
                     else {
                         printerColor = new Color (printer, color.getRGB());
@@ -452,7 +463,7 @@
         Rectangle trim = printer.computeTrim(0, 0, 0, 0);
         Point dpi = printer.getDPI();
 
-        printerFont = new Font(printer, fontData.getName(), fontData.getHeight(), DWT.NORMAL);
+        printerFont = new Font( cast(Device)printer, fontData.getName(), fontData.getHeight(), DWT.NORMAL);
         clientArea = printer.getClientArea();
         pageWidth = clientArea.width;
         // one inch margin around text
@@ -588,16 +599,16 @@
         if (text is null) return;
         int lastSegmentIndex = 0;
         for (int i = 0; i < 3; i++) {
-            int segmentIndex = text.indexOf(StyledTextPrintOptions.SEPARATOR, lastSegmentIndex);
+            int segmentIndex = tango.text.Util.locatePattern( text, StyledTextPrintOptions.SEPARATOR, lastSegmentIndex);
             char[] segment;
-            if (segmentIndex is -1) {
-                segment = text.substring(lastSegmentIndex);
+            if (segmentIndex is text.length ) {
+                segment = text[ lastSegmentIndex .. $ ].dup;
                 printDecorationSegment(segment, i, page, header, layout);
                 break;
             } else {
-                segment = text.substring(lastSegmentIndex, segmentIndex);
+                segment = text[ lastSegmentIndex .. segmentIndex ].dup;
                 printDecorationSegment(segment, i, page, header, layout);
-                lastSegmentIndex = segmentIndex + StyledTextPrintOptions.SEPARATOR.length();
+                lastSegmentIndex = segmentIndex + StyledTextPrintOptions.SEPARATOR.length;
             }
         }
     }
@@ -612,15 +623,15 @@
      * @param header true = print the header, false = print the footer
      */
     void printDecorationSegment(char[] segment, int alignment, int page, bool header, TextLayout layout) {
-        int pageIndex = segment.indexOf(StyledTextPrintOptions.PAGE_TAG);
-        if (pageIndex !is -1) {
-            int pageTagLength = StyledTextPrintOptions.PAGE_TAG.length();
-            StringBuffer buffer = new StringBuffer(segment.substring (0, pageIndex));
+        int pageIndex = tango.text.Util.locatePattern( segment, StyledTextPrintOptions.PAGE_TAG );
+        if (pageIndex !is segment.length ) {
+            int pageTagLength = StyledTextPrintOptions.PAGE_TAG.length;
+            StringBuffer buffer = new StringBuffer(segment[ 0 .. pageIndex ]);
             buffer.append (page);
-            buffer.append (segment.substring(pageIndex + pageTagLength));
-            segment = buffer.toString();
-        }
-        if (segment.length() > 0) {
+            buffer.append (segment[ pageIndex + pageTagLength .. $ ]);
+            segment = buffer.toString().dup;
+        }
+        if (segment.length > 0) {
             layout.setText(segment);
             int segmentWidth = layout.getBounds().width;
             int segmentHeight = printerRenderer.getLineHeight();
@@ -700,8 +711,8 @@
      * </p>
      */
     class RTFWriter : TextWriter {
-        static final int DEFAULT_FOREGROUND = 0;
-        static final int DEFAULT_BACKGROUND = 1;
+        static const int DEFAULT_FOREGROUND = 0;
+        static const int DEFAULT_BACKGROUND = 1;
         Color[] colorTable;
         Font[] fontTable;
         bool WriteUnicode;
@@ -744,10 +755,16 @@
      */
     int getColorIndex(Color color, int defaultIndex) {
         if (color is null) return defaultIndex;
-        int index = colorTable.indexOf(color);
+        int index = -1;
+        foreach( i, col; colorTable ){
+            if( col == color ){
+                index = i;
+                break;
+            }
+        }
         if (index is -1) {
-            index = colorTable.size();
-            colorTable.addElement(color);
+            index = colorTable.length;
+            colorTable ~= color;
         }
         return index;
     }
@@ -760,10 +777,16 @@
      *  or "defaultIndex" if "color" is null.
      */
     int getFontIndex(Font font) {
-        int index = fontTable.indexOf(font);
+        int index = -1;
+        foreach( i, f; colorTable ){
+            if( f == font ){
+                index = i;
+                break;
+            }
+        }
         if (index is -1) {
-            index = fontTable.size();
-            fontTable.addElement(font);
+            index = fontTable.length;
+            fontTable ~= font;
         }
         return index;
     }
@@ -772,30 +795,31 @@
      * Don't write Unicode RTF on Windows 95/98/ME or NT.
      */
     void setUnicode() {
-        final char[] Win95 = "windows 95";
-        final char[] Win98 = "windows 98";
-        final char[] WinME = "windows me";
-        final char[] WinNT = "windows nt";
-        char[] osName = System.getProperty("os.name").toLowerCase();
-        char[] osVersion = System.getProperty("os.version");
-        int majorVersion = 0;
-
-        if (osName.startsWith(WinNT) && osVersion !is null) {
-            int majorIndex = osVersion.indexOf('.');
-            if (majorIndex !is -1) {
-                osVersion = osVersion.substring(0, majorIndex);
-                try {
-                    majorVersion = Integer.parseInt(osVersion);
-                } catch (NumberFormatException exception) {
-                    // ignore exception. version number remains unknown.
-                    // will write without Unicode
-                }
-            }
-        }
-        WriteUnicode =  !osName.startsWith(Win95) &&
-                        !osName.startsWith(Win98) &&
-                        !osName.startsWith(WinME) &&
-                        (!osName.startsWith(WinNT) || majorVersion > 4);
+//         const char[] Win95 = "windows 95";
+//         const char[] Win98 = "windows 98";
+//         const char[] WinME = "windows me";
+//         const char[] WinNT = "windows nt";
+//         char[] osName = System.getProperty("os.name").toLowerCase();
+//         char[] osVersion = System.getProperty("os.version");
+//         int majorVersion = 0;
+//
+//         if (osName.startsWith(WinNT) && osVersion !is null) {
+//             int majorIndex = osVersion.indexOf('.');
+//             if (majorIndex !is -1) {
+//                 osVersion = osVersion.substring(0, majorIndex);
+//                 try {
+//                     majorVersion = Integer.parseInt(osVersion);
+//                 } catch (NumberFormatException exception) {
+//                     // ignore exception. version number remains unknown.
+//                     // will write without Unicode
+//                 }
+//             }
+//         }
+//         WriteUnicode =  !osName.startsWith(Win95) &&
+//                         !osName.startsWith(Win98) &&
+//                         !osName.startsWith(WinME) &&
+//                         (!osName.startsWith(WinNT) || majorVersion > 4);
+        WriteUnicode = true; // we are on linux-gtk
     }
     /**
      * Appends the specified segment of "string" to the RTF data.
@@ -806,34 +830,38 @@
      * @param start start offset of segment. 0 based.
      * @param end end offset of segment
      */
+    alias TextWriter.write write;
     void write(char[] string, int start, int end) {
+        wchar[] wstring = tango.text.convert.Utf.toString16( string[ start .. end ] );
+        start = 0;
+        end = wstring.length;
         for (int index = start; index < end; index++) {
-            char ch = string.charAt(index);
+            wchar ch = wstring[index];
             if (ch > 0xFF && WriteUnicode) {
                 // write the sub string from the last escaped character
                 // to the current one. Fixes bug 21698.
                 if (index > start) {
-                    write(string.substring(start, index));
+                    write(tango.text.convert.Utf.toString(wstring[start .. index ]));
                 }
                 write("\\u");
-                write(Integer.toString(cast(short) ch));
+                write( to!(char[])( cast(short)ch ));
                 write(' ');                     // control word delimiter
                 start = index + 1;
             } else if (ch is '}' || ch is '{' || ch is '\\') {
                 // write the sub string from the last escaped character
                 // to the current one. Fixes bug 21698.
                 if (index > start) {
-                    write(string.substring(start, index));
+                    write(tango.text.convert.Utf.toString(wstring[start .. index]));
                 }
                 write('\\');
-                write(ch);
+                write(cast(char)ch); // ok because one of {}\
                 start = index + 1;
             }
         }
         // write from the last escaped character to the end.
         // Fixes bug 21698.
         if (start < end) {
-            write(string.substring(start, end));
+            write(tango.text.convert.Utf.toString(wstring[ start .. end]));
         }
     }
     /**
@@ -845,26 +873,29 @@
         header.append("{\\rtf1\\ansi");
         // specify code page, necessary for copy to work in bidi
         // systems that don't support Unicode RTF.
-        char[] cpg = System.getProperty("file.encoding").toLowerCase();
+        // PORTING_TODO: char[] cpg = System.getProperty("file.encoding").toLowerCase();
+        char[] cpg = "UTF16";
+        /+
         if (cpg.startsWith("cp") || cpg.startsWith("ms")) {
             cpg = cpg.substring(2, cpg.length());
             header.append("\\ansicpg");
             header.append(cpg);
         }
+        +/
         header.append("\\uc0\\deff0{\\fonttbl{\\f0\\fnil ");
         header.append(fontData.getName());
         header.append(";");
-        for (int i = 1; i < fontTable.size(); i++) {
+        for (int i = 1; i < fontTable.length; i++) {
             header.append("\\f");
             header.append(i);
             header.append(" ");
-            FontData fd = (cast(Font)fontTable.elementAt(i)).getFontData()[0];
+            FontData fd = (cast(Font)fontTable[i]).getFontData()[0];
             header.append(fd.getName());
             header.append(";");
         }
         header.append("}}\n{\\colortbl");
-        for (int i = 0; i < colorTable.size(); i++) {
-            Color color = cast(Color) colorTable.elementAt(i);
+        for (int i = 0; i < colorTable.length; i++) {
+            Color color = cast(Color) colorTable[i];
             header.append("\\red");
             header.append(color.getRed());
             header.append("\\green");
@@ -915,8 +946,8 @@
             lineAlignment = renderer.getLineAlignment(lineIndex, alignment);
             lineIndent =  renderer.getLineIndent(lineIndex, indent);
             lineJustify = renderer.getLineJustify(lineIndex, justify);
-            ranges = renderer.getRanges(lineOffset, line.length());
-            styles = renderer.getStyleRanges(lineOffset, line.length(), false);
+            ranges = renderer.getRanges(lineOffset, line.length);
+            styles = renderer.getStyleRanges(lineOffset, line.length, false);
         }
         if (styles is null) styles = new StyleRange[0];
         Color lineBackground = renderer.getLineBackground(lineIndex, null);
@@ -936,7 +967,7 @@
         if (isClosed()) {
             DWT.error(DWT.ERROR_IO);
         }
-        write(lineDelimiter, 0, lineDelimiter.length());
+        write(lineDelimiter, 0, lineDelimiter.length);
         write("\\par ");
     }
     /**
@@ -958,7 +989,7 @@
      *  May be null.
      */
     void writeStyledLine(char[] line, int lineOffset, int ranges[], StyleRange[] styles, Color lineBackground, int indent, int alignment, bool justify) {
-        int lineLength = line.length();
+        int lineLength = line.length;
         int startOffset = getStart();
         int writeOffset = startOffset - lineOffset;
         if (writeOffset >= lineLength) return;
@@ -1156,7 +1187,8 @@
         if (offset < 0 || offset > buffer.length()) {
             return;
         }
-        buffer.insert(offset, string);
+        buffer.select( offset );
+        buffer.prepend( string );
     }
     /**
      * Appends the given int to the data.
@@ -1187,7 +1219,7 @@
             DWT.error(DWT.ERROR_IO);
         }
         int writeOffset = startOffset - lineOffset;
-        int lineLength = line.length();
+        int lineLength = line.length;
         int lineIndex;
         if (writeOffset >= lineLength) {
             return;                         // whole line is outside write range
@@ -1198,7 +1230,7 @@
         }
         int copyEnd = Math.min(lineLength, endOffset - lineOffset);
         if (lineIndex < copyEnd) {
-            write(line.substring(lineIndex, copyEnd));
+            write(line[lineIndex .. copyEnd]);
         }
     }
     /**
@@ -1248,6 +1280,7 @@
  * @see #getStyle
  */
 public this(Composite parent, int style) {
+    selection = new Point(0, 0);
     super(parent, checkStyle(style));
     // set the fg in the OS to ensure that these are the same as StyledText, necessary
     // for ensuring that the bg/fg the IME box uses is the same as what StyledText uses
@@ -1850,7 +1883,7 @@
  *  has the DWT.SINGLE style.
  */
 char[] getModelDelimitedText(char[] text) {
-    int length = text.length();
+    int length = text.length;
     if (length is 0) {
         return text;
     }
@@ -1861,22 +1894,24 @@
     char[] delimiter = getLineDelimiter();
     while (i < length) {
         if (crIndex !is -1) {
-            crIndex = text.indexOf(DWT.CR, i);
+            crIndex = tango.text.Util.locate( text, DWT.CR, i);
+            if( crIndex is text.length ) crIndex = -1;
         }
         if (lfIndex !is -1) {
-            lfIndex = text.indexOf(DWT.LF, i);
+            lfIndex = tango.text.Util.locate( text, DWT.LF, i);
+            if( lfIndex is text.length ) lfIndex = -1;
         }
         if (lfIndex is -1 && crIndex is -1) {   // no more line breaks?
             break;
         } else if ((crIndex < lfIndex && crIndex !is -1) || lfIndex is -1) {
-            convertedText.append(text.substring(i, crIndex));
+            convertedText.append(text[i .. crIndex]);
             if (lfIndex is crIndex + 1) {       // CR/LF combination?
                 i = lfIndex + 1;
             } else {
                 i = crIndex + 1;
             }
         } else {                                    // LF occurs before CR!
-            convertedText.append(text.substring(i, lfIndex));
+            convertedText.append(text[i .. lfIndex]);
             i = lfIndex + 1;
         }
         if (isSingleLine()) {
@@ -1887,7 +1922,7 @@
     // copy remaining text if any and if not in single line mode or no
     // text copied thus far (because there only is one line)
     if (i < length && (!isSingleLine() || convertedText.length() is 0)) {
-        convertedText.append(text.substring(i));
+        convertedText.append(text[i .. $]);
     }
     return convertedText.toString();
 }
@@ -1999,7 +2034,7 @@
     int caretWidth = BIDI_CARET_WIDTH;
     Display display = getDisplay();
     if (leftCaretBitmap !is null) {
-        if (defaultCaret !is null && leftCaretBitmap.equals(defaultCaret.getImage())) {
+        if (defaultCaret !is null && leftCaretBitmap==defaultCaret.getImage()) {
             defaultCaret.setImage(null);
         }
         leftCaretBitmap.dispose();
@@ -2016,7 +2051,7 @@
     gc.dispose();
 
     if (rightCaretBitmap !is null) {
-        if (defaultCaret !is null && rightCaretBitmap.equals(defaultCaret.getImage())) {
+        if (defaultCaret !is null && rightCaretBitmap==defaultCaret.getImage()) {
             defaultCaret.setImage(null);
         }
         rightCaretBitmap.dispose();
@@ -2161,7 +2196,7 @@
         int lineOffset = content.getOffsetAtLine(lineIndex);
         if (caretOffset is lineOffset) {
             lineOffset = content.getOffsetAtLine(lineIndex - 1);
-            event.start = lineOffset + content.getLine(lineIndex - 1).length();
+            event.start = lineOffset + content.getLine(lineIndex - 1).length;
             event.end = caretOffset;
         } else {
             TextLayout layout = renderer.getTextLayout(lineIndex);
@@ -2206,7 +2241,7 @@
         char[] line = content.getLine(lineIndex);
         // replace character at caret offset if the caret is not at the
         // end of the line
-        if (event.end < lineOffset + line.length()) {
+        if (event.end < lineOffset + line.length) {
             event.end++;
         }
         event.text = [key];
@@ -2287,7 +2322,7 @@
     } else if (caretOffset < content.getCharCount()) {
         int line = content.getLineAtOffset(caretOffset);
         int lineOffset = content.getOffsetAtLine(line);
-        int lineLength = content.getLine(line).length();
+        int lineLength = content.getLine(line).length;
         if (caretOffset is lineOffset + lineLength) {
             event.start = caretOffset;
             event.end = content.getOffsetAtLine(line + 1);
@@ -2389,7 +2424,7 @@
         lineEndOffset = lineOffset + offsets[lineIndex + 1];
         renderer.disposeTextLayout(layout);
     } else {
-        int lineLength = content.getLine(caretLine).length();
+        int lineLength = content.getLine(caretLine).length;
         lineEndOffset = lineOffset + lineLength;
     }
     if (caretOffset < lineEndOffset) {
@@ -2688,14 +2723,14 @@
                 index--;
             }
             if (index is -1 && lineIndex > 0) {
-                bottomOffset = content.getOffsetAtLine(lineIndex - 1) + content.getLine(lineIndex - 1).length();
+                bottomOffset = content.getOffsetAtLine(lineIndex - 1) + content.getLine(lineIndex - 1).length;
             } else {
                 bottomOffset = content.getOffsetAtLine(lineIndex) + Math.max(0, layout.getLineOffsets()[index + 1] - 1);
             }
             renderer.disposeTextLayout(layout);
         } else {
             int lineIndex = getBottomIndex();
-            bottomOffset = content.getOffsetAtLine(lineIndex) + content.getLine(lineIndex).length();
+            bottomOffset = content.getOffsetAtLine(lineIndex) + content.getLine(lineIndex).length;
         }
         if (caretOffset < bottomOffset) {
             caretOffset = bottomOffset;
@@ -2901,7 +2936,7 @@
     int caretLine = getCaretLine();
     int lineOffset = content.getOffsetAtLine(caretLine);
     int offsetInLine = caretOffset - lineOffset;
-    if (offsetInLine < content.getLine(caretLine).length()) {
+    if (offsetInLine < content.getLine(caretLine).length) {
         TextLayout layout = renderer.getTextLayout(caretLine);
         offsetInLine = layout.getNextOffset(offsetInLine, DWT.MOVEMENT_CLUSTER);
         int lineStart = layout.getLineOffsets()[layout.getLineIndex(offsetInLine)];
@@ -2931,7 +2966,7 @@
     } else if (caretLine > 0) {
         caretLine--;
         lineOffset = content.getOffsetAtLine(caretLine);
-        caretOffset = lineOffset + content.getLine(caretLine).length();
+        caretOffset = lineOffset + content.getLine(caretLine).length;
         showCaret();
     }
 }
@@ -3139,7 +3174,7 @@
     int lineIndex = content.getLineAtOffset(offset);
     int lineOffset = content.getOffsetAtLine(lineIndex);
     TextLayout layout = renderer.getTextLayout(lineIndex);
-    int lineInParagraph = layout.getLineIndex(Math.min(offset - lineOffset, layout.getText().length()));
+    int lineInParagraph = layout.getLineIndex(Math.min(offset - lineOffset, layout.getText().length));
     FontMetrics metrics = layout.getLineMetrics(lineInParagraph);
     renderer.disposeTextLayout(layout);
     return metrics.getAscent() + metrics.getLeading();
@@ -3196,7 +3231,7 @@
     int lineIndex = content.getLineAtOffset(offset);
     char[] line = content.getLine(lineIndex);
     Rectangle bounds;
-    if (line.length() !is 0) {
+    if (line.length !is 0) {
         int offsetInLine = offset - content.getOffsetAtLine(lineIndex);
         TextLayout layout = renderer.getTextLayout(lineIndex);
         bounds = layout.getBounds(offsetInLine, offsetInLine);
@@ -3271,7 +3306,7 @@
 }
 public bool getDragDetect () {
     checkWidget ();
-    return dragDetect;
+    return dragDetect_;
 }
 /**
  * Returns whether the widget : double click mouse behavior.
@@ -3612,7 +3647,7 @@
     int lineIndex = content.getLineAtOffset(offset);
     int lineOffset = content.getOffsetAtLine(lineIndex);
     TextLayout layout = renderer.getTextLayout(lineIndex);
-    int lineInParagraph = layout.getLineIndex(Math.min(offset - lineOffset, layout.getText().length()));
+    int lineInParagraph = layout.getLineIndex(Math.min(offset - lineOffset, layout.getText().length));
     int height = layout.getLineBounds(lineInParagraph).height;
     renderer.disposeTextLayout(layout);
     return height;
@@ -3863,8 +3898,8 @@
     int y = point.y - getLinePixel(lineIndex);
     int offsetInLine = layout.getOffset(x, y, trailing);
     char[] line = content.getLine(lineIndex);
-    if (offsetInLine !is line.length() - 1) {
-        offsetInLine = Math.min(line.length(), offsetInLine + trailing[0]);
+    if (offsetInLine !is line.length - 1) {
+        offsetInLine = Math.min(line.length, offsetInLine + trailing[0]);
     }
     Rectangle rect = layout.getLineBounds(layout.getLineIndex(offsetInLine));
     renderer.disposeTextLayout(layout);
@@ -3903,8 +3938,8 @@
             char[] line = content.getLine(lineIndex);
             int level;
             int offset = offsetInLine;
-            while (offset > 0 && Character.isDigit(line.charAt(offset))) offset--;
-            if (offset is 0 && Character.isDigit(line.charAt(offset))) {
+            while (offset > 0 && tango.text.Unicode.isDigit(line[offset])) offset--;
+            if (offset is 0 && tango.text.Unicode.isDigit(line[offset])) {
                 level = isMirrored() ? 1 : 0;
             } else {
                 level = layout.getLevel(offset) & 0x1;
@@ -3983,7 +4018,7 @@
             writer.writeLineDelimiter(PlatformLineDelimiter);
         }
     }
-    if (end > endLineOffset + endLineText.length()) {
+    if (end > endLineOffset + endLineText.length) {
         writer.writeLineDelimiter(PlatformLineDelimiter);
     }
     writer.close();
@@ -4201,7 +4236,7 @@
         return getBidiSegmentsCompatibility(line, lineOffset);
     }
     StyledTextEvent event = sendLineEvent(LineGetSegments, lineOffset, line);
-    int lineLength = line.length();
+    int lineLength = line.length;
     int[] segments;
     if (event is null || event.segments is null || event.segments.length is 0) {
         segments = [0, lineLength];
@@ -4233,7 +4268,7 @@
  * Supports deprecated setBidiColoring API. Remove when API is removed.
  */
 int [] getBidiSegmentsCompatibility(char[] line, int lineOffset) {
-    int lineLength = line.length();
+    int lineLength = line.length;
     if (!bidiColoring) {
         return [0, lineLength];
     }
@@ -4256,7 +4291,7 @@
         StyleRange style = styles[i];
         int styleLineStart = Math.max(style.start - lineOffset, 0);
         int styleLineEnd = Math.max(style.start + style.length - lineOffset, styleLineStart);
-        styleLineEnd = Math.min (styleLineEnd, line.length ());
+        styleLineEnd = Math.min (styleLineEnd, line.length );
         if (i > 0 && count > 1 &&
             ((styleLineStart >= offsets[count-2] && styleLineStart <= offsets[count-1]) ||
              (styleLineEnd >= offsets[count-2] && styleLineEnd <= offsets[count-1])) &&
@@ -4543,12 +4578,12 @@
     for (int i = lineStart; i <= lineEnd; i++) {
         int lineOffset = content.getOffsetAtLine(i);
         TextLayout layout = renderer.getTextLayout(i);
-        if (layout.getText().length() > 0) {
+        if (layout.getText().length > 0) {
             if (i is lineStart && i is lineEnd) {
                 rect = layout.getBounds(start - lineOffset, end - lineOffset);
             } else if (i is lineStart) {
                 char[] line = content.getLine(i);
-                rect = layout.getBounds(start - lineOffset, line.length());
+                rect = layout.getBounds(start - lineOffset, line.length);
             } else if (i is lineEnd) {
                 rect = layout.getBounds(0, end - lineOffset);
             } else {
@@ -4679,12 +4714,12 @@
     int lineOffset = content.getOffsetAtLine(caretLine);
     char[] line = content.getLine(caretLine);
     int offset = caretOffset - lineOffset;
-    int lineLength = line.length();
+    int lineLength = line.length;
     if (lineLength is 0) return isMirrored() ? DWT.RIGHT : DWT.LEFT;
     if (caretAlignment is PREVIOUS_OFFSET_TRAILING && offset > 0) offset--;
     if (offset is lineLength && offset > 0) offset--;
-    while (offset > 0 && Character.isDigit(line.charAt(offset))) offset--;
-    if (offset is 0 && Character.isDigit(line.charAt(offset))) {
+    while (offset > 0 && tango.text.Unicode.isDigit(line[offset])) offset--;
+    if (offset is 0 && tango.text.Unicode.isDigit(line[offset])) {
         return isMirrored() ? DWT.RIGHT : DWT.LEFT;
     }
     TextLayout layout = renderer.getTextLayout(caretLine);
@@ -4717,7 +4752,7 @@
         int lineIndex = content.getLineAtOffset(offset);
         lineOffset = content.getOffsetAtLine(lineIndex);
         lineText = content.getLine(lineIndex);
-        int lineLength = lineText.length();
+        int lineLength = lineText.length;
         if (offset is lineOffset + lineLength) {
             newOffset = content.getOffsetAtLine(lineIndex + 1);
         } else {
@@ -4743,7 +4778,7 @@
         if (offset is lineOffset) {
             char[] nextLineText = content.getLine(lineIndex - 1);
             int nextLineOffset = content.getOffsetAtLine(lineIndex - 1);
-            newOffset = nextLineOffset + nextLineText.length();
+            newOffset = nextLineOffset + nextLineText.length;
         } else {
             TextLayout layout = renderer.getTextLayout(lineIndex);
             newOffset = lineOffset + layout.getPreviousOffset(offset - lineOffset, movement);
@@ -4775,7 +4810,7 @@
     char[] line = content.getLine(lineIndex);
     int lineOffset = content.getOffsetAtLine(lineIndex);
     int offsetInLine = offset - lineOffset;
-    int lineLength = line.length();
+    int lineLength = line.length;
     if (lineIndex < content.getLineCount() - 1) {
         int endLineOffset = content.getOffsetAtLine(lineIndex + 1) - 1;
         if (lineLength < offsetInLine && offsetInLine <= endLineOffset) {
@@ -4922,7 +4957,7 @@
     TextLayout layout = renderer.getTextLayout(startLine);
     int lineX = leftMargin - horizontalScrollOffset, startLineY = getLinePixel(startLine);
     int[] offsets = layout.getLineOffsets();
-    int startIndex = layout.getLineIndex(Math.min(start, layout.getText().length()));
+    int startIndex = layout.getLineIndex(Math.min(start, layout.getText().length));
 
     /* Redraw end of line before start line if wrapped and start offset is first char */
     if (wordWrap && startIndex > 0 && offsets[startIndex] is start) {
@@ -4935,7 +4970,7 @@
     }
 
     if (startLine is endLine) {
-        int endIndex = layout.getLineIndex(Math.min(end, layout.getText().length()));
+        int endIndex = layout.getLineIndex(Math.min(end, layout.getText().length));
         if (startIndex is endIndex) {
             /* Redraw rect between start and end offset if start and end offsets are in same wrapped line */
             Rectangle rect = layout.getBounds(start, end - 1);
@@ -4966,7 +5001,7 @@
         layout = renderer.getTextLayout(endLine);
         offsets = layout.getLineOffsets();
     }
-    int endIndex = layout.getLineIndex(Math.min(end, layout.getText().length()));
+    int endIndex = layout.getLineIndex(Math.min(end, layout.getText().length));
     Rectangle endRect = layout.getBounds(offsets[endIndex], end - 1);
     if (endRect.height is 0) {
         Rectangle bounds = layout.getLineBounds(endIndex);
@@ -5152,12 +5187,13 @@
     forceFocus();
 
     //drag detect
-    if (dragDetect && checkDragDetect(event)) return;
+    if (dragDetect_ && checkDragDetect(event)) return;
 
     //paste clipboard selection
     if (event.button is 2) {
-        char[] text = cast(char[])getClipboardContent(DND.SELECTION_CLIPBOARD);
-        if (text !is null && text.length() > 0) {
+        auto o = cast(ArrayWrapperString)getClipboardContent(DND.SELECTION_CLIPBOARD);
+        char[] text = o.array;
+        if (text !is null && text.length > 0) {
             // position cursor
             doMouseLocationChange(event.x, event.y, false);
             // insert text
@@ -5487,9 +5523,9 @@
             if (label !is null) {
                 char[] text = label.getText ();
                 if (text !is null) {
-                    char mnemonic = _findMnemonic (text);
+                    dchar mnemonic = _findMnemonic (text);
                     if (mnemonic !is '\0') {
-                        shortcut = "Alt+"+mnemonic; //$NON-NLS-1$
+                        shortcut = "Alt+"~tango.text.convert.Utf.toString( [mnemonic] ); //$NON-NLS-1$
                     }
                 }
             }
@@ -5535,7 +5571,7 @@
 Label getAssociatedLabel () {
     Control[] siblings = getParent ().getChildren ();
     for (int i = 0; i < siblings.length; i++) {
-        if (siblings [i] is this.outer) {
+        if (siblings [i] is this) {
             if (i > 0 && ( null !is cast(Label)siblings [i-1])) {
                 return cast(Label) siblings [i-1];
             }
@@ -5545,15 +5581,15 @@
 }
 char[] stripMnemonic (char[] string) {
     int index = 0;
-    int length = string.length ();
+    int length_ = string.length;
     do {
-        while ((index < length) && (string.charAt (index) !is '&')) index++;
-        if (++index >= length) return string;
-        if (string.charAt (index) !is '&') {
-            return string.substring(0, index-1) + string.substring(index, length);
+        while ((index < length_) && (string[index] !is '&')) index++;
+        if (++index >= length_) return string;
+        if (string[index] !is '&') {
+            return string[0 .. index-1] ~ string[index .. length_];
         }
         index++;
-    } while (index < length);
+    } while (index < length_);
     return string;
 }
 /*
@@ -5561,16 +5597,16 @@
  * an '&' character in the given string. If there are no '&'
  * characters in the given string, return '\0'.
  */
-char _findMnemonic (char[] string) {
+dchar _findMnemonic (char[] string) {
     if (string is null) return '\0';
     int index = 0;
-    int length = string.length ();
+    int length_ = string.length;
     do {
-        while (index < length && string.charAt (index) !is '&') index++;
-        if (++index >= length) return '\0';
-        if (string.charAt (index) !is '&') return Character.toLowerCase (string.charAt (index));
+        while (index < length_ && string[index] !is '&') index++;
+        if (++index >= length_) return '\0';
+        if (string[index] !is '&') return CharacterToLower(getFirstCodepoint( string[index .. $ ] ));
         index++;
-    } while (index < length);
+    } while (index < length_);
     return '\0';
 }
 /**
@@ -5751,7 +5787,7 @@
     // offsetInLine will be greater than line length if the line
     // delimiter is longer than one character and the offset is set
     // in between parts of the line delimiter.
-    return offsetInLine > content.getLine(line).length();
+    return offsetInLine > content.getLine(line).length;
 }
 /**
  * Returns whether the widget is mirrored (right oriented/right to left
@@ -5794,12 +5830,12 @@
         if (isListening(ExtendedModify)) {
             styledTextEvent = new StyledTextEvent(content);
             styledTextEvent.start = event.start;
-            styledTextEvent.end = event.start + event.text.length();
+            styledTextEvent.end = event.start + event.text.length;
             styledTextEvent.text = content.getTextRange(event.start, replacedLength);
         }
         if (updateCaret) {
             //Fix advancing flag for delete/backspace key on direction boundary
-            if (event.text.length() is 0) {
+            if (event.text.length is 0) {
                 int lineIndex = content.getLineAtOffset(event.start);
                 int lineOffset = content.getOffsetAtLine(lineIndex);
                 TextLayout layout = renderer.getTextLayout(lineIndex);
@@ -5824,7 +5860,7 @@
         // fixes 1GBB8NJ
         if (updateCaret) {
             // always update the caret location. fixes 1G8FODP
-            setSelection(event.start + event.text.length(), 0, true);
+            setSelection(event.start + event.text.length, 0, true);
             showCaret();
         }
         sendModifyEvent(event);
@@ -5861,8 +5897,8 @@
  */
 public void paste(){
     checkWidget();
-    char[] text = cast(char[]) getClipboardContent(DND.CLIPBOARD);
-    if (text !is null && text.length() > 0) {
+    char[] text = (cast(ArrayWrapperString) getClipboardContent(DND.CLIPBOARD)).array;
+    if (text !is null && text.length > 0) {
         Event event = new Event();
         event.start = selection.x;
         event.end = selection.y;
@@ -6596,14 +6632,14 @@
 }
 void sendModifyEvent(Event event) {
     Accessible accessible = getAccessible();
-    if (event.text.length() is 0) {
+    if (event.text.length is 0) {
         accessible.textChanged(ACC.TEXT_DELETE, event.start, event.end - event.start);
     } else {
         if (event.start is event.end) {
-            accessible.textChanged(ACC.TEXT_INSERT, event.start, event.text.length());
+            accessible.textChanged(ACC.TEXT_INSERT, event.start, event.text.length);
         } else {
             accessible.textChanged(ACC.TEXT_DELETE, event.start, event.end - event.start);
-            accessible.textChanged(ACC.TEXT_INSERT, event.start, event.text.length());
+            accessible.textChanged(ACC.TEXT_INSERT, event.start, event.text.length);
         }
     }
     notifyListeners(DWT.Modify, event);
@@ -6821,14 +6857,14 @@
     Object[] data;
     Transfer[] types;
     if (clipboardType is DND.SELECTION_CLIPBOARD) {
-        data = [plainText];
+        data = [ cast(Object) new ArrayWrapperString(plainText) ];
         types = [plainTextTransfer];
     } else {
         RTFTransfer rtfTransfer = RTFTransfer.getInstance();
         RTFWriter rtfWriter = new RTFWriter(start, length);
         char[] rtfText = getPlatformDelimitedText(rtfWriter);
-        data = [rtfText, plainText];
-        types = [rtfTransfer, plainTextTransfer];
+        data = [ cast(Object) new ArrayWrapperString(rtfText), new ArrayWrapperString(plainText) ];
+        types = [ cast(Transfer)rtfTransfer, plainTextTransfer];
     }
     clipboard.setContents(data, types, clipboardType);
 }
@@ -6886,9 +6922,9 @@
     checkWidget();
     doubleClickEnabled = enable;
 }
-public void setDragDetect (bool dragDetect) {
+public void setDragDetect (bool dragDetect_) {
     checkWidget ();
-    this.dragDetect = dragDetect;
+    this.dragDetect_ = dragDetect_;
 }
 /**
  * Sets whether the widget content can be edited.
@@ -7101,14 +7137,14 @@
     if (Compatibility.isLetter(keyChar)) {
         // make the keybinding case insensitive by adding it
         // in its upper and lower case form
-        char ch = Character.toUpperCase(keyChar);
+        char ch = CharacterToUpper(keyChar);
         int newKey = ch | modifierValue;
         if (action is DWT.NULL) {
             keyActionMap.remove(newKey);
         } else {
             keyActionMap[newKey] = action;
         }
-        ch = Character.toLowerCase(keyChar);
+        ch = CharacterToLower(keyChar);
         newKey = ch | modifierValue;
         if (action is DWT.NULL) {
             keyActionMap.remove(newKey);
@@ -7993,7 +8029,7 @@
         if (isListening(ExtendedModify)) {
             styledTextEvent = new StyledTextEvent(content);
             styledTextEvent.start = event.start;
-            styledTextEvent.end = event.start + event.text.length();
+            styledTextEvent.end = event.start + event.text.length;
             styledTextEvent.text = content.getTextRange(event.start, event.end - event.start);
         }
         content.setText(event.text);
--- a/dwt/custom/StyledTextDropTargetEffect.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/StyledTextDropTargetEffect.d	Fri Jan 18 17:00:39 2008 +0100
@@ -21,6 +21,10 @@
 import dwt.widgets.Event;
 import dwt.widgets.Listener;
 import dwt.custom.StyledText;
+import dwt.custom.StyledTextContent;
+
+static import tango.core.Exception;
+import Math = tango.math.Math;
 
 /**
  * This adapter class provides a default drag under effect (eg. select and scroll)
@@ -213,13 +217,13 @@
             int newOffset = -1;
             try {
                 newOffset = text.getOffsetAtLocation(pt);
-            } catch (IllegalArgumentException ex1) {
+            } catch ( tango.core.Exception.IllegalArgumentException ex1) {
                 int maxOffset = content.getCharCount();
                 Point maxLocation = text.getLocationAtOffset(maxOffset);
                 if (pt.y >= maxLocation.y) {
                     try {
                         newOffset = text.getOffsetAtLocation(new Point(pt.x, maxLocation.y));
-                    } catch (IllegalArgumentException ex2) {
+                    } catch (tango.core.Exception.IllegalArgumentException ex2) {
                         newOffset = maxOffset;
                     }
                 } else {
@@ -239,7 +243,7 @@
                                 break;
                             }
                         }
-                    } catch (IllegalArgumentException ex2) {
+                    } catch (tango.core.Exception.IllegalArgumentException ex2) {
                         newOffset = -1;
                     }
                 }
@@ -253,7 +257,7 @@
                 // offsetInLine will be greater than line length if the line
                 // delimiter is longer than one character and the offset is set
                 // in between parts of the line delimiter.
-                if (offsetInLine > content.getLine(line).length()) {
+                if (offsetInLine > content.getLine(line).length) {
                     newOffset = Math.max(0, newOffset - 1);
                 }
                 refreshCaret(text, currentOffset, newOffset);
--- a/dwt/custom/StyledTextListener.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/StyledTextListener.d	Fri Jan 18 17:00:39 2008 +0100
@@ -15,6 +15,26 @@
 import dwt.internal.DWTEventListener;
 import dwt.widgets.Event;
 import dwt.widgets.TypedListener;
+import dwt.custom.StyledText;
+import dwt.custom.ExtendedModifyEvent;
+import dwt.custom.ExtendedModifyListener;
+import dwt.custom.StyledTextEvent;
+import dwt.custom.LineBackgroundEvent;
+import dwt.custom.BidiSegmentEvent;
+import dwt.custom.LineStyleEvent;
+import dwt.custom.PaintObjectEvent;
+import dwt.custom.MovementEvent;
+import dwt.custom.TextChangedEvent;
+import dwt.custom.TextChangingEvent;
+import dwt.custom.LineBackgroundListener;
+import dwt.custom.BidiSegmentListener;
+import dwt.custom.LineStyleListener;
+import dwt.custom.PaintObjectListener;
+import dwt.custom.VerifyKeyListener;
+import dwt.custom.StyledTextContent;
+import dwt.custom.TextChangeListener;
+import dwt.custom.MovementListener;
+
 
 class StyledTextListener : TypedListener {
 /**
--- a/dwt/custom/StyledTextRenderer.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/StyledTextRenderer.d	Fri Jan 18 17:00:39 2008 +0100
@@ -32,6 +32,16 @@
 import dwt.custom.StyledText;
 import dwt.custom.StyledTextContent;
 import dwt.custom.TextChangingEvent;
+import dwt.custom.ST;
+import dwt.custom.StyledTextEvent;
+
+import dwt.dwthelper.Runnable;
+
+static import tango.text.Text;
+static import tango.text.Util;
+static import tango.io.FileConst;
+static import tango.text.convert.Utf;
+import tango.util.Convert;
 
 /**
  * A StyledTextRenderer renders the content of a StyledText widget.
@@ -351,10 +361,10 @@
     switch (type) {
         case ST.BULLET_DOT: string = "\u2022"; break;
         case ST.BULLET_NUMBER: string = to!(char[])(index); break;
-        case ST.BULLET_LETTER_LOWER: string = to!(char[])(cast(char) (index % 26 + 97)); break;
-        case ST.BULLET_LETTER_UPPER: string = to!(char[])(cast(char) (index % 26 + 65)); break;
+        case ST.BULLET_LETTER_LOWER: string = [cast(char) (index % 26 + 97)]; break;
+        case ST.BULLET_LETTER_UPPER: string = [cast(char) (index % 26 + 65)]; break;
     }
-    if ((bullet.type & ST.BULLET_TEXT) !is 0) string += bullet.text;
+    if ((bullet.type & ST.BULLET_TEXT) !is 0) string ~= bullet.text;
     Display display = styledText.getDisplay();
     TextLayout layout = new TextLayout(display);
     layout.setText(string);
@@ -363,7 +373,7 @@
     style = cast(StyleRange)style.clone();
     style.metrics = null;
     if (style.font is null) style.font = getFont(style.fontStyle);
-    layout.setStyle(style, 0, string.length());
+    layout.setStyle(style, 0, string.length);
     int x = paintX + Math.max(0, metrics.width - layout.getBounds().width - BULLET_MARGIN);
     layout.draw(gc, x, paintY);
     layout.dispose();
@@ -372,7 +382,7 @@
     TextLayout layout = getTextLayout(lineIndex);
     char[] line = content.getLine(lineIndex);
     int lineOffset = content.getOffsetAtLine(lineIndex);
-    int lineLength = line.length();
+    int lineLength = line.length;
     Point selection = styledText.getSelection();
     int selectionStart = selection.x - lineOffset;
     int selectionEnd = selection.y - lineOffset;
@@ -489,7 +499,7 @@
         int height = lineHeight[i];
         if (height is -1) {
             if (width > 0) {
-                int length = content.getLine(i).length();
+                int length = content.getLine(i).length;
                 height = ((length * averageCharWidth / width) + 1) * defaultLineHeight;
             } else {
                 height = defaultLineHeight;
@@ -814,7 +824,7 @@
     layout.setJustify(justify);
 
     int lastOffset = 0;
-    int length = line.length();
+    int length = line.length;
     if (styles !is null) {
         if (ranges !is null) {
             int rangeCount = styleCount << 1;
--- a/dwt/custom/TableCursor.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/TableCursor.d	Fri Jan 18 17:00:39 2008 +0100
@@ -430,12 +430,12 @@
         x += imageSize.width;
     }
     char[] text = row.getText(columnIndex);
-    if (text.length() > 0) {
+    if (text.length > 0) {
         Rectangle bounds = row.getBounds(columnIndex);
         Point extent = gc.stringExtent(text);
         // Temporary code - need a better way to determine table trim
         char[] platform = DWT.getPlatform();
-        if ("win32".equals(platform)) { //$NON-NLS-1$
+        if ("win32"==platform) { //$NON-NLS-1$
             if (table.getColumnCount() is 0 || columnIndex is 0) {
                 x += 2;
             } else {
--- a/dwt/custom/TableTree.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/TableTree.d	Fri Jan 18 17:00:39 2008 +0100
@@ -60,7 +60,7 @@
  */
 public class TableTree : Composite {
     Table table;
-    TableTreeItem[] items = EMPTY_ITEMS;
+    TableTreeItem[] items;
     Image plusImage, minusImage, sizeImage;
 
     /*
@@ -77,9 +77,9 @@
     */
     bool inDispose = false;
 
-    static final TableTreeItem[] EMPTY_ITEMS = new TableTreeItem [0];
-    static final char[][] EMPTY_TEXTS = new char[] [0];
-    static final Image[] EMPTY_IMAGES = new Image [0];
+    static final TableTreeItem[] EMPTY_ITEMS;
+    static final char[][] EMPTY_TEXTS;
+    static final Image[] EMPTY_IMAGES;
     static final char[] ITEMID = "TableTreeItemID"; //$NON-NLS-1$
 
 /**
@@ -113,6 +113,7 @@
  */
 public this(Composite parent, int style) {
     super(parent, checkStyle (style));
+    items = EMPTY_ITEMS;
     table = new Table(this, style);
     Listener tableListener = new class() Listener {
         public void handleEvent(Event e) {
--- a/dwt/custom/TableTreeEditor.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/TableTreeEditor.d	Fri Jan 18 17:00:39 2008 +0100
@@ -25,7 +25,7 @@
 import dwt.custom.TableTree;
 import dwt.custom.TableTreeItem;
 
-
+import dwt.dwthelper.Runnable;
 
 /**
 *
@@ -92,7 +92,6 @@
 * @deprecated As of 3.1 use TreeEditor with Tree, TreeItem and TreeColumn
 */
 public class TableTreeEditor : ControlEditor {
-
     TableTree tableTree;
     TableTreeItem item;
     int column = -1;
@@ -109,14 +108,17 @@
     this.tableTree = tableTree;
 
     treeListener = new class() TreeListener  {
-        final Runnable runnable = new class() Runnable {
-            public void run() {
-                if (editor is null || editor.isDisposed()) return;
-                if (this.outer.tableTree.isDisposed()) return;
-                layout();
-                editor.setVisible(true);
-            }
-        };
+        Runnable runnable;
+        this() {
+            runnable = new class() Runnable {
+                public void run() {
+                    if (editor is null || editor.isDisposed()) return;
+                    if (this.outer.outer.tableTree.isDisposed()) return;
+                    layout();
+                    editor.setVisible(true);
+                }
+            };
+        }
         public void treeCollapsed(TreeEvent e) {
             if (editor is null || editor.isDisposed ()) return;
             editor.setVisible(false);
@@ -142,6 +144,7 @@
     // To be consistent with older versions of DWT, grabVertical defaults to true
     grabVertical = true;
 }
+
 Rectangle computeBounds () {
     if (item is null || column is -1 || item.isDisposed() || item.tableItem is null) return new Rectangle(0, 0, 0, 0);
     Rectangle cell = item.getBounds(column);
@@ -254,6 +257,7 @@
 * @param item the TableItem for the row of the cell being tracked by this editor
 * @param column the zero based index of the column of the cell being tracked by this editor
 */
+alias ControlEditor.setEditor setEditor;
 public void setEditor (Control editor, TableTreeItem item, int column) {
     setItem(item);
     setColumn(column);
@@ -268,4 +272,5 @@
     if (columnCount > 0 && (column < 0 || column >= columnCount)) return;
     super.layout();
 }
+
 }
--- a/dwt/custom/TableTreeItem.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/TableTreeItem.d	Fri Jan 18 17:00:39 2008 +0100
@@ -26,6 +26,7 @@
 import dwt.widgets.Widget;
 import dwt.custom.TableTree;
 
+
 /**
  * A TableTreeItem is a selectable user interface object
  * that represents an item in a hierarchy of items in a
@@ -37,9 +38,9 @@
     TableItem tableItem;
     TableTree parent;
     TableTreeItem parentItem;
-    TableTreeItem [] items = TableTree.EMPTY_ITEMS;
-    char[][] texts = TableTree.EMPTY_TEXTS;
-    Image[] images = TableTree.EMPTY_IMAGES;
+    TableTreeItem [] items;
+    char[][] texts;
+    Image[] images;
     Color background;
     Color foreground;
     Font font;
@@ -178,6 +179,11 @@
 }
 
 this(TableTree parent, TableTreeItem parentItem, int style, int index) {
+
+    items = TableTree.EMPTY_ITEMS;
+    texts = TableTree.EMPTY_TEXTS;
+    images = TableTree.EMPTY_IMAGES;
+
     super(parent, style);
     this.parent = parent;
     this.parentItem = parentItem;
--- a/dwt/custom/TreeEditor.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/TreeEditor.d	Fri Jan 18 17:00:39 2008 +0100
@@ -78,6 +78,7 @@
 *   });
 * </pre></code>
 */
+
 public class TreeEditor : ControlEditor {
     Tree tree;
     TreeItem item;
@@ -85,7 +86,7 @@
     ControlListener columnListener;
     TreeListener treeListener;
     Runnable timer;
-    static final int TIMEOUT = 1500;
+    static const int TIMEOUT = 1500;
 
 /**
 * Creates a TreeEditor for the specified Tree.
@@ -111,14 +112,17 @@
         }
     };
     treeListener = new class() TreeListener {
-        final Runnable runnable = new class() Runnable {
-            public void run() {
-                if (editor is null || editor.isDisposed()) return;
-                if (this.outer.tree.isDisposed()) return;
-                layout();
-                editor.setVisible(true);
-            }
-        };
+        Runnable runnable;
+        this(){
+            runnable = new class() Runnable {
+                public void run() {
+                    if (editor is null || editor.isDisposed()) return;
+                    if (this.outer.outer.tree.isDisposed()) return;
+                    layout();
+                    editor.setVisible(true);
+                }
+            };
+        }
         public void treeCollapsed(TreeEvent e) {
             if (editor is null || editor.isDisposed ()) return;
             editor.setVisible(false);
@@ -170,7 +174,7 @@
     } else { // default is CENTER
         editorRect.x += (cell.width - editorRect.width)/2;
     }
-    // don't let the editor overlap with the +/- of the tree
+    // don't let the editor overlap with the + / - of the tree
     editorRect.x = Math.max(cell.x, editorRect.x);
 
     if (verticalAlignment is DWT.BOTTOM) {
@@ -318,4 +322,5 @@
     if (columnCount > 0 && (column < 0 || column >= columnCount)) return;
     super.layout();
 }
+
 }
--- a/dwt/custom/ViewForm.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/ViewForm.d	Fri Jan 18 17:00:39 2008 +0100
@@ -24,6 +24,7 @@
 import dwt.widgets.Event;
 import dwt.widgets.Layout;
 import dwt.widgets.Listener;
+import dwt.custom.ViewFormLayout;
 
 /**
  * Instances of this class implement a Composite that positions and sizes
@@ -85,7 +86,7 @@
      *
      * @deprecated
      */
-    public static RGB borderInsideRGB  = new RGB (132, 130, 132);
+    public static RGB borderInsideRGB;
     /**
      * Color of middle line of drop shadow border.
      *
@@ -94,7 +95,7 @@
      *
      * @deprecated
      */
-    public static RGB borderMiddleRGB  = new RGB (143, 141, 138);
+    public static RGB borderMiddleRGB;
     /**
      * Color of outermost line of drop shadow border.
      *
@@ -103,7 +104,7 @@
      *
      * @deprecated
      */
-    public static RGB borderOutsideRGB = new RGB (171, 168, 165);
+    public static RGB borderOutsideRGB;
 
     // DWT widgets
     Control topLeft;
@@ -128,6 +129,13 @@
     static final int OFFSCREEN = -200;
     static final int BORDER1_COLOR = DWT.COLOR_WIDGET_NORMAL_SHADOW;
     static final int SELECTION_BACKGROUND = DWT.COLOR_LIST_BACKGROUND;
+
+
+    static this(){
+        borderInsideRGB  = new RGB (132, 130, 132);
+        borderMiddleRGB  = new RGB (143, 141, 138);
+        borderOutsideRGB = new RGB (171, 168, 165);
+    }
 /**
  * Constructs a new instance of this class given its parent
  * and a style value describing its behavior and appearance.
--- a/dwt/custom/ViewFormLayout.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/custom/ViewFormLayout.d	Fri Jan 18 17:00:39 2008 +0100
@@ -18,6 +18,8 @@
 import dwt.widgets.Control;
 import dwt.widgets.Layout;
 import dwt.widgets.Scrollable;
+import dwt.custom.ViewForm;
+import dwt.custom.CLayoutData;
 
 /**
  * This class provides the layout for ViewForm
--- a/dwt/dwthelper/utils.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/dwthelper/utils.d	Fri Jan 18 17:00:39 2008 +0100
@@ -30,5 +30,15 @@
 alias ArrayWrapperT!(char)    ArrayWrapperString;
 alias ArrayWrapperT!(char[])  ArrayWrapperString2;
 
+dchar getFirstCodepoint( char[] str ){
+    return str[0];
+}
+dchar CharacterToLower( dchar c ){
+    dchar[] r = tango.text.Unicode.toLower( [c] );
+    return r[0];
+}
+dchar CharacterToUpper( dchar c ){
+    dchar[] r = tango.text.Unicode.toUpper( [c] );
+    return r[0];
+}
 
-
--- a/dwt/internal/BidiUtil.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/internal/BidiUtil.d	Fri Jan 18 17:00:39 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
  * Copyright (c) 2000, 2004 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
@@ -11,9 +11,8 @@
 module dwt.internal.BidiUtil;
 
 import dwt.graphics.GC;
-
-// PORTING_TYPE
-class Runnable{}
+import dwt.internal.gtk.OS;
+import dwt.dwthelper.Runnable;
 
 /*
  * This class is supplied so that the StyledText code that supports bidi text (supported
@@ -44,7 +43,7 @@
 /*
  * Not implemented.
  */
-public static void addLanguageListener(int /*long*/ hwnd, Runnable runnable) {
+public static void addLanguageListener(GtkWidget* hwnd, Runnable runnable) {
 }
 /*
  * Not implemented.
@@ -93,7 +92,7 @@
 /*
  * Not implemented.
  */
-public static void removeLanguageListener(int /*long*/ hwnd) {
+public static void removeLanguageListener(GtkWidget* hwnd) {
 }
 /*
  * Not implemented.
@@ -103,7 +102,7 @@
 /*
  * Not implemented.
  */
-public static bool setOrientation(int /*long*/ hwnd, int orientation) {
+public static bool setOrientation(GtkWidget* hwnd, int orientation) {
     return false;
 }
 }
--- a/dwt/widgets/Table.d	Fri Jan 18 11:45:54 2008 +0100
+++ b/dwt/widgets/Table.d	Fri Jan 18 17:00:39 2008 +0100
@@ -2832,6 +2832,7 @@
     if (window !is null) OS.gdk_window_set_back_pixmap (window, null, true);
 }
 
+alias Composite.setBounds setBounds;
 override int setBounds (int x, int y, int width, int height, bool move, bool resize) {
     int result = super.setBounds (x, y, width, height, move, resize);
     /*