diff dwt/widgets/Shell.d @ 117:25f88bf5a6df

Only one file was damaged Backed out changeset 640928daee8c
author Frank Benoit <benoit@tionex.de>
date Mon, 11 Feb 2008 04:18:24 +0100
parents 640928daee8c
children 521e2e00d10f
line wrap: on
line diff
--- a/dwt/widgets/Shell.d	Mon Feb 11 04:05:55 2008 +0100
+++ b/dwt/widgets/Shell.d	Mon Feb 11 04:18:24 2008 +0100
@@ -479,31 +479,31 @@
     return balloonTipHandle_;
 }
 
-override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return 0;
+override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return LRESULT.ZERO;
     if (hwnd is toolTipHandle_ || hwnd is balloonTipHandle_) {
-        return OS.CallWindowProc (ToolTipProc, hwnd, msg, wParam, lParam);
+        return cast(LRESULT) ToolTipProc( hwnd, msg, wParam, lParam);
     }
     if (hwndMDIClient_ !is null) {
-        return OS.DefFrameProc (hwnd, hwndMDIClient_, msg, wParam, lParam);
+        return cast(LRESULT) OS.DefFrameProc (hwnd, hwndMDIClient_, msg, wParam, lParam);
     }
     if (windowProc_ !is null) {
-        return OS.CallWindowProc (windowProc_, hwnd, msg, wParam, lParam);
+        return cast(LRESULT) 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 OS.DefWindowProc (hwnd, msg, wParam, lParam);
+        if ((style & trim) is 0) return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
     }
     if (parent !is null) {
         switch (msg) {
             case OS.WM_KILLFOCUS:
             case OS.WM_SETFOCUS:
-                return OS.DefWindowProc (hwnd, msg, wParam, lParam);
+                return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
             default:
         }
-        return OS.CallWindowProc (DialogProc, hwnd, msg, wParam, lParam);
+        return cast(LRESULT) DialogProc( hwnd, msg, wParam, lParam);
     }
-    return OS.DefWindowProc (hwnd, msg, wParam, lParam);
+    return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
 }
 
 /**
@@ -586,7 +586,7 @@
     if (!embedded) {
         int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
         bits &= ~(OS.WS_OVERLAPPED | OS.WS_CAPTION);
-        if (!OS.IsWinCE) bits |= OS.WS_POPUP;
+        static if (!OS.IsWinCE) bits |= OS.WS_POPUP;
         if ((style & DWT.TITLE) !is 0) bits |= OS.WS_CAPTION;
         if ((style & DWT.NO_TRIM) is 0) {
             if ((style & (DWT.BORDER | DWT.RESIZE)) is 0) bits |= OS.WS_BORDER;
@@ -624,7 +624,7 @@
     }
     toolTips [id] = toolTip;
     toolTip.id = id + Display.ID_START;
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     TOOLINFO lpti;
     lpti.cbSize = TOOLINFO.sizeof;
     lpti.hwnd = handle;
@@ -670,7 +670,7 @@
 void destroyToolTip (ToolTip toolTip) {
     if (toolTips is null) return;
     toolTips [toolTip.id - Display.ID_START] = null;
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     if (balloonTipHandle_ !is null) {
         TOOLINFO lpti;
         lpti.cbSize = TOOLINFO.sizeof;
@@ -866,7 +866,7 @@
 
 override public Rectangle getBounds () {
     checkWidget ();
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         if (OS.IsIconic (handle)) return super.getBounds ();
     }
     RECT rect;
@@ -1014,7 +1014,7 @@
 
 override public Point getSize () {
     checkWidget ();
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         if (OS.IsIconic (handle)) return super.getSize ();
     }
     RECT rect;
@@ -1127,7 +1127,7 @@
     * The workaround is to explicitly force the shell to
     * be the foreground window.
     */
-    if (OS.IsWinCE) OS.SetForegroundWindow (handle);
+    static if (OS.IsWinCE) OS.SetForegroundWindow (handle);
     OS.SendMessage (handle, OS.WM_CHANGEUISTATE, OS.UIS_INITIALIZE, 0);
     setVisible (true);
     if (isDisposed ()) return;
@@ -1503,7 +1503,7 @@
 }
 
 void setToolTipText (HWND hwnd, char[] text) {
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     TOOLINFO lpti;
     lpti.cbSize = TOOLINFO.sizeof;
     lpti.hwnd = handle;
@@ -1652,7 +1652,7 @@
     * to hide children before hiding the parent.
     */
     if (showWithParent && !visible) {
-        if (!OS.IsWinCE) OS.ShowOwnedPopups (handle, false);
+        static if (!OS.IsWinCE) OS.ShowOwnedPopups (handle, false);
     }
     if (!visible) fixActiveShell ();
     super.setVisible (visible);
@@ -1660,7 +1660,7 @@
     if (showWithParent is visible) return;
     showWithParent = visible;
     if (visible) {
-        if (!OS.IsWinCE) OS.ShowOwnedPopups (handle, true);
+        static if (!OS.IsWinCE) OS.ShowOwnedPopups (handle, true);
     }
 }
 
