This MR marks the end of the series.
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/updown.c | 48 ++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 23 deletions(-)
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index 6e08975d567..f3cf58fd322 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -362,23 +362,31 @@ static BOOL UPDOWN_SetBuddyInt (const UPDOWN_INFO *infoPtr) * * Draw buddy background for visual integration. */ -static BOOL UPDOWN_DrawBuddyBackground (const UPDOWN_INFO *infoPtr, HDC hdc) +static void UPDOWN_DrawBuddyBackground (const UPDOWN_INFO *infoPtr, HDC hdc) { - RECT br, r; + RECT rect; + HTHEME theme = GetWindowTheme(infoPtr->Self); HTHEME buddyTheme = GetWindowTheme (infoPtr->Buddy); - if (!buddyTheme) return FALSE; - - GetWindowRect (infoPtr->Buddy, &br); - MapWindowPoints (NULL, infoPtr->Self, (POINT*)&br, 2); - GetClientRect (infoPtr->Self, &r); - - if (infoPtr->dwStyle & UDS_ALIGNLEFT) - br.left = r.left; - else if (infoPtr->dwStyle & UDS_ALIGNRIGHT) - br.right = r.right; - /* FIXME: take disabled etc. into account */ - DrawThemeBackground (buddyTheme, hdc, 0, 0, &br, NULL); - return TRUE; + + if (theme && buddyTheme) + { + RECT br; + + GetWindowRect(infoPtr->Buddy, &br); + MapWindowPoints(NULL, infoPtr->Self, (POINT*)&br, 2); + GetClientRect(infoPtr->Self, &rect); + + if (infoPtr->dwStyle & UDS_ALIGNLEFT) + br.left = rect.left; + else if (infoPtr->dwStyle & UDS_ALIGNRIGHT) + br.right = rect.right; + /* FIXME: take disabled etc. into account */ + DrawThemeBackground(buddyTheme, hdc, 0, 0, &br, NULL); + return; + } + + GetClientRect(infoPtr->Self, &rect); + DrawEdge(hdc, &rect, EDGE_SUNKEN, BF_BOTTOM | BF_TOP | (infoPtr->dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT)); }
static BOOL UPDOWN_IsUpArrowPressed(const UPDOWN_INFO *infoPtr) @@ -463,14 +471,8 @@ static LRESULT UPDOWN_Draw (const UPDOWN_INFO *infoPtr, HDC hdc) }
/* Draw the common border between ourselves and our buddy */ - if (UPDOWN_NeedBuddyBackground(infoPtr)) { - if (!theme || !UPDOWN_DrawBuddyBackground (infoPtr, hdc)) { - GetClientRect(infoPtr->Self, &rect); - DrawEdge(hdc, &rect, EDGE_SUNKEN, - BF_BOTTOM | BF_TOP | - (infoPtr->dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT)); - } - } + if (UPDOWN_NeedBuddyBackground(infoPtr)) + UPDOWN_DrawBuddyBackground(infoPtr, hdc);
/* Draw the incr button */ UPDOWN_GetArrowRect (infoPtr, &rect, FLAG_INCR);
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/updown.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-)
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index f3cf58fd322..019099b6496 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -449,6 +449,29 @@ static BOOL UPDOWN_NeedBuddyBackground(const UPDOWN_INFO *infoPtr) return UPDOWN_HasBuddyBorder(infoPtr); }
+static void UPDOWN_DrawUpArrow(const UPDOWN_INFO *infoPtr, HDC hdc) +{ + RECT rect; + HTHEME theme = GetWindowTheme(infoPtr->Self); + + if (theme) + { + int part = 0, state = 0; + + UPDOWN_GetUpArrowThemePartAndState(infoPtr, &part, &state); + UPDOWN_GetArrowRect(infoPtr, &rect, FLAG_INCR); + DrawThemeBackground(theme, hdc, part, state, &rect, NULL); + return; + } + + UPDOWN_GetArrowRect(infoPtr, &rect, FLAG_INCR); + DrawFrameControl(hdc, &rect, DFC_SCROLL, + (infoPtr->dwStyle & UDS_HORZ ? DFCS_SCROLLRIGHT : DFCS_SCROLLUP) | + ((infoPtr->dwStyle & UDS_HOTTRACK) && UPDOWN_IsUpArrowHot(infoPtr) ? DFCS_HOT : 0) | + (UPDOWN_IsUpArrowPressed(infoPtr) ? DFCS_PUSHED : 0) | + (infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0)); +} + /*********************************************************************** * UPDOWN_Draw * @@ -456,17 +479,14 @@ static BOOL UPDOWN_NeedBuddyBackground(const UPDOWN_INFO *infoPtr) */ static LRESULT UPDOWN_Draw (const UPDOWN_INFO *infoPtr, HDC hdc) { - BOOL uPressed, uHot, dPressed, dHot; + BOOL dPressed, dHot; RECT rect; HTHEME theme = GetWindowTheme (infoPtr->Self); - int uPart = 0, uState = 0, dPart = 0, dState = 0; + int dPart = 0, dState = 0;
- uPressed = UPDOWN_IsUpArrowPressed(infoPtr); - uHot = UPDOWN_IsUpArrowHot(infoPtr); dPressed = UPDOWN_IsDownArrowPressed(infoPtr); dHot = UPDOWN_IsDownArrowHot(infoPtr); if (theme) { - UPDOWN_GetUpArrowThemePartAndState(infoPtr, &uPart, &uState); UPDOWN_GetDownArrowThemePartAndState(infoPtr, &dPart, &dState); }
@@ -475,16 +495,7 @@ static LRESULT UPDOWN_Draw (const UPDOWN_INFO *infoPtr, HDC hdc) UPDOWN_DrawBuddyBackground(infoPtr, hdc);
/* Draw the incr button */ - UPDOWN_GetArrowRect (infoPtr, &rect, FLAG_INCR); - if (theme) { - DrawThemeBackground(theme, hdc, uPart, uState, &rect, NULL); - } else { - DrawFrameControl(hdc, &rect, DFC_SCROLL, - (infoPtr->dwStyle & UDS_HORZ ? DFCS_SCROLLRIGHT : DFCS_SCROLLUP) | - ((infoPtr->dwStyle & UDS_HOTTRACK) && uHot ? DFCS_HOT : 0) | - (uPressed ? DFCS_PUSHED : 0) | - (infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) ); - } + UPDOWN_DrawUpArrow(infoPtr, hdc);
/* Draw the decr button */ UPDOWN_GetArrowRect(infoPtr, &rect, FLAG_DECR);
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/updown.c | 45 ++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 21 deletions(-)
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index 019099b6496..520b00adc0e 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -472,6 +472,29 @@ static void UPDOWN_DrawUpArrow(const UPDOWN_INFO *infoPtr, HDC hdc) (infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0)); }
+static void UPDOWN_DrawDownArrow(const UPDOWN_INFO *infoPtr, HDC hdc) +{ + RECT rect; + HTHEME theme = GetWindowTheme(infoPtr->Self); + + if (theme) + { + int part = 0, state = 0; + + UPDOWN_GetDownArrowThemePartAndState(infoPtr, &part, &state); + UPDOWN_GetArrowRect(infoPtr, &rect, FLAG_DECR); + DrawThemeBackground(theme, hdc, part, state, &rect, NULL); + return; + } + + UPDOWN_GetArrowRect(infoPtr, &rect, FLAG_DECR); + DrawFrameControl(hdc, &rect, DFC_SCROLL, + (infoPtr->dwStyle & UDS_HORZ ? DFCS_SCROLLLEFT : DFCS_SCROLLDOWN) | + ((infoPtr->dwStyle & UDS_HOTTRACK) && UPDOWN_IsDownArrowHot(infoPtr) ? DFCS_HOT : 0) | + (UPDOWN_IsDownArrowPressed(infoPtr) ? DFCS_PUSHED : 0) | + (infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) ); +} + /*********************************************************************** * UPDOWN_Draw * @@ -479,17 +502,6 @@ static void UPDOWN_DrawUpArrow(const UPDOWN_INFO *infoPtr, HDC hdc) */ static LRESULT UPDOWN_Draw (const UPDOWN_INFO *infoPtr, HDC hdc) { - BOOL dPressed, dHot; - RECT rect; - HTHEME theme = GetWindowTheme (infoPtr->Self); - int dPart = 0, dState = 0; - - dPressed = UPDOWN_IsDownArrowPressed(infoPtr); - dHot = UPDOWN_IsDownArrowHot(infoPtr); - if (theme) { - UPDOWN_GetDownArrowThemePartAndState(infoPtr, &dPart, &dState); - } - /* Draw the common border between ourselves and our buddy */ if (UPDOWN_NeedBuddyBackground(infoPtr)) UPDOWN_DrawBuddyBackground(infoPtr, hdc); @@ -498,16 +510,7 @@ static LRESULT UPDOWN_Draw (const UPDOWN_INFO *infoPtr, HDC hdc) UPDOWN_DrawUpArrow(infoPtr, hdc);
/* Draw the decr button */ - UPDOWN_GetArrowRect(infoPtr, &rect, FLAG_DECR); - if (theme) { - DrawThemeBackground(theme, hdc, dPart, dState, &rect, NULL); - } else { - DrawFrameControl(hdc, &rect, DFC_SCROLL, - (infoPtr->dwStyle & UDS_HORZ ? DFCS_SCROLLLEFT : DFCS_SCROLLDOWN) | - ((infoPtr->dwStyle & UDS_HOTTRACK) && dHot ? DFCS_HOT : 0) | - (dPressed ? DFCS_PUSHED : 0) | - (infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) ); - } + UPDOWN_DrawDownArrow(infoPtr, hdc);
return 0; }
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/updown.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index 520b00adc0e..afa96c87ec4 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -161,14 +161,18 @@ static BOOL UPDOWN_HasBuddyBorder(const UPDOWN_INFO *infoPtr)
static int UPDOWN_GetBuddyBorderSize(HWND hwnd) { +#if __WINE_COMCTL32_VERSION == 6 if (GetWindowTheme(hwnd)) return 1; +#endif
return DEFAULT_BUDDYBORDER; }
static int UPDOWN_GetBuddySpacerSize(HWND hwnd) { +#if __WINE_COMCTL32_VERSION == 6 if (GetWindowTheme(hwnd)) return 0; +#endif
return DEFAULT_BUDDYSPACER; } @@ -365,6 +369,7 @@ static BOOL UPDOWN_SetBuddyInt (const UPDOWN_INFO *infoPtr) static void UPDOWN_DrawBuddyBackground (const UPDOWN_INFO *infoPtr, HDC hdc) { RECT rect; +#if __WINE_COMCTL32_VERSION == 6 HTHEME theme = GetWindowTheme(infoPtr->Self); HTHEME buddyTheme = GetWindowTheme (infoPtr->Buddy);
@@ -384,6 +389,7 @@ static void UPDOWN_DrawBuddyBackground (const UPDOWN_INFO *infoPtr, HDC hdc) DrawThemeBackground(buddyTheme, hdc, 0, 0, &br, NULL); return; } +#endif
GetClientRect(infoPtr->Self, &rect); DrawEdge(hdc, &rect, EDGE_SUNKEN, BF_BOTTOM | BF_TOP | (infoPtr->dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT)); @@ -409,6 +415,7 @@ static BOOL UPDOWN_IsDownArrowHot(const UPDOWN_INFO *infoPtr) return infoPtr->Flags & FLAG_DECR && infoPtr->Flags & FLAG_MOUSEIN; }
+#if __WINE_COMCTL32_VERSION == 6 static void UPDOWN_GetUpArrowThemePartAndState(const UPDOWN_INFO *infoPtr, int *part, int *state) { BOOL pressed, hot; @@ -428,9 +435,11 @@ static void UPDOWN_GetDownArrowThemePartAndState(const UPDOWN_INFO *infoPtr, int *part = (infoPtr->dwStyle & UDS_HORZ) ? SPNP_DOWNHORZ : SPNP_DOWN; *state = (infoPtr->dwStyle & WS_DISABLED) ? DNS_DISABLED : (pressed ? DNS_PRESSED : (hot ? DNS_HOT : DNS_NORMAL)); } +#endif /* __WINE_COMCTL32_VERSION == 6 */
static BOOL UPDOWN_NeedBuddyBackground(const UPDOWN_INFO *infoPtr) { +#if __WINE_COMCTL32_VERSION == 6 HTHEME theme = GetWindowTheme(infoPtr->Self);
if (theme) @@ -445,6 +454,7 @@ static BOOL UPDOWN_NeedBuddyBackground(const UPDOWN_INFO *infoPtr) need_buddy_bg = IsWindow(infoPtr->Buddy) && (up_transparent || down_transparent); return UPDOWN_HasBuddyBorder(infoPtr) || need_buddy_bg; } +#endif
return UPDOWN_HasBuddyBorder(infoPtr); } @@ -452,6 +462,7 @@ static BOOL UPDOWN_NeedBuddyBackground(const UPDOWN_INFO *infoPtr) static void UPDOWN_DrawUpArrow(const UPDOWN_INFO *infoPtr, HDC hdc) { RECT rect; +#if __WINE_COMCTL32_VERSION == 6 HTHEME theme = GetWindowTheme(infoPtr->Self);
if (theme) @@ -463,6 +474,7 @@ static void UPDOWN_DrawUpArrow(const UPDOWN_INFO *infoPtr, HDC hdc) DrawThemeBackground(theme, hdc, part, state, &rect, NULL); return; } +#endif
UPDOWN_GetArrowRect(infoPtr, &rect, FLAG_INCR); DrawFrameControl(hdc, &rect, DFC_SCROLL, @@ -475,6 +487,7 @@ static void UPDOWN_DrawUpArrow(const UPDOWN_INFO *infoPtr, HDC hdc) static void UPDOWN_DrawDownArrow(const UPDOWN_INFO *infoPtr, HDC hdc) { RECT rect; +#if __WINE_COMCTL32_VERSION == 6 HTHEME theme = GetWindowTheme(infoPtr->Self);
if (theme) @@ -486,6 +499,7 @@ static void UPDOWN_DrawDownArrow(const UPDOWN_INFO *infoPtr, HDC hdc) DrawThemeBackground(theme, hdc, part, state, &rect, NULL); return; } +#endif
UPDOWN_GetArrowRect(infoPtr, &rect, FLAG_DECR); DrawFrameControl(hdc, &rect, DFC_SCROLL, @@ -966,7 +980,6 @@ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, INT x, INT static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd); - HTHEME theme;
TRACE("hwnd %p, msg %04x, wparam %Id, lparam %Ix\n", hwnd, message, wParam, lParam);
@@ -1005,7 +1018,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L if (infoPtr->dwStyle & UDS_AUTOBUDDY) UPDOWN_SetBuddy (infoPtr, GetWindow (hwnd, GW_HWNDPREV));
- OpenThemeData (hwnd, L"Spin"); + COMCTL32_OpenThemeForWindow (hwnd, L"Spin");
TRACE("UpDown Ctrl creation, hwnd=%p\n", hwnd); } @@ -1016,8 +1029,8 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L UPDOWN_ResetSubclass (infoPtr); Free (infoPtr); SetWindowLongPtrW (hwnd, 0, 0); - theme = GetWindowTheme (hwnd); - CloseThemeData (theme); + COMCTL32_CloseThemeForWindow (hwnd); + TRACE("UpDown Ctrl destruction, hwnd=%p\n", hwnd); break;
@@ -1042,11 +1055,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L break;
case WM_THEMECHANGED: - theme = GetWindowTheme (hwnd); - CloseThemeData (theme); - OpenThemeData (hwnd, L"Spin"); - InvalidateRect (hwnd, NULL, TRUE); - break; + return COMCTL32_ThemeChanged (hwnd, L"Spin", TRUE, TRUE);
case WM_TIMER: /* is this the auto-press timer? */
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/Makefile.in | 2 +- dlls/comctl32/comctl32.h | 2 ++ dlls/comctl32/commctrl.c | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/comctl32/Makefile.in b/dlls/comctl32/Makefile.in index d041f09cf32..a89ed5136ed 100644 --- a/dlls/comctl32/Makefile.in +++ b/dlls/comctl32/Makefile.in @@ -2,7 +2,7 @@ EXTRADEFS = -D_COMCTL32_ -D__WINE_COMCTL32_VERSION=5 MODULE = comctl32.dll IMPORTLIB = comctl32 IMPORTS = uuid user32 gdi32 advapi32 imm32 kernelbase oleaut32 -DELAYIMPORTS = oleacc winmm uxtheme +DELAYIMPORTS = oleacc winmm
SOURCES = \ animate.c \ diff --git a/dlls/comctl32/comctl32.h b/dlls/comctl32/comctl32.h index ca68906be62..a3b683d4410 100644 --- a/dlls/comctl32/comctl32.h +++ b/dlls/comctl32/comctl32.h @@ -34,9 +34,11 @@ #include "winuser.h" #include "winnls.h" #include "commctrl.h" +#if __WINE_COMCTL32_VERSION == 6 #include "uxtheme.h" #include "vsstyle.h" #include "vssym32.h" +#endif
extern HMODULE COMCTL32_hModule; extern HBRUSH COMCTL32_hPattern55AABrush; diff --git a/dlls/comctl32/commctrl.c b/dlls/comctl32/commctrl.c index 2aa31ca47f2..9bf342ea800 100644 --- a/dlls/comctl32/commctrl.c +++ b/dlls/comctl32/commctrl.c @@ -3209,5 +3209,9 @@ LRESULT COMCTL32_NCPaint(HWND hwnd, WPARAM wp, LPARAM lp, const WCHAR *theme_cla
BOOL COMCTL32_IsThemed(HWND hwnd) { +#if __WINE_COMCTL32_VERSION == 6 return !!GetWindowTheme(hwnd); +#else + return FALSE; +#endif }
This merge request was approved by Nikolay Sivov.