changeset 52:0553f4e8ed93

Link
author Frank Benoit <benoit@tionex.de>
date Sun, 03 Feb 2008 05:06:44 +0100
parents 6e4e3a8e4971
children 0405e18fec7f
files dwt/accessibility/Accessible.d dwt/dwthelper/utils.d dwt/internal/win32/OS.d dwt/internal/win32/WINTYPES.d dwt/widgets/Control.d dwt/widgets/Link.d
diffstat 6 files changed, 198 insertions(+), 116 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/accessibility/Accessible.d	Sun Feb 03 03:43:52 2008 +0100
+++ b/dwt/accessibility/Accessible.d	Sun Feb 03 05:06:44 2008 +0100
@@ -14,12 +14,76 @@
 
 import dwt.widgets.Control;
 //PORTING_TYPE
-public class Accessible {
+import dwt.accessibility.Accessible;
+import dwt.accessibility.AccessibleControlListener;
+import dwt.accessibility.AccessibleListener;
+import dwt.accessibility.AccessibleTextListener;
+import dwt.widgets.Control;
+class  Accessible {
     public static Accessible internal_new_Accessible(Control control) ;
-    public void internal_dispose_Accessible() ;
-    public int /*long*/ internal_WM_GETOBJECT (int /*long*/ wParam, int /*long*/ lParam) ;
+    int AddRef();
+    int Release();
+    int QueryInterface(int, int);
+    void checkWidget();
+    void setFocus(int);
+    void internal_dispose_Accessible();
+    int internal_WM_GETOBJECT(int, int);
+    bool isValidThread();
+    int Next(int, int, int);
+    int Skip(int);
+    void addAccessibleListener(AccessibleListener);
+    void addAccessibleControlListener(AccessibleControlListener);
+    void addAccessibleTextListener(AccessibleTextListener);
+    void removeAccessibleListener(AccessibleListener);
+    void removeAccessibleControlListener(AccessibleControlListener);
+    void removeAccessibleTextListener(AccessibleTextListener);
+    int childIDToOs(int);
+    void textCaretMoved(int);
+    void textChanged(int, int, int);
+    void textSelectionChanged();
+    int accDoDefaultAction(int);
+    int accHitTest(int, int, int);
+    int accLocation(int, int, int, int, int);
+    int osToChildID(int);
+    int accNavigate(int, int, int);
+    int accSelect(int, int);
+    int get_accChild(int, int);
+    int get_accChildCount(int);
+    int get_accDefaultAction(int, int);
+    int get_accDescription(int, int);
+    int get_accFocus(int);
+    int get_accHelp(int, int);
+    int get_accHelpTopic(int, int, int);
+    int get_accKeyboardShortcut(int, int);
+    int get_accName(int, int);
+    int get_accParent(int);
+    int get_accRole(int, int);
+    int osToRole(int);
+    int roleToOs(int);
+    int get_accSelection(int);
+    int get_accState(int, int);
+    int osToState(int);
+    int stateToOs(int);
+    int get_accValue(int, int);
+    int put_accName(int, int);
+    int put_accValue(int, int);
+    int Clone(int);
+    Control getControl();
+    void selectionChanged();
+    int Reset();
+    //int refCount;
+    //int enumIndex;
+    //COMObject objIAccessible;
+    //COMObject objIEnumVARIANT;
+    //IAccessible iaccessible;
+    //Vector accessibleListeners;
+    //Vector accessibleControlListeners;
+    //Vector textListeners;
+    //Object[] variants;
+    //Control control;
 }
 
+
 /++
 import dwt.DWT;
 import dwt.DWTException;
--- a/dwt/dwthelper/utils.d	Sun Feb 03 03:43:52 2008 +0100
+++ b/dwt/dwthelper/utils.d	Sun Feb 03 05:06:44 2008 +0100
@@ -59,6 +59,9 @@
     dchar[] r = tango.text.Unicode.toUpper( [c] );
     return r[0];
 }