@@ -1734,7 +1734,7 @@
     * even when it has no title.  The fix is to use WS_EX_TOOLWINDOW
     * which does not cause the window to appear in the Task Bar.
     */
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         if (parent is null) {
             if ((style & DWT.ON_TOP) !is 0) {
                 int trim = DWT.TITLE | DWT.CLOSE | DWT.MIN | DWT.MAX;
@@ -1957,7 +1957,7 @@
 
 override LRESULT WM_ERASEBKGND (int wParam, int lParam) {
     LRESULT result = super.WM_ERASEBKGND (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     /*
     * Feature in Windows.  When a shell is resized by dragging
     * the resize handles, Windows temporarily fills in black
@@ -1975,16 +1975,18 @@
 
 override LRESULT WM_ENTERIDLE (int wParam, int lParam) {
     LRESULT result = super.WM_ENTERIDLE (wParam, lParam);
-    if (result !is null) return result;
-    if (OS.IsWinCE && display.runMessages) {
-        if (display.runAsyncMessages (true)) display.wakeThread ();
+    if (result !is LRESULT.NULL) return result;
+    static if (OS.IsWinCE) {
+        if (display.runMessages) {
+            if (display.runAsyncMessages (true)) display.wakeThread ();
+        }
     }
     return result;
 }
 
 override LRESULT WM_GETMINMAXINFO (int wParam, int lParam) {
     LRESULT result = super.WM_GETMINMAXINFO (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     if (minWidth !is DWT.DEFAULT || minHeight !is DWT.DEFAULT) {
         MINMAXINFO* info = cast(MINMAXINFO*)lParam;
         //OS.MoveMemory (info, lParam, MINMAXINFO.sizeof);
@@ -1998,7 +2000,7 @@
 
 override LRESULT WM_MOUSEACTIVATE (int wParam, int lParam) {
     LRESULT result = super.WM_MOUSEACTIVATE (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
 
     /*
     * Check for WM_MOUSEACTIVATE when an MDI shell is active
@@ -2021,17 +2023,17 @@
                     display.lastHittestControl = null;
                     if (hittest is OS.HTMENU || hittest is OS.HTSYSMENU) {
                         display.lastHittestControl = control;
-                        return null;
+                        return LRESULT.NULL;
                     }
                     if (OS.IsWin95 && hittest is OS.HTCAPTION) {
                         display.lastHittestControl = control;
                     }
-                    return new LRESULT (OS.MA_NOACTIVATE);
+                    return cast( LRESULT )(OS.MA_NOACTIVATE);
                 }
             }
         }
     }
-    if (hittest is OS.HTMENU) return null;
+    if (hittest is OS.HTMENU) return LRESULT.NULL;
 
     /*
     * Get the current location of the cursor,
@@ -2052,7 +2054,7 @@
         pt.y = cast(short) (pos >> 16);
     }
     auto hwnd = OS.WindowFromPoint (pt);
-    if (hwnd is null) return null;
+    if (hwnd is null) return LRESULT.NULL;
     Control control = display.findControl (hwnd);
 
     /*
@@ -2066,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 new LRESULT (OS.MA_NOACTIVATE);
+                    return cast( LRESULT )(OS.MA_NOACTIVATE);
                 }
             }
         }
     }
 
     setActiveControl (control);
-    return null;
+    return LRESULT.NULL;
 }
 
 override LRESULT WM_MOVE (int wParam, int lParam) {
     LRESULT result = super.WM_MOVE (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     ToolTip tip = getCurrentToolTip ();
     if (tip !is null) tip.setVisible (false);
     return result;
@@ -2101,24 +2103,24 @@
 }
 
 override LRESULT WM_NCHITTEST (int wParam, int lParam) {
-    if (!OS.IsWindowEnabled (handle)) return null;
+    if (!OS.IsWindowEnabled (handle)) return LRESULT.NULL;
     if (!isEnabled () || !isActive ()) {
-        if (!Display.TrimEnabled) return new LRESULT (OS.HTNOWHERE);
+        if (!Display.TrimEnabled) return cast( 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 new LRESULT (hittest);
+        return cast( 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 new LRESULT (hittest);
+        return cast( LRESULT )(hittest);
     }
-    return null;
+    return LRESULT.NULL;
 }
 
 override LRESULT WM_NCLBUTTONDOWN (int wParam, int lParam) {
     LRESULT result = super.WM_NCLBUTTONDOWN (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     /*
     * When the normal activation was interrupted in WM_MOUSEACTIVATE
     * because the active shell was an MDI shell, set the active window
@@ -2141,7 +2143,7 @@
     }
     display.lastHittestControl = null;
     display.ignoreRestoreFocus = false;
-    return new LRESULT (code);
+    return cast( LRESULT )(code);
 }
 
 override LRESULT WM_PALETTECHANGED (int wParam, int lParam) {
@@ -2234,7 +2236,7 @@
 
 override LRESULT WM_SETTINGCHANGE (int wParam, int lParam) {
     LRESULT result = super.WM_SETTINGCHANGE (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     static if (OS.IsPPC) {
         if (wParam is OS.SPI_SETSIPINFO) {
             /*
@@ -2259,7 +2261,7 @@
 
 override LRESULT WM_SHOWWINDOW (int wParam, int lParam) {
     LRESULT result = super.WM_SHOWWINDOW (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     /*
     * Bug in Windows.  If the shell is hidden while the parent
     * is iconic,  Windows shows the shell when the parent is
@@ -2281,7 +2283,7 @@
 
 override LRESULT WM_SYSCOMMAND (int wParam, int lParam) {
     LRESULT result = super.WM_SYSCOMMAND (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     /*
     * Feature in Windows.  When the last visible window in
     * a process minimized, Windows swaps out the memory for
@@ -2316,7 +2318,7 @@
 
 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;
     auto lpwp = cast(WINDOWPOS*)lParam;
     //OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof);
     if ((lpwp.flags & OS.SWP_NOSIZE) is 0) {