Mercurial > projects > dwt-win
diff dwt/widgets/Group.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 | b4846fd3437a |
line wrap: on
line diff
--- a/dwt/widgets/Group.d Mon May 05 00:12:38 2008 +0200 +++ b/dwt/widgets/Group.d Sat May 17 17:34:28 2008 +0200 @@ -207,7 +207,8 @@ OS.DrawText (hDC, buffer, -1, &rect, flags); if (newFont !is null) OS.SelectObject (hDC, oldFont); OS.ReleaseDC (handle, hDC); - size.x = Math.max (size.x, rect.right - rect.left + CLIENT_INSET * 6); + int offsetY = OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed () ? 0 : 1; + size.x = Math.max (size.x, rect.right - rect.left + CLIENT_INSET * 6 + offsetY); } return size; } @@ -223,15 +224,27 @@ OS.GetTextMetrics (hDC, &tm); if (newFont !is null) OS.SelectObject (hDC, oldFont); OS.ReleaseDC (handle, hDC); + int offsetY = OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed () ? 0 : 1; trim.x -= CLIENT_INSET; - trim.y -= tm.tmHeight; + trim.y -= tm.tmHeight + offsetY; trim.width += CLIENT_INSET * 2; trim.height += tm.tmHeight + CLIENT_INSET; return trim; } override void createHandle () { + /* + * Feature in Windows. When a button is created, + * it clears the UI state for all controls in the + * shell by sending WM_CHANGEUISTATE with UIS_SET, + * UISF_HIDEACCEL and UISF_HIDEFOCUS to the parent. + * This is undocumented and unexpected. The fix + * is to ignore the WM_CHANGEUISTATE, when sent + * from CreateWindowEx(). + */ + parent.state |= IGNORE_WM_CHANGEUISTATE; super.createHandle (); + parent.state &= ~IGNORE_WM_CHANGEUISTATE; state |= DRAW_BACKGROUND; state &= ~CANVAS; } @@ -265,7 +278,8 @@ OS.GetTextMetrics (hDC, &tm); if (newFont !is null) OS.SelectObject (hDC, oldFont); OS.ReleaseDC (handle, hDC); - int x = CLIENT_INSET, y = tm.tmHeight; + int offsetY = OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed () ? 0 : 1; + int x = CLIENT_INSET, y = tm.tmHeight + offsetY; int width = Math.max (0, rect.right - CLIENT_INSET * 2); int height = Math.max (0, rect.bottom - y - CLIENT_INSET); return new Rectangle (x, y, width, height); @@ -406,7 +420,7 @@ * allow children, answer HTCLIENT to allow mouse messages * to be delivered to the children. */ - int code = callWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam); + int /*long*/ code = callWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam); if (code is OS.HTTRANSPARENT) code = OS.HTCLIENT; return new LRESULT (code); } @@ -438,7 +452,7 @@ */ if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { auto nSavedDC = OS.SaveDC (cast(HDC)wParam); - int code = callWindowProc (handle, OS.WM_PRINTCLIENT, wParam, lParam); + int /*long*/ code = callWindowProc (handle, OS.WM_PRINTCLIENT, wParam, lParam); OS.RestoreDC (cast(HDC)wParam, nSavedDC); return new LRESULT (code); } @@ -467,7 +481,7 @@ } if (redraw) { OS.InvalidateRect (handle, null, false); - int code = OS.DefWindowProc (handle, OS.WM_UPDATEUISTATE, wParam, lParam); + int /*long*/ code = OS.DefWindowProc (handle, OS.WM_UPDATEUISTATE, wParam, lParam); return new LRESULT (code); } return result;