+bool CharacterIsWhitespace( dchar c ){
+    return tango.text.Unicode.isWhitespace( c );
+}
 
 public int indexOf( char[] str, char searched ){
     int res = tango.text.Util.locate( str, searched );
--- a/dwt/internal/win32/OS.d	Sun Feb 03 03:43:52 2008 +0100
+++ b/dwt/internal/win32/OS.d	Sun Feb 03 05:06:44 2008 +0100
@@ -1957,11 +1957,11 @@
     public static const int VK_APP4 = 0xc4;
     public static const int VK_APP5 = 0xc5;
     public static const int VK_APP6 = 0xc6;
-    public static const char[] WC_HEADER = "SysHeader32"; //$NON-NLS-1$
-    public static const char[] WC_LINK = "SysLink"; //$NON-NLS-1$
-    public static const char[] WC_LISTVIEW = "SysListView32"; //$NON-NLS-1$
-    public static const char[] WC_TABCONTROL = "SysTabControl32"; //$NON-NLS-1$
-    public static const char[] WC_TREEVIEW = "SysTreeView32"; //$NON-NLS-1$
+    public static const TCHAR[] WC_HEADER = "SysHeader32"; //$NON-NLS-1$
+    public static const TCHAR[] WC_LINK = "SysLink"; //$NON-NLS-1$
+    public static const TCHAR[] WC_LISTVIEW = "SysListView32"; //$NON-NLS-1$
+    public static const TCHAR[] WC_TABCONTROL = "SysTabControl32"; //$NON-NLS-1$
+    public static const TCHAR[] WC_TREEVIEW = "SysTreeView32"; //$NON-NLS-1$
     public static const int WINDING = 2;
     public static const int WH_CBT = 5;
     public static const int WH_GETMESSAGE = 0x3;
--- a/dwt/internal/win32/WINTYPES.d	Sun Feb 03 03:43:52 2008 +0100
+++ b/dwt/internal/win32/WINTYPES.d	Sun Feb 03 05:06:44 2008 +0100
@@ -43,6 +43,20 @@
     RECT rcChild;
     RECT rcBand;
 }
+const int MAX_LINKID_TEXT = 48;
+const int L_MAX_URL_LENGTH = 2084;
+struct LITEM {
+    UINT mask;
+    int iLink;
+    UINT state;
+    UINT stateMask;
+    WCHAR szID[MAX_LINKID_TEXT];
+    WCHAR szUrl[L_MAX_URL_LENGTH];
+}
+struct NMLINK {
+    NMHDR hdr;
+    LITEM item;
+}
 // ....
 //--------------------------------------------------------------------------------
 
--- a/dwt/widgets/Control.d	Sun Feb 03 03:43:52 2008 +0100
+++ b/dwt/widgets/Control.d	Sun Feb 03 05:06:44 2008 +0100
@@ -48,6 +48,7 @@
 import dwt.widgets.TypedListener;
 import dwt.widgets.Listener;
 import dwt.widgets.Display;
+import dwt.widgets.Monitor;
 
 import dwt.dwthelper.utils;
 import dwt.dwthelper.System;
--- a/dwt/widgets/Link.d	Sun Feb 03 03:43:52 2008 +0100
+++ b/dwt/widgets/Link.d	Sun Feb 03 05:06:44 2008 +0100
@@ -12,10 +12,6 @@
  *******************************************************************************/
 module dwt.widgets.Link;
 
-import dwt.widgets.Control;
-class Link : Control {
-}
-/++
 import dwt.DWT;
 import dwt.DWTException;
 import dwt.accessibility.ACC;
@@ -35,15 +31,17 @@
 import dwt.graphics.Rectangle;
 import dwt.graphics.TextLayout;
 import dwt.graphics.TextStyle;
-import dwt.internal.win32.LITEM;
-import dwt.internal.win32.LRESULT;
-import dwt.internal.win32.NMHDR;
-import dwt.internal.win32.NMLINK;
 import dwt.internal.win32.OS;
