changeset 118:521e2e00d10f

fix Shell and compile error in Table
author Frank Benoit <benoit@tionex.de>
date Mon, 11 Feb 2008 04:29:32 +0100
parents 25f88bf5a6df
children 74cf1077ac58
files dwt/widgets/Shell.d dwt/widgets/Table.d
diffstat 2 files changed, 33 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/widgets/Shell.d	Mon Feb 11 04:18:24 2008 +0100
+++ b/dwt/widgets/Shell.d	Mon Feb 11 04:29:32 2008 +0100
@@ -479,31 +479,31 @@
     return balloonTipHandle_;
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
     if (hwnd is toolTipHandle_ || hwnd is balloonTipHandle_) {
-        return cast(LRESULT) ToolTipProc( hwnd, msg, wParam, lParam);
+        return OS.CallWindowProc (ToolTipProc, hwnd, msg, wParam, lParam);
     }
     if (hwndMDIClient_ !is null) {
-        return cast(LRESULT) OS.DefFrameProc (hwnd, hwndMDIClient_, msg, wParam, lParam);
+        return OS.DefFrameProc (hwnd, hwndMDIClient_, msg, wParam, lParam);
     }
     if (windowProc_ !is null) {
-        return cast(LRESULT) windowProc_( hwnd, msg, wParam, lParam);
+        return OS.CallWindowProc (windowProc_, hwnd, msg, wParam, lParam);
     }
     if ((style & DWT.TOOL) !is 0) {
         int trim = DWT.TITLE | DWT.CLOSE | DWT.MIN | DWT.MAX | DWT.BORDER | DWT.RESIZE;
-        if ((style & trim) is 0) return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
+        if ((style & trim) is 0) return OS.DefWindowProc (hwnd, msg, wParam, lParam);
     }
     if (parent !is null) {
         switch (msg) {
             case OS.WM_KILLFOCUS:
             case OS.WM_SETFOCUS:
-                return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
+                return OS.DefWindowProc (hwnd, msg, wParam, lParam);
             default:
         }
-        return cast(LRESULT) DialogProc( hwnd, msg, wParam, lParam);
+        return OS.CallWindowProc (DialogProc, hwnd, msg, wParam, lParam);
     }
