changeset 66:774d936d1380

TabFolder, TabItem
author Frank Benoit <benoit@tionex.de>
date Mon, 04 Feb 2008 16:26:54 +0100
parents 66203354c9d3
children 3f4e6a4ecc09
files dwt/widgets/Spinner.d dwt/widgets/TabFolder.d dwt/widgets/TabItem.d
diffstat 3 files changed, 132 insertions(+), 139 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/widgets/Spinner.d	Mon Feb 04 15:39:21 2008 +0100
+++ b/dwt/widgets/Spinner.d	Mon Feb 04 16:26:54 2008 +0100
@@ -1047,7 +1047,7 @@
         char[] decimalSeparator = getDecimalSeparator ();
         index = string.indexOf (decimalSeparator);
         if (index !is -1) {
-            string = string[0 .. index] ~ string[ index + 1 .. $ ];
+            string = string.substring (0, index) ~ string.substring (index + 1);
         }
         index = 0;
     }
--- a/dwt/widgets/TabFolder.d	Mon Feb 04 15:39:21 2008 +0100
+++ b/dwt/widgets/TabFolder.d	Mon Feb 04 16:26:54 2008 +0100
@@ -10,10 +10,7 @@
  *******************************************************************************/
 module dwt.widgets.TabFolder;
 
-import dwt.widgets.Composite;
-class TabFolder : Composite {
-}
-/++
+
 import dwt.DWT;
 import dwt.DWTException;
 import dwt.events.SelectionEvent;
@@ -23,16 +20,15 @@
 import dwt.graphics.Point;
 import dwt.graphics.Rectangle;
 import dwt.internal.ImageList;
-import dwt.internal.win32.LRESULT;
-import dwt.internal.win32.NMHDR;
-import dwt.internal.win32.NMTTDISPINFO;
 import dwt.internal.win32.OS;
-import dwt.internal.win32.RECT;
-import dwt.internal.win32.TCHAR;
-import dwt.internal.win32.TCITEM;
-import dwt.internal.win32.TOOLINFO;
-import dwt.internal.win32.WINDOWPOS;
-import dwt.internal.win32.WNDCLASS;
+
+import dwt.widgets.Composite;
+import dwt.widgets.TabItem;
+import dwt.widgets.TypedListener;
+import dwt.widgets.Event;
+import dwt.widgets.Control;
+
+import dwt.dwthelper.utils;
 
 /**
  * Instances of this class implement the notebook user interface
@@ -59,26 +55,26 @@
  * IMPORTANT: This class is <em>not</em> intended to be subclassed.
  * </p>
  */