-import dwt.internal.win32.PAINTSTRUCT;
-import dwt.internal.win32.RECT;
-import dwt.internal.win32.TCHAR;
-import dwt.internal.win32.WNDCLASS;
+
+import dwt.widgets.Control;
+import dwt.widgets.Composite;
+import dwt.widgets.TypedListener;
+import dwt.widgets.Event;
+
+import dwt.dwthelper.utils;
+
+static import tango.text.Text;
+alias tango.text.Text.Text!(char) StringBuffer;
 
 /**
  * Instances of this class represent a selectable
@@ -62,26 +60,27 @@
  *
  * @since 3.1
  */
-public class Link extends Control {
-    String text;
+public class Link : Control {
+    char[] text;
     TextLayout layout;
     Color linkColor, disabledColor;
     Point [] offsets;
     Point selection;
-    String [] ids;
+    char[] [] ids;
     int [] mnemonics;
     int focusIndex, mouseDownIndex;
-    int font;
-    static final RGB LINK_FOREGROUND = new RGB (0, 51, 153);
-    static final int LinkProc;
-    static final TCHAR LinkClass = new TCHAR (0, OS.WC_LINK, true);
-    static {
+    HFONT font;
+    static const RGB LINK_FOREGROUND;
+    static const WNDPROC LinkProc;
+    static const TCHAR[] LinkClass = OS.WC_LINK;
+    static this() {
+        LINK_FOREGROUND = new RGB (0, 51, 153);
         if (OS.COMCTL32_MAJOR >= 6) {
-            WNDCLASS lpWndClass = new WNDCLASS ();
-            OS.GetClassInfo (0, LinkClass, lpWndClass);
+            WNDCLASS lpWndClass;
+            OS.GetClassInfo (null, LinkClass.ptr, &lpWndClass);
             LinkProc = lpWndClass.lpfnWndProc;
         } else {
-            LinkProc = 0;
+            LinkProc = null;
         }
     }
 
@@ -112,7 +111,7 @@
  * @see Widget#checkSubclass
  * @see Widget#getStyle
  */
-public Link (Composite parent, int style) {
+public this (Composite parent, int style) {
     super (parent, style);
 }
 
@@ -148,10 +147,10 @@
     addListener (DWT.DefaultSelection, typedListener);
 }
 
-int callWindowProc (int hwnd, int msg, int wParam, int lParam) {
-    if (handle is 0) return 0;
-    if (LinkProc !is 0) return OS.CallWindowProc (LinkProc, hwnd, msg, wParam, lParam);
-    return OS.DefWindowProc (hwnd, msg, wParam, lParam);
+LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return LRESULT.NULL;
+    if (LinkProc !is null) return cast(LRESULT) OS.CallWindowProc (LinkProc, hwnd, msg, wParam, lParam);
+    return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
 }
 
 public Point computeSize (int wHint, int hHint, bool changed) {
@@ -160,20 +159,20 @@
     if (hHint !is DWT.DEFAULT && hHint < 0) hHint = 0;
     int width, height;
     if (OS.COMCTL32_MAJOR >= 6) {
-        int hDC = OS.GetDC (handle);
-        int newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
-        int oldFont = OS.SelectObject (hDC, newFont);
-        TCHAR buffer = new TCHAR (getCodePage (), parse (text), false);
-        RECT rect = new RECT ();
+        auto hDC = OS.GetDC (handle);
+        auto newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
+        auto oldFont = OS.SelectObject (hDC, newFont);
+        TCHAR[] buffer = StrToTCHARs (/+getCodePage (),+/ parse (text));
+        RECT rect;
         int flags = OS.DT_CALCRECT | OS.DT_NOPREFIX;
         if (wHint !is DWT.DEFAULT) {
             flags |= OS.DT_WORDBREAK;
             rect.right = wHint;
         }
-        OS.DrawText (hDC, buffer, buffer.length (), rect, flags);
+        OS.DrawText (hDC, buffer.ptr, buffer.length, &rect, flags);
         width = rect.right - rect.left;
         height = rect.bottom;
-        if (newFont !is 0) OS.SelectObject (hDC, oldFont);
+        if (newFont !is null) OS.SelectObject (hDC, oldFont);
         OS.ReleaseDC (handle, hDC);
     } else {
         int layoutWidth = layout.getWidth ();
@@ -211,7 +210,7 @@
         }
         disabledColor = Color.win32_new (display, OS.GetSysColor (OS.COLOR_GRAYTEXT));
         offsets = new Point [0];
-        ids = new String [0];
+        ids = new char[] [0];
         mnemonics = new int [0];
         selection = new Point (-1, -1);
         focusIndex = mouseDownIndex = -1;
@@ -229,7 +228,7 @@
     }
 }
 
-void drawWidget (GC gc, RECT rect) {
+void drawWidget (GC gc, RECT* rect) {
     drawBackground (gc.handle, rect);
     int selStart = selection.x;
     int selEnd = selection.y;
@@ -262,11 +261,11 @@
 
 void enableWidget (bool enabled) {
     if (OS.COMCTL32_MAJOR >= 6) {
-        LITEM item = new LITEM ();
+        LITEM item;
         item.mask = OS.LIF_ITEMINDEX | OS.LIF_STATE;
         item.stateMask = OS.LIS_ENABLED;
         item.state = enabled ? OS.LIS_ENABLED : 0;
-        while (OS.SendMessage (handle, OS.LM_SETITEM, 0, item) !is 0) {
+        while (OS.SendMessage (handle, OS.LM_SETITEM, 0, &item) !is 0) {
             item.iLink++;
         }
     } else {
@@ -290,13 +289,13 @@
 
 void initAccessible () {
     Accessible accessible = getAccessible ();
-    accessible.addAccessibleListener (new AccessibleAdapter () {
+    accessible.addAccessibleListener (new class() AccessibleAdapter {
         public void getName (AccessibleEvent e) {
             e.result = parse (text);
         }
     });
 
-    accessible.addAccessibleControlListener (new AccessibleControlAdapter () {
+    accessible.addAccessibleControlListener (new class() AccessibleControlAdapter {
         public void getChildAtPoint (AccessibleControlEvent e) {
             e.childID = ACC.CHILDID_SELF;
         }
@@ -336,7 +335,7 @@
     });
 }
 
-String getNameText () {
+char[] getNameText () {
     return getText ();
 }
 
@@ -380,23 +379,23 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public String getText () {
+public char[] getText () {
     checkWidget ();
     return text;
 }
 
-String parse (String string) {
-    int length = string.length ();
-    offsets = new Point [length / 4];
-    ids = new String [length / 4];
-    mnemonics = new int [length / 4 + 1];
+char[] parse (char[] string) {
+    int length_ = string.length;
+    offsets = new Point [length_ / 4];
+    ids = new char[] [length_ / 4];
+    mnemonics = new int [length_ / 4 + 1];
     StringBuffer result = new StringBuffer ();
-    char [] buffer = new char [length];
-    string.getChars (0, string.length (), buffer, 0);
+    char [] buffer = new char [length_];
+    string.getChars (0, string.length, buffer, 0);
     int index = 0, state = 0, linkIndex = 0;
     int start = 0, tagStart = 0, linkStart = 0, endtagStart = 0, refStart = 0;
-    while (index < length) {
-        char c = Character.toLowerCase (buffer [index]);
+    while (index < length_) {
+        char c = CharacterToLower (buffer [index]);
         switch (state) {
             case 0:
                 if (c is '<') {
@@ -417,7 +416,7 @@
                         state++;
                         break;
                     default:
-                        if (Character.isWhitespace(c)) break;
+                        if (CharacterIsWhitespace(c)) break;
                         else state = 13;
                 }
                 break;
@@ -436,11 +435,11 @@
             case 6:
                 if (c is '>') {
                     mnemonics [linkIndex] = parseMnemonics (buffer, start, tagStart, result);
-                    int offset = result.length ();
+                    int offset = result.length;
                     parseMnemonics (buffer, linkStart, endtagStart, result);
-                    offsets [linkIndex] = new Point (offset, result.length () - 1);
+                    offsets [linkIndex] = new Point (offset, result.length - 1);
                     if (ids [linkIndex] is null) {
-                        ids [linkIndex] = new String (buffer, linkStart, endtagStart - linkStart);
+                        ids [linkIndex] = buffer[ linkStart .. endtagStart - linkStart ].dup;
                     }
                     linkIndex++;
                     start = tagStart = linkStart = endtagStart = refStart = index + 1;
@@ -471,12 +470,12 @@
                 break;
             case 12:
                 if (c is '"') {
-                    ids[linkIndex] = new String (buffer, refStart, index - refStart);
+                    ids[linkIndex] = buffer[ refStart .. index - refStart ].dup;
                     state = 2;
                 }
                 break;
             case 13:
-                if (Character.isWhitespace (c)) {
+                if (CharacterIsWhitespace (c)) {
                     state = 0;
                 } else if (c is '='){
                     state++;
@@ -494,7 +493,7 @@
         }
         index++;
     }
-    if (start < length) {
+    if (start < length_) {
         int tmp = parseMnemonics (buffer, start, tagStart, result);
         int mnemonic = parseMnemonics (buffer, linkStart, index, result);
         if (mnemonic is -1) mnemonic = tmp;
@@ -506,7 +505,7 @@
         Point [] newOffsets = new Point [linkIndex];
         System.arraycopy (offsets, 0, newOffsets, 0, linkIndex);
         offsets = newOffsets;
-        String [] newIDs = new String [linkIndex];
+        char[] [] newIDs = new char[] [linkIndex];
         System.arraycopy (ids, 0, newIDs, 0, linkIndex);
         ids = newIDs;
         int [] newMnemonics = new int [linkIndex + 1];
@@ -595,21 +594,21 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public void setText (String string) {
+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;
     text = string;
     if (OS.COMCTL32_MAJOR >= 6) {
-        bool enabled = OS.IsWindowEnabled (handle);
+        bool enabled = cast(bool) OS.IsWindowEnabled (handle);
         /*
         * Bug in Windows.  For some reason, when SetWindowText()
         * is used to set the text of a link control to the empty
         * string, the old text remains.  The fix is to set the
         * text to a space instead.
         */
-        if (string.length () is 0) string = " ";  //$NON-NLS-1$
-        TCHAR buffer = new TCHAR (getCodePage (), string, true);
+        if (string.length is 0) string = " ";  //$NON-NLS-1$
+        TCHAR* buffer = StrToTCHARz (/+getCodePage (),+/ string);
         OS.SetWindowText (handle, buffer);
         parse (text);
         enableWidget (enabled);
@@ -624,7 +623,7 @@
             bits &= ~OS.WS_TABSTOP;
         }
         OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
-        bool enabled = OS.IsWindowEnabled (handle);
+        bool enabled = cast(bool) OS.IsWindowEnabled (handle);
         TextStyle linkStyle = new TextStyle (null, enabled ? linkColor : disabledColor, null);
         linkStyle.underline = true;
         for (int i = 0; i < offsets.length; i++) {
@@ -648,17 +647,17 @@
     return bits | OS.WS_TABSTOP;
 }
 
-TCHAR windowClass () {
-    return OS.COMCTL32_MAJOR >= 6 ? LinkClass : display.windowClass;
+char[] windowClass () {
+    return OS.COMCTL32_MAJOR >= 6 ? TCHARsToStr(LinkClass) : display.windowClass();
 }
 
 int windowProc () {
-    return LinkProc !is 0 ? LinkProc : display.windowProc;
+    return LinkProc !is null ? cast(int)LinkProc : display.windowProc();
 }
 
 LRESULT WM_CHAR (int wParam, int lParam) {
     LRESULT result = super.WM_CHAR (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     if (OS.COMCTL32_MAJOR < 6) {
         if (focusIndex is -1) return result;
         switch (wParam) {
@@ -695,7 +694,7 @@
                 * performed in WM_KEYDOWN from WM_CHAR.
                 */
                 int code = callWindowProc (handle, OS.WM_KEYDOWN, wParam, lParam);
-                return new LRESULT (code);
+                return cast(LRESULT) (code);
         }
 
     }
@@ -704,14 +703,14 @@
 
 LRESULT WM_GETDLGCODE (int wParam, int lParam) {
     LRESULT result = super.WM_GETDLGCODE (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     int index, count, code = 0;
     if (OS.COMCTL32_MAJOR >= 6) {
-        LITEM item = new LITEM ();
+        LITEM item;
         item.mask = OS.LIF_ITEMINDEX | OS.LIF_STATE;
         item.stateMask = OS.LIS_FOCUSED;
         index = 0;
-        while (OS.SendMessage (handle, OS.LM_GETITEM, 0, item) !is 0) {
+        while (OS.SendMessage (handle, OS.LM_GETITEM, 0, &item) !is 0) {
             if ((item.state & OS.LIS_FOCUSED) !is 0) {
                 index = item.iLink;
             }
@@ -724,30 +723,30 @@
         count = offsets.length;
     }
     if (count is 0) {
-        return new LRESULT (code | OS.DLGC_STATIC);
+        return cast(LRESULT) (code | OS.DLGC_STATIC);
     }
     bool next = OS.GetKeyState (OS.VK_SHIFT) >= 0;
     if (next && index < count - 1) {
-        return new LRESULT (code | OS.DLGC_WANTTAB);
+        return cast(LRESULT) (code | OS.DLGC_WANTTAB);
     }
     if (!next && index > 0) {
-        return new LRESULT (code | OS.DLGC_WANTTAB);
+        return cast(LRESULT) (code | OS.DLGC_WANTTAB);
     }
     return result;
 }
 
 LRESULT WM_GETFONT (int wParam, int lParam) {
     LRESULT result = super.WM_GETFONT (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     int code = callWindowProc (handle, OS.WM_GETFONT, wParam, lParam);
-    if (code !is 0) return new LRESULT (code);
-    if (font is 0) font = defaultFont ();
-    return new LRESULT (font);
+    if (code !is 0) return cast(LRESULT) (code);
+    if (font is null) font = defaultFont ();
+    return cast(LRESULT) (font);
 }
 
 LRESULT WM_KEYDOWN (int wParam, int lParam) {
     LRESULT result = super.WM_KEYDOWN (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     if (OS.COMCTL32_MAJOR >= 6) {
         switch (wParam) {
             case OS.VK_SPACE:
@@ -870,18 +869,18 @@
     if (OS.COMCTL32_MAJOR >= 6) {
         return super.WM_PAINT (wParam, lParam);
     }
-    PAINTSTRUCT ps = new PAINTSTRUCT ();
+    PAINTSTRUCT ps;
     GCData data = new GCData ();
-    data.ps = ps;
+    data.ps = &ps;
     data.hwnd = handle;
     GC gc = new_GC (data);
     if (gc !is null) {
-        int width = ps.right - ps.left;
-        int height = ps.bottom - ps.top;
+        int width = ps.rcPaint.right - ps.rcPaint.left;
+        int height = ps.rcPaint.bottom - ps.rcPaint.top;
         if (width !is 0 && height !is 0) {
-            RECT rect = new RECT ();
-            OS.SetRect (rect, ps.left, ps.top, ps.right, ps.bottom);
-            drawWidget (gc, rect);
+            RECT rect;
+            OS.SetRect (&rect, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom);
+            drawWidget (gc, &rect);
         }
         gc.dispose ();
     }
@@ -891,13 +890,13 @@
 LRESULT WM_PRINTCLIENT (int wParam, int lParam) {
     LRESULT result = super.WM_PRINTCLIENT (wParam, lParam);
     if (OS.COMCTL32_MAJOR < 6) {
-        RECT rect = new RECT ();
-        OS.GetClientRect (handle, rect);
+        RECT rect;
+        OS.GetClientRect (handle, &rect);
         GCData data = new GCData ();
         data.device = display;
         data.foreground = getForegroundPixel ();
-        GC gc = GC.win32_new (wParam, data);
-        drawWidget (gc, rect);
+        GC gc = GC.win32_new (cast(HANDLE)wParam, data);
+        drawWidget (gc, &rect);
         gc.dispose ();
     }
     return result;
@@ -911,17 +910,18 @@
 
 LRESULT WM_SETFONT (int wParam, int lParam) {
     if (OS.COMCTL32_MAJOR < 6) {
-        layout.setFont (Font.win32_new (display, wParam));
+        layout.setFont (Font.win32_new (display, cast(HANDLE)wParam));
     }
     if (lParam !is 0) OS.InvalidateRect (handle, null, true);
-    return super.WM_SETFONT (font = wParam, lParam);
+    font = cast(HFONT) wParam;
+    return super.WM_SETFONT (wParam, lParam);
 }
 
 LRESULT WM_SIZE (int wParam, int lParam) {
     LRESULT result = super.WM_SIZE (wParam, lParam);
     if (OS.COMCTL32_MAJOR < 6) {
-        RECT rect = new RECT ();
-        OS.GetClientRect (handle, rect);
+        RECT rect;
+        OS.GetClientRect (handle, &rect);
         layout.setWidth (rect.right > 0 ? rect.right : -1);
         redraw ();
     }
@@ -937,32 +937,32 @@
     */
     if (OS.COMCTL32_MAJOR >= 6) {
         if (!OS.IsWindowEnabled (handle)) {
-            OS.SetTextColor (wParam, OS.GetSysColor (OS.COLOR_GRAYTEXT));
-            if (result is null) {
+            OS.SetTextColor (cast(HANDLE)wParam, OS.GetSysColor (OS.COLOR_GRAYTEXT));
+            if (result is LRESULT.NULL) {
                 int backPixel = getBackgroundPixel ();
-                OS.SetBkColor (wParam, backPixel);
-                int hBrush = findBrush (backPixel, OS.BS_SOLID);
-                return new LRESULT (hBrush);
+                OS.SetBkColor (cast(HANDLE)wParam, backPixel);
+                auto hBrush = findBrush (backPixel, OS.BS_SOLID);
+                return cast(LRESULT) (hBrush);
             }
         }
     }
     return result;
 }
 
-LRESULT wmNotifyChild (NMHDR hdr, int wParam, int lParam) {
+LRESULT wmNotifyChild (NMHDR* hdr, int wParam, int lParam) {
     if (OS.COMCTL32_MAJOR >= 6) {
         switch (hdr.code) {
             case OS.NM_RETURN:
             case OS.NM_CLICK:
-                NMLINK item = new NMLINK ();
-                OS.MoveMemory (item, lParam, NMLINK.sizeof);
+                NMLINK* item = cast(NMLINK*)lParam;
+                //OS.MoveMemory (item, lParam, NMLINK.sizeof);
                 Event event = new Event ();
-                event.text = ids [item.iLink];
+                event.text = ids [item.item.iLink];
                 sendEvent (DWT.Selection, event);
                 break;
         }
     }
-    return super.wmNotifyChild (hdr, wParam, lParam);
+    return cast(LRESULT) super.wmNotifyChild (hdr, wParam, lParam);
 }
 }
-++/
+