-    return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
+    return OS.DefWindowProc (hwnd, msg, wParam, lParam);
 }
 
 /**
@@ -1957,7 +1957,7 @@
 
 override LRESULT WM_ERASEBKGND (int wParam, int lParam) {
     LRESULT result = super.WM_ERASEBKGND (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  When a shell is resized by dragging
     * the resize handles, Windows temporarily fills in black
@@ -1975,7 +1975,7 @@
 
 override LRESULT WM_ENTERIDLE (int wParam, int lParam) {
     LRESULT result = super.WM_ENTERIDLE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     static if (OS.IsWinCE) {
         if (display.runMessages) {
             if (display.runAsyncMessages (true)) display.wakeThread ();
@@ -1986,7 +1986,7 @@
 
 override LRESULT WM_GETMINMAXINFO (int wParam, int lParam) {
     LRESULT result = super.WM_GETMINMAXINFO (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (minWidth !is DWT.DEFAULT || minHeight !is DWT.DEFAULT) {
         MINMAXINFO* info = cast(MINMAXINFO*)lParam;
         //OS.MoveMemory (info, lParam, MINMAXINFO.sizeof);
@@ -2000,7 +2000,7 @@
 
 override LRESULT WM_MOUSEACTIVATE (int wParam, int lParam) {
     LRESULT result = super.WM_MOUSEACTIVATE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
 
     /*
     * Check for WM_MOUSEACTIVATE when an MDI shell is active
@@ -2023,17 +2023,17 @@
                     display.lastHittestControl = null;
                     if (hittest is OS.HTMENU || hittest is OS.HTSYSMENU) {
                         display.lastHittestControl = control;
-                        return LRESULT.NULL;
+                        return null;
                     }
                     if (OS.IsWin95 && hittest is OS.HTCAPTION) {
                         display.lastHittestControl = control;
                     }
-                    return cast( LRESULT )(OS.MA_NOACTIVATE);
+                    return new LRESULT (OS.MA_NOACTIVATE);
                 }
             }
         }
     }
-    if (hittest is OS.HTMENU) return LRESULT.NULL;
+    if (hittest is OS.HTMENU) return null;
 
     /*
     * Get the current location of the cursor,
@@ -2054,7 +2054,7 @@
         pt.y = cast(short) (pos >> 16);
     }
     auto hwnd = OS.WindowFromPoint (pt);
-    if (hwnd is null) return LRESULT.NULL;
+    if (hwnd is null) return null;
     Control control = display.findControl (hwnd);
 
     /*
@@ -2068,19 +2068,19 @@
             int bits = DWT.ON_TOP | DWT.NO_FOCUS;
             if ((style & bits) is bits) {
                 if (hittest is OS.HTBORDER || hittest is OS.HTCLIENT) {
-                    return cast( LRESULT )(OS.MA_NOACTIVATE);
+                    return new LRESULT (OS.MA_NOACTIVATE);
                 }
             }
         }
     }
 
     setActiveControl (control);
-    return LRESULT.NULL;
+    return null;
 }
 
 override LRESULT WM_MOVE (int wParam, int lParam) {
     LRESULT result = super.WM_MOVE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     ToolTip tip = getCurrentToolTip ();
     if (tip !is null) tip.setVisible (false);
     return result;
@@ -2103,24 +2103,24 @@
 }
 
 override LRESULT WM_NCHITTEST (int wParam, int lParam) {
-    if (!OS.IsWindowEnabled (handle)) return LRESULT.NULL;
+    if (!OS.IsWindowEnabled (handle)) return null;
     if (!isEnabled () || !isActive ()) {
-        if (!Display.TrimEnabled) return cast( LRESULT )(OS.HTNOWHERE);
+        if (!Display.TrimEnabled) return new LRESULT (OS.HTNOWHERE);
         int hittest = callWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam);
         if (hittest is OS.HTCLIENT || hittest is OS.HTMENU) hittest = OS.HTBORDER;
-        return cast( LRESULT )(hittest);
+        return new LRESULT (hittest);
     }
     if (menuBar !is null && !menuBar.getEnabled ()) {
         int hittest = callWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam);
         if (hittest is OS.HTMENU) hittest = OS.HTBORDER;
-        return cast( LRESULT )(hittest);
+        return new LRESULT (hittest);
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 override LRESULT WM_NCLBUTTONDOWN (int wParam, int lParam) {
     LRESULT result = super.WM_NCLBUTTONDOWN (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * When the normal activation was interrupted in WM_MOUSEACTIVATE
     * because the active shell was an MDI shell, set the active window
@@ -2143,7 +2143,7 @@
     }
     display.lastHittestControl = null;
     display.ignoreRestoreFocus = false;
-    return cast( LRESULT )(code);
+    return new LRESULT (code);
 }
 
 override LRESULT WM_PALETTECHANGED (int wParam, int lParam) {
@@ -2236,7 +2236,7 @@
 
 override LRESULT WM_SETTINGCHANGE (int wParam, int lParam) {
     LRESULT result = super.WM_SETTINGCHANGE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     static if (OS.IsPPC) {
         if (wParam is OS.SPI_SETSIPINFO) {
             /*
@@ -2261,7 +2261,7 @@
 
 override LRESULT WM_SHOWWINDOW (int wParam, int lParam) {
     LRESULT result = super.WM_SHOWWINDOW (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Bug in Windows.  If the shell is hidden while the parent
     * is iconic,  Windows shows the shell when the parent is
@@ -2283,7 +2283,7 @@
 
 override LRESULT WM_SYSCOMMAND (int wParam, int lParam) {
     LRESULT result = super.WM_SYSCOMMAND (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  When the last visible window in
     * a process minimized, Windows swaps out the memory for
@@ -2318,7 +2318,7 @@
 
 override LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) {
     LRESULT result = super.WM_WINDOWPOSCHANGING (wParam,lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     auto lpwp = cast(WINDOWPOS*)lParam;
     //OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof);
     if ((lpwp.flags & OS.SWP_NOSIZE) is 0) {
--- a/dwt/widgets/Table.d	Mon Feb 11 04:18:24 2008 +0100
+++ b/dwt/widgets/Table.d	Mon Feb 11 04:29:32 2008 +0100
@@ -3743,6 +3743,7 @@
     static if (OS.IsWinCE) {
         flags |= OS.ILC_COLOR;
     } else {
+        {// new scope for hDC
         auto hDC = OS.GetDC (handle);
         auto bits = OS.GetDeviceCaps (hDC, OS.BITSPIXEL);
         auto planes = OS.GetDeviceCaps (hDC, OS.PLANES);
@@ -3756,6 +3757,7 @@
             case 32: flags |= OS.ILC_COLOR32; break;
             default: flags |= OS.ILC_COLOR; break;
         }
+        }
     }
     if ((style & DWT.RIGHT_TO_LEFT) !is 0) flags |= OS.ILC_MIRROR;
     if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) flags |= OS.ILC_MASK;