-public class TabFolder extends Composite {
+public class TabFolder : Composite {
 
     alias Composite.computeSize computeSize;
     alias Composite.windowProc windowProc;
 
     TabItem [] items;
     ImageList imageList;
-    static final int TabFolderProc;
-    static final TCHAR TabFolderClass = new TCHAR (0, OS.WC_TABCONTROL, true);
+    static const WNDPROC TabFolderProc;
+    static const TCHAR[] TabFolderClass = OS.WC_TABCONTROL;
 
     /*
     * These are the undocumented control id's for the children of
     * a tab control.  Since there are no constants for these values,
     * they may change with different versions of Windows.
     */
-    static final int ID_UPDOWN = 1;
+    static const int ID_UPDOWN = 1;
 
-    static {
-        WNDCLASS lpWndClass = new WNDCLASS ();
-        OS.GetClassInfo (0, TabFolderClass, lpWndClass);
+    static this() {
+        WNDCLASS lpWndClass;
+        OS.GetClassInfo (null, TabFolderClass.ptr, &lpWndClass);
         TabFolderProc = lpWndClass.lpfnWndProc;
         /*
         * Feature in Windows.  The tab control window class
@@ -99,15 +95,15 @@
         * code, other than DWT, could create a control with
         * this class name, and fail unexpectedly.
         */
-        int hInstance = OS.GetModuleHandle (null);
-        int hHeap = OS.GetProcessHeap ();
+        auto hInstance = OS.GetModuleHandle (null);
+        auto hHeap = OS.GetProcessHeap ();
         lpWndClass.hInstance = hInstance;
         lpWndClass.style &= ~(OS.CS_HREDRAW | OS.CS_VREDRAW | OS.CS_GLOBALCLASS);
-        int byteCount = TabFolderClass.length () * TCHAR.sizeof;
-        int lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
-        OS.MoveMemory (lpszClassName, TabFolderClass, byteCount);
+        int byteCount = (TabFolderClass.length+1) * TCHAR.sizeof;
+        auto lpszClassName = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
+        OS.MoveMemory (lpszClassName, TabFolderClass.ptr, byteCount);
         lpWndClass.lpszClassName = lpszClassName;
-        OS.RegisterClass (lpWndClass);
+        OS.RegisterClass (&lpWndClass);
         OS.HeapFree (hHeap, 0, lpszClassName);
     }
 
@@ -139,7 +135,7 @@
  * @see Widget#checkSubclass
  * @see Widget#getStyle
  */
-public TabFolder (Composite parent, int style) {
+public this (Composite parent, int style) {
     super (parent, checkStyle (style));
 }
 
@@ -175,9 +171,9 @@
     addListener(DWT.DefaultSelection,typedListener);
 }
 
-override int callWindowProc (int hwnd, int msg, int wParam, int lParam) {
-    if (handle is 0) return 0;
-    return OS.CallWindowProc (TabFolderProc, hwnd, msg, wParam, lParam);
+override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return LRESULT.ZERO;
+    return cast(LRESULT) OS.CallWindowProc (TabFolderProc, hwnd, msg, wParam, lParam);
 }
 
 static int checkStyle (int style) {
@@ -185,7 +181,7 @@
     * When the DWT.TOP style has not been set, force the
     * tabs to be on the bottom for tab folders on PPC.
     */
-    if (OS.IsPPC) {
+    if (OS.IsPPC_) {
         if ((style & DWT.TOP) is 0) style |= DWT.BOTTOM;
     }
     style = checkBits (style, DWT.TOP, DWT.BOTTOM, 0, 0, 0, 0);
@@ -207,17 +203,17 @@
 override public Point computeSize (int wHint, int hHint, bool changed) {
     checkWidget ();
     Point size = super.computeSize (wHint, hHint, changed);
-    RECT insetRect = new RECT (), itemRect = new RECT ();
-    OS.SendMessage (handle, OS.TCM_ADJUSTRECT, 0, insetRect);
+    RECT insetRect, itemRect;
+    OS.SendMessage (handle, OS.TCM_ADJUSTRECT, 0, &insetRect);
     int width = insetRect.left - insetRect.right;
     int count = OS.SendMessage (handle, OS.TCM_GETITEMCOUNT, 0, 0);
     if (count !is 0) {
-        OS.SendMessage (handle, OS.TCM_GETITEMRECT, count - 1, itemRect);
+        OS.SendMessage (handle, OS.TCM_GETITEMRECT, count - 1, &itemRect);
         width = Math.max (width, itemRect.right - insetRect.right);
     }
-    RECT rect = new RECT ();
-    OS.SetRect (rect, 0, 0, width, size.y);
-    OS.SendMessage (handle, OS.TCM_ADJUSTRECT, 1, rect);
+    RECT rect;
+    OS.SetRect (&rect, 0, 0, width, size.y);
+    OS.SendMessage (handle, OS.TCM_ADJUSTRECT, 1, &rect);
     int border = getBorderWidth ();
     rect.left -= border;  rect.right += border;
     width = rect.right - rect.left;
@@ -227,9 +223,9 @@
 
 override public Rectangle computeTrim (int x, int y, int width, int height) {
     checkWidget ();
-    RECT rect = new RECT ();
-    OS.SetRect (rect, x, y, x + width, y + height);
-    OS.SendMessage (handle, OS.TCM_ADJUSTRECT, 1, rect);
+    RECT rect;
+    OS.SetRect (&rect, x, y, x + width, y + height);
+    OS.SendMessage (handle, OS.TCM_ADJUSTRECT, 1, &rect);
     int border = getBorderWidth ();
     rect.left -= border;  rect.right += border;
     rect.top -= border;  rect.bottom += border;
@@ -246,8 +242,8 @@
         System.arraycopy (items, 0, newItems, 0, items.length);
         items = newItems;
     }
-    TCITEM tcItem = new TCITEM ();
-    if (OS.SendMessage (handle, OS.TCM_INSERTITEM, index, tcItem) is -1) {
+    TCITEM tcItem;
+    if (OS.SendMessage (handle, OS.TCM_INSERTITEM, index, &tcItem) is -1) {
         error (DWT.ERROR_ITEM_NOT_ADDED);
     }
     System.arraycopy (items, index, items, index + 1, count - index);
@@ -271,7 +267,7 @@
     state &= ~(CANVAS | THEME_BACKGROUND);
 
     /* Enable the flat look for tab folders on PPC */
-    if (OS.IsPPC) {
+    if (OS.IsPPC_) {
         OS.SendMessage (handle, OS.CCM_SETVERSION, 0x020c /*COMCTL32_VERSION*/, 0);
     }
 
@@ -282,7 +278,7 @@
     * is set.  The fix is to set TTM_SETMAXTIPWIDTH to
     * a large value.
     */
-    int hwndToolTip = OS.SendMessage (handle, OS.TCM_GETTOOLTIPS, 0, 0);
+    auto hwndToolTip = cast(HWND) OS.SendMessage (handle, OS.TCM_GETTOOLTIPS, 0, 0);
     OS.SendMessage (hwndToolTip, OS.TTM_SETMAXTIPWIDTH, 0, 0x7FFF);
 }
 
@@ -318,12 +314,13 @@
     }
 }
 
-override void drawThemeBackground (int hDC, int hwnd, RECT rect) {
-    RECT rect2 = new RECT ();
-    OS.GetClientRect (handle, rect2);
-    OS.MapWindowPoints (handle, hwnd, rect2, 2);
-    if (OS.IntersectRect (new RECT (), rect2, rect)) {
-        OS.DrawThemeBackground (display.hTabTheme (), hDC, OS.TABP_BODY, 0, rect2, null);
+override void drawThemeBackground (HDC hDC, HWND hwnd, RECT* rect) {
+    RECT rect2;
+    OS.GetClientRect (handle, &rect2);
+    OS.MapWindowPoints (handle, hwnd, cast(POINT*) &rect2, 2);
+    RECT dummy;
+    if (OS.IntersectRect (&dummy, &rect2, rect)) {
+        OS.DrawThemeBackground (display.hTabTheme (), hDC, OS.TABP_BODY, 0, &rect2, null);
     }
 }
 
@@ -335,9 +332,9 @@
 override public Rectangle getClientArea () {
     checkWidget ();
     forceResize ();
-    RECT rect = new RECT ();
-    OS.GetClientRect (handle, rect);
-    OS.SendMessage (handle, OS.TCM_ADJUSTRECT, 0, rect);
+    RECT rect;
+    OS.GetClientRect (handle, &rect);
+    OS.SendMessage (handle, OS.TCM_ADJUSTRECT, 0, &rect);
     int width = rect.right - rect.left;
     int height = rect.bottom - rect.top;
     return new Rectangle (rect.left, rect.top, width, height);
@@ -424,7 +421,7 @@
     checkWidget ();
     int index = OS.SendMessage (handle, OS.TCM_GETCURSEL, 0, 0);
     if (index is -1) return new TabItem [0];
-    return new TabItem [] {items [index]};
+    return [ items [index] ];
 }
 
 /**
@@ -449,7 +446,7 @@
         Rectangle bounds = image.getBounds ();
         imageList = display.getImageList (style & DWT.RIGHT_TO_LEFT, bounds.width, bounds.height);
         int index = imageList.add (image);
-        int hImageList = imageList.getHandle ();
+        auto hImageList = imageList.getHandle ();
         OS.SendMessage (handle, OS.TCM_SETIMAGELIST, 0, hImageList);
         return index;
     }
@@ -513,12 +510,12 @@
     return new Point (width, height);
 }
 
-override bool mnemonicHit (char key) {
+override bool mnemonicHit (wchar key) {
     for (int i=0; i<items.length; i++) {
         TabItem item = items [i];
         if (item !is null) {
-            char ch = findMnemonic (item.getText ());
-            if (Character.toUpperCase (key) is Character.toUpperCase (ch)) {
+            wchar ch = findMnemonic (item.getText ());
+            if (CharacterToUpper (key) is CharacterToUpper (ch)) {
                 if (forceFocus ()) {
                     if (i !is getSelectionIndex ()) setSelection (i, true);
                     return true;
@@ -529,12 +526,12 @@
     return false;
 }
 
-override bool mnemonicMatch (char key) {
+override bool mnemonicMatch (wchar key) {
     for (int i=0; i<items.length; i++) {
         TabItem item = items [i];
         if (item !is null) {
-            char ch = findMnemonic (item.getText ());
-            if (Character.toUpperCase (key) is Character.toUpperCase (ch)) {
+            wchar ch = findMnemonic (item.getText ());
+            if (CharacterToUpper (key) is CharacterToUpper (ch)) {
                 return true;
             }
         }
@@ -619,7 +616,7 @@
 public void setSelection (TabItem item) {
     checkWidget ();
     if (item is null) error (DWT.ERROR_NULL_ARGUMENT);
-    setSelection (new TabItem [] {item});
+    setSelection ( [item] );
 }
 
 /**
@@ -655,7 +652,7 @@
     Rectangle oldRect = getClientArea ();
     super.setFont (font);
     Rectangle newRect = getClientArea ();
-    if (!oldRect.equals (newRect)) {
+    if (oldRect !=/*eq*/ newRect) {
         sendResize ();
         int index = OS.SendMessage (handle, OS.TCM_GETCURSEL, 0, 0);
         if (index !is -1) {
@@ -715,14 +712,14 @@
     }
 }
 
-override String toolTipText (NMTTDISPINFO hdr) {
+override char[] toolTipText (NMTTDISPINFO* hdr) {
     if ((hdr.uFlags & OS.TTF_IDISHWND) !is 0) {
         return null;
     }
-    int index = hdr.idFrom;
-    int hwndToolTip = OS.SendMessage (handle, OS.TCM_GETTOOLTIPS, 0, 0);
-    if (hwndToolTip is hdr.hwndFrom) {
-        if (toolTipText !is null) return "";
+    int index = hdr.hdr.idFrom;
+    auto hwndToolTip = cast(HWND) OS.SendMessage (handle, OS.TCM_GETTOOLTIPS, 0, 0);
+    if (hwndToolTip is hdr.hdr.hwndFrom) {
+        if (toolTipText_ !is null) return "";
         if (0 <= index && index < items.length) {
             TabItem item = items [index];
             if (item !is null) return item.toolTipText;
@@ -763,12 +760,12 @@
     return bits | OS.TCS_TABS | OS.TCS_TOOLTIPS;
 }
 
-override TCHAR windowClass () {
-    return TabFolderClass;
+override char[] windowClass () {
+    return TCHARsToStr( TabFolderClass );
 }
 
 override int windowProc () {
-    return TabFolderProc;
+    return cast(int) TabFolderProc;
 }
 
 override LRESULT WM_GETDLGCODE (int wParam, int lParam) {
@@ -778,13 +775,13 @@
     * processed without needing to press the ALT key
     * when the widget has focus.
     */
-    if (result !is null) return result;
-    return new LRESULT (OS.DLGC_BUTTON);
+    if (result !is LRESULT.NULL) return result;
+    return cast(LRESULT) (OS.DLGC_BUTTON);
 }
 
 override LRESULT WM_MOUSELEAVE (int wParam, int lParam) {
     LRESULT result = super.WM_MOUSELEAVE (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     /*
     * Bug in Windows.  On XP, when a tooltip is
     * hidden due to a time out or mouse press,
@@ -797,13 +794,13 @@
     * the mouse leaves the control.
     */
     if (OS.COMCTL32_MAJOR >= 6) {
-        TOOLINFO lpti = new TOOLINFO ();
+        TOOLINFO lpti;
         lpti.cbSize = TOOLINFO.sizeof;
-        int hwndToolTip = OS.SendMessage (handle, OS.TCM_GETTOOLTIPS, 0, 0);
-        if (OS.SendMessage (hwndToolTip, OS.TTM_GETCURRENTTOOL, 0, lpti) !is 0) {
+        auto hwndToolTip = cast(HWND) OS.SendMessage (handle, OS.TCM_GETTOOLTIPS, 0, 0);
+        if (OS.SendMessage (hwndToolTip, OS.TTM_GETCURRENTTOOL, 0, &lpti) !is 0) {
             if ((lpti.uFlags & OS.TTF_IDISHWND) is 0) {
-                OS.SendMessage (hwndToolTip, OS.TTM_DELTOOL, 0, lpti);
-                OS.SendMessage (hwndToolTip, OS.TTM_ADDTOOL, 0, lpti);
+                OS.SendMessage (hwndToolTip, OS.TTM_DELTOOL, 0, &lpti);
+                OS.SendMessage (hwndToolTip, OS.TTM_ADDTOOL, 0, &lpti);
             }
         }
     }
@@ -812,7 +809,7 @@
 
 override LRESULT WM_NCHITTEST (int wParam, int lParam) {
     LRESULT result = super.WM_NCHITTEST (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     /*
     * Feature in Windows.  The tab control implements
     * WM_NCHITTEST to return HTCLIENT when the cursor
@@ -826,7 +823,7 @@
     * the mouse is in the client area.
     */
     int hittest = OS.DefWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam);
-    return new LRESULT (hittest);
+    return cast(LRESULT) (hittest);
 }
 
 override LRESULT WM_NOTIFY (int wParam, int lParam) {
@@ -849,13 +846,13 @@
     * for this control.
     */
     LRESULT result = super.WM_NOTIFY (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     return LRESULT.ZERO;
 }
 
 override LRESULT WM_PARENTNOTIFY (int wParam, int lParam) {
     LRESULT result = super.WM_PARENTNOTIFY (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     /*
     * Feature in Windows.  Windows does not explicitly set the orientation of
     * the buddy control.  Instead, the orientation is inherited when WS_EX_LAYOUTRTL
@@ -871,9 +868,10 @@
         int code = wParam & 0xFFFF;
         switch (code) {
             case OS.WM_CREATE: {
-                int id = (wParam >> 16), hwnd = lParam;
+                int id = (wParam >> 16);
+                HWND hwnd = cast(HWND) lParam;
                 if (id is ID_UPDOWN) {
-                    int bits = OS.GetWindowLong (hwnd, OS.GWL_EXSTYLE);
+                    auto bits = OS.GetWindowLong (hwnd, OS.GWL_EXSTYLE);
                     OS.SetWindowLong (hwnd, OS.GWL_EXSTYLE, bits | OS.WS_EX_LAYOUTRTL);
                 }
                 break;
@@ -906,10 +904,10 @@
 
 override LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) {
     LRESULT result = super.WM_WINDOWPOSCHANGING (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     if (!OS.IsWindowVisible (handle)) return result;
-    WINDOWPOS lpwp = new WINDOWPOS ();
-    OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof);
+    WINDOWPOS* lpwp = cast(WINDOWPOS*)lParam;
+    //OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof);
     if ((lpwp.flags & (OS.SWP_NOSIZE | OS.SWP_NOREDRAW)) !is 0) {
         return result;
     }
@@ -923,37 +921,37 @@
         OS.InvalidateRect (handle, null, true);
         return result;
     }
-    RECT rect = new RECT ();
-    OS.SetRect (rect, 0, 0, lpwp.cx, lpwp.cy);
-    OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, rect);
+    RECT rect;
+    OS.SetRect (&rect, 0, 0, lpwp.cx, lpwp.cy);
+    OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, &rect);
     int newWidth = rect.right - rect.left;
     int newHeight = rect.bottom - rect.top;
-    OS.GetClientRect (handle, rect);
+    OS.GetClientRect (handle, &rect);
     int oldWidth = rect.right - rect.left;
     int oldHeight = rect.bottom - rect.top;
     if (newWidth is oldWidth && newHeight is oldHeight) {
         return result;
     }
-    RECT inset = new RECT ();
-    OS.SendMessage (handle, OS.TCM_ADJUSTRECT, 0, inset);
+    RECT inset;
+    OS.SendMessage (handle, OS.TCM_ADJUSTRECT, 0, &inset);
     int marginX = -inset.right, marginY = -inset.bottom;
     if (newWidth !is oldWidth) {
         int left = oldWidth;
         if (newWidth < oldWidth) left = newWidth;
-        OS.SetRect (rect, left - marginX, 0, newWidth, newHeight);
-        OS.InvalidateRect (handle, rect, true);
+        OS.SetRect (&rect, left - marginX, 0, newWidth, newHeight);
+        OS.InvalidateRect (handle, &rect, true);
     }
     if (newHeight !is oldHeight) {
         int bottom = oldHeight;
         if (newHeight < oldHeight) bottom = newHeight;
         if (newWidth < oldWidth) oldWidth -= marginX;
-        OS.SetRect (rect, 0, bottom - marginY, oldWidth, newHeight);
-        OS.InvalidateRect (handle, rect, true);
+        OS.SetRect (&rect, 0, bottom - marginY, oldWidth, newHeight);
+        OS.InvalidateRect (handle, &rect, true);
     }
     return result;
 }
 
-override LRESULT wmNotifyChild (NMHDR hdr, int wParam, int lParam) {
+override LRESULT wmNotifyChild (NMHDR* hdr, int wParam, int lParam) {
     int code = hdr.code;
     switch (code) {
         case OS.TCN_SELCHANGE:
@@ -980,4 +978,4 @@
 }
 
 }
-++/
+
--- a/dwt/widgets/TabItem.d	Mon Feb 04 15:39:21 2008 +0100
+++ b/dwt/widgets/TabItem.d	Mon Feb 04 16:26:54 2008 +0100
@@ -10,22 +10,17 @@
  *******************************************************************************/
 module dwt.widgets.TabItem;
 
-import dwt.widgets.Item;
-import dwt.widgets.Widget;
-
-class TabItem : Item {
-    public this (Widget parent, int style) {
-        super (parent, style);
-    }
-}
-/++
-
 import dwt.DWT;
 import dwt.DWTException;
 import dwt.graphics.Image;
 import dwt.internal.win32.OS;
-import dwt.internal.win32.TCHAR;
-import dwt.internal.win32.TCITEM;
+
+import dwt.widgets.Item;
+import dwt.widgets.Widget;
+import dwt.widgets.TabFolder;
+import dwt.widgets.Control;
+
+import dwt.dwthelper.utils;
 
 /**
  * Instances of this class represent a selectable user interface object
@@ -41,10 +36,10 @@
  * </p>
  */
 
-public class TabItem extends Item {
+public class TabItem : Item {
     TabFolder parent;
     Control control;
-    String toolTipText;
+    char[] toolTipText;
 
 /**
  * Constructs a new instance of this class given its parent
@@ -76,7 +71,7 @@
  * @see Widget#checkSubclass
  * @see Widget#getStyle
  */
-public TabItem (TabFolder parent, int style) {
+public this (TabFolder parent, int style) {
     super (parent, style);
     this.parent = parent;
     parent.createItem (this, parent.getItemCount ());
@@ -114,13 +109,13 @@
  * @see Widget#checkSubclass
  * @see Widget#getStyle
  */
-public TabItem (TabFolder parent, int style, int index) {
+public this (TabFolder parent, int style, int index) {
     super (parent, style);
     this.parent = parent;
     parent.createItem (this, index);
 }
 
-void _setText (int index, String string) {
+void _setText (int index, char[] string) {
     /*
     * Bug in Windows.  In version 6.00 of COMCTL32.DLL, tab
     * items with an image and a label that includes '&' cause
@@ -130,26 +125,26 @@
     */
     if (OS.COMCTL32_MAJOR >= 6 && image !is null) {
         if (string.indexOf ('&') !is -1) {
-            int length = string.length ();
-            char[] text = new char [length];
-            string.getChars ( 0, length, text, 0);
+            int length_ = string.length ;
+            char[] text = new char [length_];
+            string.getChars ( 0, length_, text, 0);
             int i = 0, j = 0;
-            for (i=0; i<length; i++) {
+            for (i=0; i<length_; i++) {
                 if (text[i] !is '&') text [j++] = text [i];
             }
-            if (j < i) string = new String (text, 0, j);
+            if (j < i) string = text[ 0 .. j ].dup;
         }
     }
-    int hwnd = parent.handle;
-    int hHeap = OS.GetProcessHeap ();
-    TCHAR buffer = new TCHAR (parent.getCodePage (), string, true);
-    int byteCount = buffer.length () * TCHAR.sizeof;
-    int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
-    OS.MoveMemory (pszText, buffer, byteCount);
-    TCITEM tcItem = new TCITEM ();
+    auto hwnd = parent.handle;
+    auto hHeap = OS.GetProcessHeap ();
+    TCHAR[] buffer = StrToTCHARs (parent.getCodePage (), string, true);
+    int byteCount = buffer.length  * TCHAR.sizeof;
+    auto pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
+    OS.MoveMemory (pszText, buffer.ptr, byteCount);
+    TCITEM tcItem;
     tcItem.mask = OS.TCIF_TEXT;
     tcItem.pszText = pszText;
-    OS.SendMessage (hwnd, OS.TCM_SETITEM, index, tcItem);
+    OS.SendMessage (hwnd, OS.TCM_SETITEM, index, &tcItem);
     OS.HeapFree (hHeap, 0, pszText);
 }
 
@@ -205,7 +200,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public String getToolTipText () {
+public char[] getToolTipText () {
     checkWidget();
     return toolTipText;
 }
@@ -282,11 +277,11 @@
     if (OS.COMCTL32_MAJOR >= 6) {
         if (text.indexOf ('&') !is -1) _setText (index, text);
     }
-    int hwnd = parent.handle;
-    TCITEM tcItem = new TCITEM ();
+    auto hwnd = parent.handle;
+    TCITEM tcItem;
     tcItem.mask = OS.TCIF_IMAGE;
     tcItem.iImage = parent.imageIndex (image);
-    OS.SendMessage (hwnd, OS.TCM_SETITEM, index, tcItem);
+    OS.SendMessage (hwnd, OS.TCM_SETITEM, index, &tcItem);
 }
 /**
  * Sets the receiver's text.  The string may include
@@ -314,10 +309,10 @@
  * </ul>
  *
  */
-override public void setText (String string) {
+override public void setText (char[] string) {
     checkWidget();
     if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
-    if (string.equals (text)) return;
+    if (string ==/*eq*/text ) return;
     int index = parent.indexOf (this);
     if (index is -1) return;
     super.setText (string);
@@ -335,10 +330,10 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public void setToolTipText (String string) {
+public void setToolTipText (char[] string) {
     checkWidget();
     toolTipText = string;
 }
 
 }
-++/
+