summaryrefslogtreecommitdiff
path: root/alf/alfnotebook.cpp
diff options
context:
space:
mode:
authorJonas Kümmerlin <jonas@kuemmerlin.eu>2020-06-10 17:51:49 +0200
committerJonas Kümmerlin <jonas@kuemmerlin.eu>2020-06-10 17:51:49 +0200
commitb3045c6feb7ac13cb2a80e2bcf96482debc2233f (patch)
tree72d9bf545115194ba18417e629b60b4164351a35 /alf/alfnotebook.cpp
parenta43bae5fe45b7441fbe0e272dfc7d3727d280e53 (diff)
notebook: uxtheme drawing and more fixes
still missing mouseover effect and some fine tuning
Diffstat (limited to 'alf/alfnotebook.cpp')
-rw-r--r--alf/alfnotebook.cpp409
1 files changed, 313 insertions, 96 deletions
diff --git a/alf/alfnotebook.cpp b/alf/alfnotebook.cpp
index 96e188f..dcb0a89 100644
--- a/alf/alfnotebook.cpp
+++ b/alf/alfnotebook.cpp
@@ -1,8 +1,19 @@
#include "alfpriv.h"
#include "alfcompat.h"
+#define TABP_TOPTABITEM 5
+#define TABP_TOPTABITEMLEFTEDGE 6
+#define TABP_TOPTABITEMRIGHTEDGE 7
+#define TABP_TOPTABITEMBOTHEDGE 8
+#define TABP_PANE 9
#define TABP_BODY 10
+#define TIS_NORMAL 1
+#define TIS_HOT 2
+#define TIS_SELECTED 3
+#define TIS_DISABLED 4
+#define TIS_FOCUSED 5
+
#define ALF_NB_FLAG_TAB_RECTS_INVALID 1
#define ALF_NB_FLAG_SWITCHER_FOCUSED 2
#define ALF_NB_FLAG_SWITCHER_HIDEFOCUS 4
@@ -20,6 +31,8 @@ typedef struct {
HWND hwndContainer;
HWND hwndSwitcher;
HTHEME hTheme;
+ HBRUSH tabPaneBgBrush;
+ HBITMAP tabPaneBgBrushBitmap;
ALFColor tabPaneBgColor;
DWORD flags;
int dpi;
@@ -48,7 +61,7 @@ ALF_Notebook_CreatePriv(void)
static int
ALF_Notebook_SwitcherHeight(ALFNotebookPriv *priv)
{
- return priv->fontHeight + 8;
+ return priv->fontHeight + 9;
}
static void
@@ -56,10 +69,10 @@ ALF_Notebook_PanelRect(ALFNotebookPriv *priv, RECT *rc)
{
GetClientRect(priv->hwndContainer, rc);
- rc->left += 4;
- rc->right -= 4;
- rc->top += ALF_Notebook_SwitcherHeight(priv) + 1;
- rc->bottom -= 4;
+ rc->right = rc->right - rc->left - 4;
+ rc->bottom = rc->bottom - rc->top - 4;
+ rc->left = 4;
+ rc->top = ALF_Notebook_SwitcherHeight(priv);
}
static void
@@ -67,7 +80,7 @@ ALF_Notebook_PanelToContainerRect(ALFNotebookPriv *priv, RECT *rc)
{
rc->left -= 4;
rc->right += 4;
- rc->top -= ALF_Notebook_SwitcherHeight(priv) + 1;
+ rc->top -= ALF_Notebook_SwitcherHeight(priv);
rc->bottom += 4;
}
@@ -88,7 +101,8 @@ ALF_Notebook_FreePriv(ALFNotebookPriv *priv)
}
ALF_Compat_CloseThemeData(priv->hTheme);
- priv->hTheme = NULL;
+ DeleteBrush(priv->tabPaneBgBrush);
+ DeleteBitmap(priv->tabPaneBgBrushBitmap);
ALF_Free(priv);
}
@@ -209,6 +223,12 @@ ALF_Notebook_CalculateTabContentSize(ALFNotebookPriv *priv, ALFNotebookPage *pag
page->contentSize.cx = rc.right - rc.left;
page->contentSize.cy = priv->fontHeight;
+
+ // FIXME! emulate min size of original tab control
+ // maybe its actually font-dependent instead of dpi?
+ // should we even set a minimum size?
+ if (page->contentSize.cx < MulDiv(30, priv->dpi, 96))
+ page->contentSize.cx = MulDiv(30, priv->dpi, 96);
}
static void
@@ -269,7 +289,11 @@ static void
ALF_Notebook_InternalHandleThemeChange(HWND hwndNotebook, ALFNotebookPriv *priv)
{
ALF_Compat_CloseThemeData(priv->hTheme);
+ DeleteBrush(priv->tabPaneBgBrush);
+ DeleteBitmap(priv->tabPaneBgBrushBitmap);
priv->hTheme = NULL;
+ priv->tabPaneBgBrush = NULL;
+ priv->tabPaneBgBrushBitmap = NULL;
priv->tabPaneBgColor = ALF_COLOR_SYS(COLOR_BTNFACE);
if (ALF_Compat_IsAppThemed())
@@ -315,6 +339,20 @@ ALF_Notebook_InternalHandleThemeChange(HWND hwndNotebook, ALFNotebookPriv *priv)
SelectBitmap(dcMem, hbmOld);
DeleteObject(hDib);
}
+
+ if (priv->tabPaneBgColor == ALF_COLOR_TRANSPARENT) {
+ // no luck at finding a single color, create a brush now
+ priv->tabPaneBgBrushBitmap = CreateCompatibleBitmap(dcNotebook, s.cx, s.cy);
+ HBITMAP hbmOld = SelectBitmap(dcMem, priv->tabPaneBgBrushBitmap);
+
+ RECT r = { 0, 0, s.cx, s.cy };
+ ALF_Compat_DrawThemeBackground(priv->hTheme, dcMem, TABP_BODY, 0, &r, NULL);
+ GdiFlush();
+
+ SelectBitmap(dcMem, hbmOld);
+
+ priv->tabPaneBgBrush = CreatePatternBrush(priv->tabPaneBgBrushBitmap);
+ }
}
DeleteDC(dcMem);
@@ -362,7 +400,7 @@ ALF_Notebook_DoRectsIntersect(const RECT *rc1, const RECT *rc2)
}
static void
-ALF_Notebook_SwitcherPaint(ALFNotebookPriv *priv, HDC dc, RECT *rcDraw)
+ALF_Notebook_SwitcherPaintClassic(ALFNotebookPriv *priv, HDC dc, RECT *rcDraw)
{
ALF_Notebook_ValidateTabRects(priv);
@@ -381,15 +419,15 @@ ALF_Notebook_SwitcherPaint(ALFNotebookPriv *priv, HDC dc, RECT *rcDraw)
RECT rcLeftTopClip = { 0, 0, 2, rcClient.bottom - rcClient.top };
if (ALF_Notebook_DoRectsIntersect(&rcLeftTopClip, rcDraw)) {
RECT rcLeftTop = { 0,
- rcClient.bottom - rcClient.top - 1,
- 2,
- rcClient.bottom - rcClient.top };
+ rcClient.bottom - rcClient.top - 2,
+ 2,
+ rcClient.bottom - rcClient.top };
DrawEdge(dc, &rcLeftTop, EDGE_RAISED, BF_SOFT|BF_TOPLEFT);
RECT rcLeftSpace = { 0,
- 0,
- rcLeftTop.right,
- rcLeftTop.top };
+ 0,
+ rcLeftTop.right,
+ rcLeftTop.top };
FillRect(dc, &rcLeftSpace, hbrBtnFace);
}
}
@@ -402,11 +440,11 @@ ALF_Notebook_SwitcherPaint(ALFNotebookPriv *priv, HDC dc, RECT *rcDraw)
continue; // FIXME! correct clip rect calculation when next to active tab
RECT rBottom = { r.left + 2,
- r.bottom - 1,
+ r.bottom - 2,
r.right - 2,
r.bottom };
- r.bottom -= 1;
+ r.bottom -= 2;
r.top += 2;
if (!priv->selectedPage || p->list.prev != &priv->selectedPage->list) {
@@ -458,18 +496,37 @@ ALF_Notebook_SwitcherPaint(ALFNotebookPriv *priv, HDC dc, RECT *rcDraw)
if (!ALF_Notebook_DoRectsIntersect(&r, rcDraw))
continue;
- RECT rLeft = { r.left,
- r.top + 2,
- r.left + 2,
- r.bottom };
- RECT rRight = { r.right - 2,
- r.top + 2,
- r.right,
- r.bottom };
- RECT rTop = { r.left + 2,
- r.top,
- r.right - 2,
- r.top + 1 };
+ RECT rLeft = { r.left,
+ r.top + 2,
+ r.left + 2,
+ r.bottom - 1 };
+ RECT rRight = { r.right - 2,
+ r.top + 2,
+ r.right,
+ r.bottom - 1 };
+ RECT rTop = { r.left + 2,
+ r.top,
+ r.right - 2,
+ r.top + 2 };
+ RECT rBottom1 = { r.left + 2,
+ r.bottom - 4,
+ r.right - 2,
+ r.bottom - 1 };
+ RECT rBottom2 = { r.left,
+ r.bottom - 1,
+ r.right,
+ r.bottom };
+
+ if (r.left == 0) {
+ rLeft.bottom += 1;
+ rBottom2.left += 2;
+ }
+
+ if (r.right == rcClient.right-rcClient.left) {
+ rRight.bottom += 1;
+ rBottom2.right -= 2;
+ }
+
DrawEdge(dc, &rLeft, EDGE_RAISED, BF_SOFT|BF_LEFT);
DrawEdge(dc, &rRight, EDGE_RAISED, BF_SOFT|BF_RIGHT);
@@ -490,16 +547,15 @@ ALF_Notebook_SwitcherPaint(ALFNotebookPriv *priv, HDC dc, RECT *rcDraw)
SetPixel(dc, r.right - 1, r.top, clrBtnFace);
SetPixel(dc, r.right - 1, r.top + 1, clrBtnFace);
- r.left += 2;
- r.right -= 2;
-
- RECT rBottom = { r.left, r.bottom - 2, r.right, r.bottom };
- FillRect(dc, &rBottom, hbrBtnFace);
+ FillRect(dc, &rBottom1, hbrBtnFace);
+ FillRect(dc, &rBottom2, hbrBtnFace);
- r.bottom -= 2;
+ r.left += 2;
+ r.right -= 2;
+ r.bottom -= 4;
}
- r.top += 1;
+ r.top += 2;
SetBkColor(dc, clrBtnFace);
SetBkMode(dc, OPAQUE);
@@ -514,12 +570,12 @@ ALF_Notebook_SwitcherPaint(ALFNotebookPriv *priv, HDC dc, RECT *rcDraw)
RECT rcFocus = { p->calculatedTabRect.left + 1,
p->calculatedTabRect.top + 3,
p->calculatedTabRect.right - 1,
- p->calculatedTabRect.bottom - 2 };
+ p->calculatedTabRect.bottom - 3 };
DrawFocusRect(dc, &rcFocus);
}
}
- RECT rcRightTop = { priv->totalSwitcherWidth, rcClient.bottom - rcClient.top - 1,
+ RECT rcRightTop = { priv->totalSwitcherWidth, rcClient.bottom - rcClient.top - 2,
rcClient.right-rcClient.left, rcClient.bottom - rcClient.top };
if (!priv->selectedPage || priv->pages.prev != &priv->selectedPage->list) {
@@ -533,14 +589,148 @@ ALF_Notebook_SwitcherPaint(ALFNotebookPriv *priv, HDC dc, RECT *rcDraw)
RECT rcRightSpace = { rcRightTop.left, 0,
rcRightTop.right, rcRightTop.top };
- FillRect(dc, &rcRightSpace, GetSysColorBrush(COLOR_BTNFACE));
+ FillRect(dc, &rcRightSpace, hbrBtnFace);
+ }
+ }
+
+ SelectFont(dc, oldfont);
+}
+
+static void
+ALF_Notebook_SwitcherPaintUx(ALFNotebookPriv *priv, HDC dc, RECT *rcDraw)
+{
+ HFONT oldfont = SelectFont(dc, priv->font);
+
+ RECT rcClient;
+ GetClientRect(priv->hwndSwitcher, &rcClient);
+
+ HBRUSH hbrBtnFace = GetSysColorBrush(COLOR_BTNFACE);
+
+ // fill left top space
+ if (!priv->selectedPage || priv->pages.next != &priv->selectedPage->list) {
+ RECT rcLeftTopClip = { 0, 0, 2, rcClient.bottom - rcClient.top };
+ if (ALF_Notebook_DoRectsIntersect(&rcLeftTopClip, rcDraw)) {
+ RECT rcLeftSpace = { 0,
+ 0,
+ 2,
+ rcClient.bottom - rcClient.top - 2 };
+ FillRect(dc, &rcLeftSpace, hbrBtnFace);
+ }
+ }
+
+ ALF_FOR_LIST(ALFNotebookPage, list, &priv->pages, p) {
+ RECT r = p->calculatedTabRect;
+
+ int part = TABP_TOPTABITEM;
+ if (r.left <= 4 && r.right >= rcClient.right - rcClient.left - 4) {
+ part = TABP_TOPTABITEMBOTHEDGE;
+ } else if (r.left <= 4) {
+ part = TABP_TOPTABITEMLEFTEDGE;
+ } else if (r.right >= rcClient.right - rcClient.left - 4) {
+ part = TABP_TOPTABITEMRIGHTEDGE;
+ }
+
+ if (p != priv->selectedPage) {
+ r.bottom -= 2;
+
+ if (!ALF_Notebook_DoRectsIntersect(&r, rcDraw))
+ continue; // FIXME! correct clip rect calculation when next to active tab
+
+ r.top += 2;
+
+ RECT rTabDraw = r;
+ RECT rClip = { r.left + 2, r.top, r.right - 2, r.bottom };
+
+ if (!priv->selectedPage || p->list.prev != &priv->selectedPage->list) {
+ rClip.left -= 2;
+ }
+
+ if (!priv->selectedPage || p->list.next != &priv->selectedPage->list) {
+ rClip.right += 2;
+ }
+
+ RECT rTopSpace = { rClip.left, r.top-2, rClip.right, r.top };
+ FillRect(dc, &rTopSpace, hbrBtnFace);
+
+ ALF_Compat_DrawThemeBackground(priv->hTheme, dc, part, TIS_NORMAL, &rTabDraw, &rClip);
+
+ r.left += 2;
+ r.right -= 2;
+ } else {
+ InflateRect(&r, 2, 0);
+
+ if (!ALF_Notebook_DoRectsIntersect(&r, rcDraw))
+ continue;
+
+ RECT rTabDraw = { r.left, r.top, r.right, r.bottom };
+
+ ALF_Compat_DrawThemeBackground(priv->hTheme, dc, part, TIS_SELECTED, &rTabDraw, rcDraw);
+
+ r.left += 2;
+ r.right -= 2;
+ r.bottom -= 2;
+ }
+
+ r.top += 1;
+
+ SetBkMode(dc, TRANSPARENT);
+ SetTextColor(dc, GetSysColor(COLOR_BTNTEXT)); // FIXME! theme color
+
+ DrawText(dc, p->title, -1, &r, DT_NOPREFIX|DT_SINGLELINE|DT_CENTER|DT_VCENTER);
+
+ if (p == priv->selectedPage && priv->flags & ALF_NB_FLAG_SWITCHER_FOCUSED && !(priv->flags & ALF_NB_FLAG_SWITCHER_HIDEFOCUS)) {
+ RECT rcFocus = { p->calculatedTabRect.left + 1,
+ p->calculatedTabRect.top + 3,
+ p->calculatedTabRect.right - 1,
+ p->calculatedTabRect.bottom - 2 };
+ DrawFocusRect(dc, &rcFocus);
+ }
+ }
+
+ // fill right top space
+ RECT rcRightTop = { priv->totalSwitcherWidth, 0,
+ rcClient.right-rcClient.left, rcClient.bottom - rcClient.top - 2 };
+
+ if (!priv->selectedPage || priv->pages.prev != &priv->selectedPage->list) {
+ rcRightTop.left -= 2;
+ }
+
+ if (rcRightTop.left < rcRightTop.right) {
+ RECT rcRightTopClip = { rcRightTop.left, 0, rcClient.right-rcClient.left, rcClient.bottom-rcClient.top };
+ if (ALF_Notebook_DoRectsIntersect(&rcRightTopClip, rcDraw)) {
+ FillRect(dc, &rcRightTop, hbrBtnFace);
}
}
+ // at last, paint the bottom border
+ if (priv->selectedPage) {
+ RECT rcSelected = priv->selectedPage->calculatedTabRect;
+ InflateRect(&rcSelected, 2, 0);
+ ExcludeClipRect(dc, rcSelected.left, rcSelected.top, rcSelected.right, rcSelected.bottom);
+ }
+
+ RECT rcContainerClient;
+ GetClientRect(priv->hwndContainer, &rcContainerClient);
+
+ RECT rcBottomClip = { 0, rcClient.bottom-rcClient.top-2, rcClient.right-rcClient.left, rcClient.bottom-rcClient.top };
+ RECT rcBottomFake = { rcBottomClip.left, rcBottomClip.top, rcBottomClip.right,
+ rcContainerClient.bottom-rcContainerClient.top };
+ ALF_Compat_DrawThemeBackground(priv->hTheme, dc, TABP_PANE, 0, &rcBottomFake, &rcBottomClip);
+
SelectFont(dc, oldfont);
}
static void
+ALF_Notebook_SwitcherPaint(ALFNotebookPriv *priv, HDC dc, RECT *rcDraw)
+{
+ if (priv->hTheme) {
+ ALF_Notebook_SwitcherPaintUx(priv, dc, rcDraw);
+ } else {
+ ALF_Notebook_SwitcherPaintClassic(priv, dc, rcDraw);
+ }
+}
+
+static void
ALF_Notebook_HandleSwitcherUIState(ALFNotebookPriv *priv)
{
LRESULT uistate = SendMessage(priv->hwndSwitcher, WM_QUERYUISTATE, 0, 0);
@@ -598,18 +788,40 @@ ALF_Notebook_SwitcherWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
// height changed - this should basically never happen, do it the easy way
InvalidateRect(hwnd, NULL, TRUE);
}
- if (rcClient.right - rcClient.left > priv->oldSwitcherSize.cx) {
- // width increased
- RECT rc = { priv->oldSwitcherSize.cx - 2, 0,
- rcClient.right - rcClient.left, rcClient.bottom - rcClient.top };
- InvalidateRect(hwnd, &rc, TRUE);
+
+ if (priv->hTheme) {
+ // bottom border might be a stretched bitmap, just redraw the whole thing
+ if (rcClient.right - rcClient.left != priv->oldSwitcherSize.cx) {
+ RECT rc = { 0, rcClient.bottom-rcClient.top-2,
+ rcClient.right-rcClient.left, rcClient.bottom-rcClient.top };
+ InvalidateRect(hwnd, &rc, TRUE);
+ }
+ } else {
+ if (rcClient.right - rcClient.left > priv->oldSwitcherSize.cx) {
+ // width increased
+ RECT rc = { priv->oldSwitcherSize.cx - 2, 0,
+ rcClient.right - rcClient.left, rcClient.bottom - rcClient.top };
+ InvalidateRect(hwnd, &rc, TRUE);
+ }
+ if (rcClient.right - rcClient.left < priv->oldSwitcherSize.cx) {
+ // width decreased
+ RECT rc = { rcClient.right - rcClient.left - 2,
+ rcClient.bottom - rcClient.top - 2,
+ rcClient.right - rcClient.left,
+ rcClient.bottom - rcClient.top };
+ InvalidateRect(hwnd, &rc, TRUE);
+ }
}
- if (rcClient.right - rcClient.left < priv->oldSwitcherSize.cx) {
- // width decreased
- RECT rc = { rcClient.right - rcClient.left - 2,
- rcClient.bottom - rcClient.top - 1,
- rcClient.right - rcClient.left,
- rcClient.bottom - rcClient.top };
+
+ // if the right border now straddles the rightmost tab or has done
+ // so before the resize, redraw the rightmost tab (uxtheme only)
+ // uxtheme draws a different bitmap when it straddles the border
+ if (priv->hTheme && !ALF_ListIsEmpty(&priv->pages) &&
+ ((rcClient.right - rcClient.left) - 4 <= ALF_LIST_CONTAINER(ALFNotebookPage, list, priv->pages.prev)->calculatedTabRect.right)
+ != (priv->oldSwitcherSize.cx - 4 <= ALF_LIST_CONTAINER(ALFNotebookPage, list, priv->pages.prev)->calculatedTabRect.right)) {
+ ALFNotebookPage *lastpage = ALF_LIST_CONTAINER(ALFNotebookPage, list, priv->pages.prev);
+ RECT rc = { lastpage->calculatedTabRect.left, 0,
+ rcClient.right-rcClient.left, rcClient.bottom-rcClient.top };
InvalidateRect(hwnd, &rc, TRUE);
}
@@ -659,37 +871,36 @@ ALF_Notebook_ContainerPaint(ALFNotebookPriv *priv, HDC dc, RECT *f)
RECT r;
ALF_Notebook_PanelRect(priv, &r);
- SIZE s;
- if (SUCCEEDED(ALF_Compat_GetThemePartSize(priv->hTheme, dc, 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;
-
- if (f && r2.left > f->right && r2.right < f->left)
- continue;
-
- if (RectVisible(dc, &r2))
- ALF_Compat_DrawThemeBackground(priv->hTheme, dc, TABP_BODY, 0, &r2, NULL);
+ if (priv->tabPaneBgBrush != NULL) {
+ POINT vpo;
+ if (GetViewportOrgEx(dc, &vpo)) {
+ SetBrushOrgEx(dc, vpo.x, vpo.y, NULL);
}
+ FillRect(dc, &r, priv->tabPaneBgBrush);
} else {
// old version - let uxtheme stretch it
- ALF_Compat_DrawThemeBackground(priv->hTheme, dc, TABP_BODY, 0, &r, NULL);
+ ALF_Compat_DrawThemeBackground(priv->hTheme, dc, TABP_BODY, 0, &r, f);
}
ExcludeClipRect(dc, r.left, r.top, r.right, r.bottom);
- }
- RECT rcClient;
- GetClientRect(priv->hwndContainer, &rcClient);
+ r.left -= 4;
+ r.top -= 2;
+ r.right += 4;
+ r.bottom += 4;
+ ALF_Compat_DrawThemeBackground(priv->hTheme, dc, TABP_PANE, 0, &r, f);
- RECT rcBorder = { 0, ALF_Notebook_SwitcherHeight(priv),
- rcClient.right - rcClient.left,
- rcClient.bottom - rcClient.top
- };
- DrawEdge(dc, &rcBorder, EDGE_RAISED, BF_SOFT|BF_LEFT|BF_RIGHT|BF_BOTTOM|BF_ADJUST);
- FillRect(dc, &rcBorder, GetSysColorBrush(COLOR_BTNFACE));
+ } else {
+ RECT rcClient;
+ GetClientRect(priv->hwndContainer, &rcClient);
+
+ RECT rcBorder = { 0, ALF_Notebook_SwitcherHeight(priv),
+ rcClient.right - rcClient.left,
+ rcClient.bottom - rcClient.top
+ };
+ DrawEdge(dc, &rcBorder, EDGE_RAISED, BF_SOFT|BF_LEFT|BF_RIGHT|BF_BOTTOM|BF_ADJUST);
+ FillRect(dc, &rcBorder, GetSysColorBrush(COLOR_BTNFACE));
+ }
}
static DWORD
@@ -845,34 +1056,40 @@ ALF_Notebook_ContainerWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
if (priv->selectedPage && priv->hTheme
&& priv->tabPaneBgColor == ALF_COLOR_TRANSPARENT
- && ((oldPanelRect.bottom - oldPanelRect.top) != (rcClient.bottom - rcClient.top))) {
+ && ((oldPanelRect.bottom - oldPanelRect.top) != (rcPanel.bottom - rcPanel.top))) {
// only needed when height changes, since bg is tiled horizontally
ALF_InvalidateBackground(priv->selectedPage->hwndPanel);
}
- if (rcClient.bottom - rcClient.top > priv->oldContainerSize.cy) {
- // height increased
- RECT rc = { 0, priv->oldContainerSize.cy - 4,
- rcClient.right - rcClient.left, rcClient.bottom - rcClient.top };
- InvalidateRect(hwnd, &rc, TRUE);
- }
- if (rcClient.bottom - rcClient.top < priv->oldContainerSize.cy) {
- // height decreased
- RECT rc = { 0, rcClient.bottom - rcClient.top - 4,
- rcClient.right - rcClient.left, rcClient.bottom - rcClient.top };
- InvalidateRect(hwnd, &rc, TRUE);
- }
- if (rcClient.right - rcClient.left > priv->oldContainerSize.cx) {
- // width increased
- RECT rc = { priv->oldContainerSize.cx - 4, 0,
- rcClient.right - rcClient.left, rcClient.bottom - rcClient.top };
- InvalidateRect(hwnd, &rc, TRUE);
- }
- if (rcClient.right - rcClient.left < priv->oldContainerSize.cx) {
- // width decreased
- RECT rc = { rcClient.right - rcClient.left - 4, 0,
- rcClient.right - rcClient.left, rcClient.bottom - rcClient.top };
- InvalidateRect(hwnd, &rc, TRUE);
+ if (priv->hTheme) {
+ // themed background does contain gradients on XP
+ // FIXME! do we always need to invalidate everyting?
+ InvalidateRect(hwnd, NULL, TRUE);
+ } else {
+ if (rcClient.bottom - rcClient.top > priv->oldContainerSize.cy) {
+ // height increased
+ RECT rc = { 0, priv->oldContainerSize.cy - 4,
+ rcClient.right - rcClient.left, rcClient.bottom - rcClient.top };
+ InvalidateRect(hwnd, &rc, TRUE);
+ }
+ if (rcClient.bottom - rcClient.top < priv->oldContainerSize.cy) {
+ // height decreased
+ RECT rc = { 0, rcClient.bottom - rcClient.top - 4,
+ rcClient.right - rcClient.left, rcClient.bottom - rcClient.top };
+ InvalidateRect(hwnd, &rc, TRUE);
+ }
+ if (rcClient.right - rcClient.left > priv->oldContainerSize.cx) {
+ // width increased
+ RECT rc = { priv->oldContainerSize.cx - 4, 0,
+ rcClient.right - rcClient.left, rcClient.bottom - rcClient.top };
+ InvalidateRect(hwnd, &rc, TRUE);
+ }
+ if (rcClient.right - rcClient.left < priv->oldContainerSize.cx) {
+ // width decreased
+ RECT rc = { rcClient.right - rcClient.left - 4, 0,
+ rcClient.right - rcClient.left, rcClient.bottom - rcClient.top };
+ InvalidateRect(hwnd, &rc, TRUE);
+ }
}
priv->oldContainerSize.cx = rcClient.right - rcClient.left;