diff dwt/widgets/Scrollable.d @ 108:6f75fdfa1bcd

Change LRESULT to class, like done in the old DWT.
author Frank Benoit <benoit@tionex.de>
date Mon, 11 Feb 2008 02:44:32 +0100
parents 3926f6c95d6f
children ab60f3309436
line wrap: on
line diff
--- a/dwt/widgets/Scrollable.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Scrollable.d	Mon Feb 11 02:44:32 2008 +0100
@@ -88,9 +88,9 @@
     super (parent, style);
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
-    return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
+    return OS.DefWindowProc (hwnd, msg, wParam, lParam);
 }
 
 /**
@@ -261,7 +261,7 @@
 override LRESULT WM_HSCROLL (int wParam, int lParam) {
 trc(__LINE__);
     LRESULT result = super.WM_HSCROLL (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
 
     /*
     * Bug on WinCE.  lParam should be NULL when the message is not sent
@@ -279,7 +279,7 @@
 override LRESULT WM_MOUSEWHEEL (int wParam, int lParam) {
 trc(__LINE__);
     LRESULT result = super.WM_MOUSEWHEEL (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
 
     /*
     * Translate WM_MOUSEWHEEL to WM_VSCROLL or WM_HSCROLL.
@@ -326,7 +326,7 @@
     */
     int vPosition = verticalBar is null ? 0 : verticalBar.getSelection ();
     int hPosition = horizontalBar is null ? 0 : horizontalBar.getSelection ();
-    LRESULT code = callWindowProc (handle, OS.WM_MOUSEWHEEL, wParam, lParam);
+    int code = callWindowProc (handle, OS.WM_MOUSEWHEEL, wParam, lParam);
     if (verticalBar !is null) {
         int position = verticalBar.getSelection ();
         if (position !is vPosition) {
@@ -343,23 +343,22 @@
             horizontalBar.sendEvent (DWT.Selection, event);
         }
     }
-    return code;
+    return new LRESULT (code);
 }
 
 override LRESULT WM_SIZE (int wParam, int lParam) {
 trc(__LINE__);
-    LRESULT code = callWindowProc (handle, OS.WM_SIZE, wParam, lParam);
-    assert( code !is LRESULT.NULL );
+    int code = callWindowProc (handle, OS.WM_SIZE, wParam, lParam);
     super.WM_SIZE (wParam, lParam);
     // widget may be disposed at this point
     if (code is 0) return LRESULT.ZERO;
-    return code;
+    return new LRESULT (code);
 }
 
 override LRESULT WM_VSCROLL (int wParam, int lParam) {
 trc(__LINE__);
     LRESULT result = super.WM_VSCROLL (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Bug on WinCE.  lParam should be NULL when the message is not sent
     * by a scroll bar control, but it contains the handle to the window.
@@ -375,7 +374,7 @@
 
 LRESULT wmScroll (ScrollBar bar, bool update, HWND hwnd, int msg, int wParam, int lParam) {
 trc(__LINE__);
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     if (update) {
         int type = msg is OS.WM_HSCROLL ? OS.SB_HORZ : OS.SB_VERT;
         SCROLLINFO info;
@@ -385,7 +384,7 @@
         info.fMask = OS.SIF_POS;
         int code = wParam & 0xFFFF;
         switch (code) {
-            case OS.SB_ENDSCROLL:  return LRESULT.NULL;
+            case OS.SB_ENDSCROLL:  return null;
             case OS.SB_THUMBPOSITION:
             case OS.SB_THUMBTRACK:
                 /*
@@ -420,8 +419,8 @@
         }
         OS.SetScrollInfo (hwnd, type, &info, true);
     } else {
-        LRESULT code = callWindowProc (hwnd, msg, wParam, lParam);
-        result = code is 0 ? LRESULT.ZERO : code;
+        int code = callWindowProc (hwnd, msg, wParam, lParam);
+        result = code is 0 ? LRESULT.ZERO : new LRESULT (code);
     }
     bar.wmScrollChild (wParam, lParam);
     return result;