Mercurial > projects > dwt-win
changeset 107:a378481be65f
Adding "static if" where necessary
author | John Reimer <terminal.node@gmail.com |
---|---|
date | Sun, 10 Feb 2008 16:54:57 -0800 |
parents | e4a62cdcd2e0 |
children | 0a02d6d3466b |
files | dwt/widgets/Control.d dwt/widgets/ExpandBar.d dwt/widgets/Widget.d |
diffstat | 3 files changed, 30 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/widgets/Control.d Mon Feb 11 00:56:33 2008 +0100 +++ b/dwt/widgets/Control.d Sun Feb 10 16:54:57 2008 -0800 @@ -1962,7 +1962,7 @@ void redraw (bool all) { // checkWidget (); if (!OS.IsWindowVisible (handle)) return; - if (OS.IsWinCE) { + static if (OS.IsWinCE) { OS.InvalidateRect (handle, null, true); } else { int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE; @@ -2006,7 +2006,7 @@ if (!OS.IsWindowVisible (handle)) return; RECT rect; OS.SetRect (&rect, x, y, x + width, y + height); - if (OS.IsWinCE) { + static if (OS.IsWinCE) { OS.InvalidateRect (handle, &rect, true); } else { int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE; @@ -2501,7 +2501,7 @@ } void setBackgroundImage (HBITMAP hBitmap) { - if (OS.IsWinCE) { + static if (OS.IsWinCE) { OS.InvalidateRect (handle, null, true); } else { int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE; @@ -2510,7 +2510,7 @@ } void setBackgroundPixel (int pixel) { - if (OS.IsWinCE) { + static if (OS.IsWinCE) { OS.InvalidateRect (handle, null, true); } else { int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE; @@ -2873,7 +2873,7 @@ * flag is specified. The fix is to set SWP_DRAWFRAME only when * not running on WinCE. */ - if (!OS.IsWinCE) flags |= OS.SWP_DRAWFRAME; + static if (!OS.IsWinCE) flags |= OS.SWP_DRAWFRAME; setBounds (x, y, 0, 0, flags); } @@ -2992,7 +2992,7 @@ OS.ShowWindow (topHandle_, OS.SW_HIDE); if (handle !is topHandle_) OS.ShowWindow (handle, OS.SW_HIDE); } else { - if (OS.IsWinCE) { + static if (OS.IsWinCE) { OS.InvalidateRect (topHandle_, null, true); if (handle !is topHandle_) OS.InvalidateRect (handle, null, true); } else { @@ -3578,7 +3578,7 @@ void update (bool all) { // checkWidget (); - if (OS.IsWinCE) { + static if (OS.IsWinCE) { OS.UpdateWindow (handle); } else { int flags = OS.RDW_UPDATENOW; @@ -3931,7 +3931,7 @@ } LRESULT WM_HELP (int wParam, int lParam) { - if (OS.IsWinCE) return LRESULT.NULL; + static if (OS.IsWinCE) return LRESULT.NULL; HELPINFO* lphi = cast(HELPINFO*)lParam; Decorations shell = menuShell (); if (!shell.isEnabled ()) return LRESULT.NULL;
--- a/dwt/widgets/ExpandBar.d Mon Feb 11 00:56:33 2008 +0100 +++ b/dwt/widgets/ExpandBar.d Sun Feb 10 16:54:57 2008 -0800 @@ -160,7 +160,7 @@ if (hFont !is null) { hCurrentFont = hFont; } else { - if (!OS.IsWinCE) { + static if (!OS.IsWinCE) { NONCLIENTMETRICS info; info.cbSize = NONCLIENTMETRICS.sizeof; if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, &info, 0)) { @@ -283,13 +283,15 @@ } HFONT hCaptionFont, oldFont; if (hTheme is null) { - if (!OS.IsWinCE && hFont is null) { - NONCLIENTMETRICS info; - info.cbSize = NONCLIENTMETRICS.sizeof; - if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, &info, 0)) { - LOGFONT* logFont = &info.lfCaptionFont; - hCaptionFont = OS.CreateFontIndirect (logFont); - oldFont = OS.SelectObject (gc.handle, hCaptionFont); + static if (!OS.IsWinCE ) { + if (hFont is null) { + NONCLIENTMETRICS info; + info.cbSize = NONCLIENTMETRICS.sizeof; + if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, &info, 0)) { + LOGFONT* logFont = &info.lfCaptionFont; + hCaptionFont = OS.CreateFontIndirect (logFont); + oldFont = OS.SelectObject (gc.handle, hCaptionFont); + } } } } @@ -493,7 +495,7 @@ override void setBackgroundPixel (int pixel) { super.setBackgroundPixel (pixel); - if (!OS.IsWinCE) { + static if (!OS.IsWinCE) { int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN; OS.RedrawWindow (handle, null, null, flags); } @@ -507,7 +509,7 @@ override void setForegroundPixel (int pixel) { super.setForegroundPixel (pixel); - if (!OS.IsWinCE) { + static if (!OS.IsWinCE) { int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN; OS.RedrawWindow (handle, null, null, flags); }
--- a/dwt/widgets/Widget.d Mon Feb 11 00:56:33 2008 +0100 +++ b/dwt/widgets/Widget.d Sun Feb 10 16:54:57 2008 -0800 @@ -390,7 +390,7 @@ } HDWP DeferWindowPos(HDWP hWinPosInfo, HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags){ - if (OS.IsWinCE) { + static if (OS.IsWinCE) { /* * Feature in Windows. On Windows CE, DeferWindowPos always causes * a WM_SIZE message, even when the new size is the same as the old @@ -1252,7 +1252,7 @@ } bool SetWindowPos (HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags) { - if (OS.IsWinCE) { + static if (OS.IsWinCE) { /* * Feature in Windows. On Windows CE, SetWindowPos() always causes * a WM_SIZE message, even when the new size is the same as the old @@ -1346,7 +1346,7 @@ * NOTE: This only happens on WM2003. Previous WinCE versions did * not support WM_CONTEXTMENU. */ - if (OS.IsWinCE) return LRESULT.NULL; + static if (OS.IsWinCE) return LRESULT.NULL; /* * Feature in Windows. When the user presses WM_NCRBUTTONUP, @@ -1429,7 +1429,7 @@ * both virtual and ASCII are a special case. */ int mapKey = 0; - if (OS.IsWinCE) { + static if (OS.IsWinCE) { switch (wParam) { case OS.VK_BACK: mapKey = DWT.BS; break; case OS.VK_RETURN: mapKey = DWT.CR; break; @@ -1623,7 +1623,7 @@ Display display = this.display; /* Check for hardware keys */ - if (OS.IsWinCE) { + static if (OS.IsWinCE) { if (OS.VK_APP1 <= wParam && wParam <= OS.VK_APP6) { display.lastKey = display.lastAscii = 0; display.lastVirtual = display.lastNull = display.lastDead = false; @@ -1658,7 +1658,7 @@ * both virtual and ASCII are a special case. */ int mapKey = 0; - if (OS.IsWinCE) { + static if (OS.IsWinCE) { switch (wParam) { case OS.VK_BACK: mapKey = DWT.BS; break; case OS.VK_RETURN: mapKey = DWT.CR; break; @@ -1779,7 +1779,7 @@ bool dragging = false, mouseDown = true; int count = display.getClickCount (DWT.MouseDown, 1, hwnd, lParam); if (count is 1 && (state & DRAG_DETECT) !is 0 && hooks (DWT.DragDetect)) { - if (!OS.IsWinCE) { + static if (!OS.IsWinCE) { /* * Feature in Windows. It's possible that the drag * operation will not be started while the mouse is @@ -1979,7 +1979,7 @@ Display display = this.display; int pos = OS.GetMessagePos (); if (pos !is display.lastMouse || display.captureChanged) { - if (!OS.IsWinCE) { + static if (!OS.IsWinCE) { bool trackMouse = (state & TRACK_MOUSE) !is 0; bool mouseEnter = hooks (DWT.MouseEnter) || display.filters (DWT.MouseEnter); bool mouseExit = hooks (DWT.MouseExit) || display.filters (DWT.MouseExit); @@ -2059,7 +2059,7 @@ /* Issue a paint event */ LRESULT result = LRESULT.NULL; - if (OS.IsWinCE) { + static if (OS.IsWinCE) { RECT rect; OS.GetUpdateRect (hwnd, &rect, false); result = callWindowProc (hwnd, OS.WM_PAINT, wParam, lParam); @@ -2330,7 +2330,7 @@ * both virtual and ASCII are a special case. */ int mapKey = 0; - if (OS.IsWinCE) { + static if (OS.IsWinCE) { switch (wParam) { case OS.VK_BACK: mapKey = DWT.BS; break; case OS.VK_RETURN: mapKey = DWT.CR; break;