From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/monthcal.c | 43 +++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 25 deletions(-)
diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index ccbb57107d3..52a18eb0593 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -139,8 +139,6 @@ typedef struct SIZE dim; /* [cx,cy] - dimensions of calendars matrix, row/column count */ } MONTHCAL_INFO, *LPMONTHCAL_INFO;
-static const WCHAR themeClass[] = L"Scrollbar"; - /* empty SYSTEMTIME const */ static const SYSTEMTIME st_null; /* valid date limits */ @@ -820,10 +818,14 @@ static void MONTHCAL_DrawDay(const MONTHCAL_INFO *infoPtr, HDC hdc, const SYSTEM
static void MONTHCAL_PaintButton(MONTHCAL_INFO *infoPtr, HDC hdc, enum nav_direction button) { - HTHEME theme = GetWindowTheme (infoPtr->hwndSelf); RECT *r = button == DIRECTION_FORWARD ? &infoPtr->titlebtnnext : &infoPtr->titlebtnprev; BOOL pressed = button == DIRECTION_FORWARD ? infoPtr->status & MC_NEXTPRESSED : infoPtr->status & MC_PREVPRESSED; + int style; + +#if __WINE_COMCTL32_VERSION == 6 + HTHEME theme = GetWindowTheme (infoPtr->hwndSelf); + if (theme) { static const int states[] = { @@ -840,19 +842,20 @@ static void MONTHCAL_PaintButton(MONTHCAL_INFO *infoPtr, HDC hdc, enum nav_direc if (infoPtr->dwStyle & WS_DISABLED) stateNum += 2; } DrawThemeBackground (theme, hdc, SBP_ARROWBTN, states[stateNum], r, NULL); + return; } +#endif + + style = button == DIRECTION_FORWARD ? DFCS_SCROLLRIGHT : DFCS_SCROLLLEFT; + if (pressed) + style |= DFCS_PUSHED; else { - int style = button == DIRECTION_FORWARD ? DFCS_SCROLLRIGHT : DFCS_SCROLLLEFT; - if (pressed) - style |= DFCS_PUSHED; - else - { - if (infoPtr->dwStyle & WS_DISABLED) style |= DFCS_INACTIVE; - } - - DrawFrameControl(hdc, r, DFC_SCROLL, style); + if (infoPtr->dwStyle & WS_DISABLED) + style |= DFCS_INACTIVE; } + + DrawFrameControl(hdc, r, DFC_SCROLL, style); }
/* paint a title with buttons and month/year string */ @@ -2688,16 +2691,6 @@ static LRESULT MONTHCAL_SetFont(MONTHCAL_INFO *infoPtr, HFONT hFont, BOOL redraw return (LRESULT)hOldFont; }
-/* update theme after a WM_THEMECHANGED message */ -static LRESULT theme_changed (const MONTHCAL_INFO* infoPtr) -{ - HTHEME theme = GetWindowTheme (infoPtr->hwndSelf); - CloseThemeData (theme); - OpenThemeData (infoPtr->hwndSelf, themeClass); - InvalidateRect (infoPtr->hwndSelf, NULL, TRUE); - return 0; -} - static INT MONTHCAL_StyleChanged(MONTHCAL_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss) { @@ -2797,7 +2790,7 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs) /* today auto update timer, to be freed only on control destruction */ SetTimer(infoPtr->hwndSelf, MC_TODAYUPDATETIMER, MC_TODAYUPDATEDELAY, 0);
- OpenThemeData (infoPtr->hwndSelf, themeClass); + COMCTL32_OpenThemeForWindow(infoPtr->hwndSelf, L"Scrollbar");
return 0;
@@ -2817,7 +2810,7 @@ MONTHCAL_Destroy(MONTHCAL_INFO *infoPtr) Free(infoPtr->calendars); SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0);
- CloseThemeData (GetWindowTheme (infoPtr->hwndSelf)); + COMCTL32_CloseThemeForWindow(infoPtr->hwndSelf);
for (i = 0; i < BrushLast; i++) DeleteObject(infoPtr->brushes[i]); for (i = 0; i < PenLast; i++) DeleteObject(infoPtr->pens[i]); @@ -2991,7 +2984,7 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return MONTHCAL_Timer(infoPtr, wParam);
case WM_THEMECHANGED: - return theme_changed (infoPtr); + return COMCTL32_ThemeChanged(infoPtr->hwndSelf, L"Scrollbar", TRUE, TRUE);
case WM_DESTROY: return MONTHCAL_Destroy(infoPtr);