Mercurial > projects > dwt-win
diff dwt/widgets/Decorations.d @ 213:36f5cb12e1a2
Update to SWT 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 17 May 2008 17:34:28 +0200 |
parents | ab60f3309436 |
children | 43b41c7fe84a |
line wrap: on
line diff
--- a/dwt/widgets/Decorations.d Mon May 05 00:12:38 2008 +0200 +++ b/dwt/widgets/Decorations.d Sat May 17 17:34:28 2008 +0200 @@ -310,6 +310,10 @@ /* Do nothing */ } +void checkComposited (Composite parent) { + /* Do nothing */ +} + override void checkOpened () { if (!opened) resized = false; } @@ -412,8 +416,7 @@ while (menu !is null && menu !is menuBar) { menu = menu.getParentMenu (); } - if (menu is menuBar) { - item.fillAccel (&accel); + if (menu is menuBar && item.fillAccel (&accel)) { *cast(ACCEL*)buffer1.ptr = accel; //OS.MoveMemory (buffer1, accel, ACCEL.sizeof); System.arraycopy (buffer1, 0, buffer2, nAccel * ACCEL.sizeof, ACCEL.sizeof); @@ -1218,7 +1221,7 @@ int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); bits &= ~OS.WS_CHILD; OS.SetWindowLong (handle, OS.GWL_STYLE, bits | OS.WS_POPUP); - OS.SetWindowLong (handle, OS.GWL_ID, 0); + OS.SetWindowLongPtr (handle, OS.GWLP_ID, 0); int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE; SetWindowPos (handle, cast(HWND)OS.HWND_BOTTOM, 0, 0, 0, 0, flags); display.lockActiveWindow = false; @@ -1337,7 +1340,18 @@ checkWidget (); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); /* Use the character encoding for the default locale */ - OS.SetWindowText (handle, StrToTCHARz(string)); + TCHAR[] buffer = StrToTCHARs (string, true); + /* Ensure that the title appears in the task bar.*/ + if ((state & FOREIGN_HANDLE) !is 0) { + auto hHeap = OS.GetProcessHeap (); + int byteCount = buffer.length * TCHAR.sizeof; + auto pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); + OS.MoveMemory (pszText, buffer.ptr, byteCount); + OS.DefWindowProc (handle, OS.WM_SETTEXT, 0, cast(int) pszText); + if (pszText !is null) OS.HeapFree (hHeap, 0, pszText); + } else { + OS.SetWindowText (handle, buffer.ptr); + } } override public void setVisible (bool visible) { @@ -1402,11 +1416,7 @@ if (OS.IsZoomed (handle)) { swFlags = OS.SW_SHOWMAXIMIZED; } else { - if (handle is OS.GetActiveWindow ()) { - swFlags = OS.SW_RESTORE; - } else { - swFlags = OS.SW_SHOWNOACTIVATE; - } + swFlags = OS.SW_SHOWNOACTIVATE; } } } @@ -1462,7 +1472,7 @@ } if (msg.message is OS.WM_KEYDOWN) { if (OS.GetKeyState (OS.VK_CONTROL) >= 0) return false; - switch (msg.wParam) { + switch ((msg.wParam)) { case OS.VK_F4: OS.PostMessage (handle, OS.WM_CLOSE, 0, 0); return true; @@ -1473,7 +1483,7 @@ return false; } if (msg.message is OS.WM_SYSKEYDOWN) { - switch (msg.wParam) { + switch ((msg.wParam)) { case OS.VK_F4: OS.PostMessage (shell.handle, OS.WM_CLOSE, 0, 0); return true; @@ -1612,14 +1622,14 @@ return LRESULT.ZERO; } } - if ((wParam & 0xFFFF) !is 0) { + if (OS.LOWORD (wParam) !is 0) { /* * When the high word of wParam is non-zero, the activation * state of the window is being changed while the window is * minimized. If this is the case, do not report activation * events or restore the focus. */ - if ((wParam >> 16) !is 0) return result; + if (OS.HIWORD (wParam) !is 0) return result; Control control = display.findControl (cast(HWND)lParam); if (control is null || (null !is cast(Shell)control)) { if (cast(Shell)this) { @@ -1672,7 +1682,7 @@ * If the Shell has the DWT.CLOSE style, close the Shell. * Otherwise, send the Back key to the window with focus. */ - if (((lParam >> 16) & 0xFFFF) is OS.VK_ESCAPE) { + if (OS.HIWORD (lParam) is OS.VK_ESCAPE) { if ((style & DWT.CLOSE) !is 0) { OS.PostMessage (handle, OS.WM_CLOSE, 0, 0); } else { @@ -1751,8 +1761,8 @@ switch (wParam) { case OS.SIZE_RESTORED: case OS.SIZE_MAXIMIZED: - newWidth = lParam & 0xFFFF; - newHeight = lParam >> 16; + newWidth = OS.LOWORD (lParam); + newHeight = OS.HIWORD (lParam); break; case OS.SIZE_MINIMIZED: Rectangle rect = getClientArea ();