diff options
Diffstat (limited to 'alf/alfnotebook.cpp')
| -rw-r--r-- | alf/alfnotebook.cpp | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/alf/alfnotebook.cpp b/alf/alfnotebook.cpp index ddc37b3..898c601 100644 --- a/alf/alfnotebook.cpp +++ b/alf/alfnotebook.cpp @@ -179,7 +179,20 @@ ALF_Notebook_InternalPaint(HWND hwnd, ALFNotebookPriv *priv, HDC dc, RECT *f) TabCtrl_AdjustRect(priv->hwndTabCtrl, FALSE, &r); MapWindowRect(priv->hwndTabCtrl, hwnd, &r); - ALF_Compat_DrawThemeBackground(priv->hTheme, dc, TABP_BODY, 0, &r, NULL); + SIZE s; + if (SUCCEEDED(ALF_Compat_GetThemePartSize(priv->hTheme, GetDC(NULL), TABP_BODY, 0, NULL, TS_TRUE, &s))) { + // windows dialog tab panes tile the background horizontally + for (int x = r.left; x < r.right; x += s.cx) { + RECT r2 = { x, r.top, x + s.cx, r.bottom }; + if (r2.right > r.right) + r2.right = r.right; + + ALF_Compat_DrawThemeBackground(priv->hTheme, dc, TABP_BODY, 0, &r2, NULL); + } + } else { + // old version - let uxtheme stretch it + ALF_Compat_DrawThemeBackground(priv->hTheme, dc, TABP_BODY, 0, &r, NULL); + } ExcludeClipRect(dc, r.left, r.top, r.right, r.bottom); } @@ -267,20 +280,28 @@ ALF__NotebookWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (!(pos->flags & SWP_NOSIZE)) { RECT r; GetClientRect(hwnd, &r); - MoveWindow(priv->hwndTabCtrl, 0, 0, r.right - r.left, r.bottom - r.top, FALSE); - InvalidateRect(priv->hwndTabCtrl, NULL, TRUE); + int n = ALF_Notebook_InternalTabCount(hwnd, priv->hwndTabCtrl); + + HDWP hdwp = BeginDeferWindowPos(n+1); + + // SWP_COPYBITS: NT 3.51 sadness, will not invalidate bottom edge properly on resize + // even though it redraws everything else with great flicker + // the flicker problem is present in every other version of windows, too + hdwp = DeferWindowPos(hdwp, priv->hwndTabCtrl, NULL, + 0, 0, r.right-r.left, r.bottom-r.top, + SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS); - GetClientRect(priv->hwndTabCtrl, &r); TabCtrl_AdjustRect(priv->hwndTabCtrl, FALSE, &r); - MapWindowRect(priv->hwndTabCtrl, hwnd, &r); - int n = ALF_Notebook_InternalTabCount(hwnd, priv->hwndTabCtrl); for (int i = 0; i < n; ++i) { HWND p = ALF_Notebook_InternalTabPanel(hwnd, priv->hwndTabCtrl, i); - MoveWindow(p, r.left, r.top, r.right - r.left, r.bottom - r.top, FALSE); - InvalidateRect(p, NULL, TRUE); + hdwp = DeferWindowPos(hdwp, p, NULL, + r.left, r.top, r.right - r.left, r.bottom - r.top, + SWP_NOACTIVATE|SWP_NOZORDER); } + + EndDeferWindowPos(hdwp); } } else if (uMsg == ALF_NB_ADDTAB) { return (LRESULT)ALF_Notebook_InternalAddTab(hwnd, priv, (TCHAR *)lParam); |
