Author: gadamopoulos Date: Tue Apr 25 11:19:22 2017 New Revision: 74406
URL: http://svn.reactos.org/svn/reactos?rev=74406&view=rev Log: [COMCTL32] - Button, Trakbar: Send WM_CTLCOLORBTN or WM_CTLCOLORSTATIC and use their return value to paint the control despite the fact that DrawThemeParentBackground was called as well. Part of the fix for CORE-12978
Modified: trunk/reactos/dll/win32/comctl32/theme_button.c trunk/reactos/dll/win32/comctl32/trackbar.c
Modified: trunk/reactos/dll/win32/comctl32/theme_button.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/theme_bu... ============================================================================== --- trunk/reactos/dll/win32/comctl32/theme_button.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/theme_button.c [iso-8859-1] Tue Apr 25 11:19:22 2017 @@ -113,6 +113,8 @@ WCHAR *text = get_button_text(hwnd); PBUTTON_DATA pdata = _GetButtonData(hwnd); SIZE ImageSize; + HWND parent; + HBRUSH hBrush;
GetClientRect(hwnd, &bgRect); GetThemeBackgroundContentRect(theme, hDC, BP_PUSHBUTTON, state, &bgRect, &textRect); @@ -122,6 +124,11 @@ if (IsThemeBackgroundPartiallyTransparent(theme, BP_PUSHBUTTON, state)) DrawThemeParentBackground(hwnd, hDC, NULL); } + + parent = GetParent(hwnd); + if (!parent) parent = hwnd; + hBrush = (HBRUSH)SendMessageW( parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)hwnd ); + FillRect( hDC, &bgRect, hBrush );
DrawThemeBackground(theme, hDC, BP_PUSHBUTTON, state, &bgRect, NULL);
@@ -186,6 +193,8 @@ WCHAR *text = get_button_text(hwnd); LOGFONTW lf; BOOL created_font = FALSE; + HWND parent; + HBRUSH hBrush;
HRESULT hr = GetThemeFont(theme, hDC, part, state, TMT_FONT, &lf); if (SUCCEEDED(hr)) { @@ -206,6 +215,21 @@ sz.cx = sz.cy = 13;
GetClientRect(hwnd, &bgRect); + + if (prfFlag == 0) + { + DrawThemeParentBackground(hwnd, hDC, NULL); + } + + parent = GetParent(hwnd); + if (!parent) parent = hwnd; + hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC, + (WPARAM)hDC, (LPARAM)hwnd); + if (!hBrush) /* did the app forget to call defwindowproc ? */ + hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC, + (WPARAM)hDC, (LPARAM)hwnd ); + FillRect( hDC, &bgRect, hBrush ); + GetThemeBackgroundContentRect(theme, hDC, part, state, &bgRect, &textRect);
if (dtFlags & DT_SINGLELINE) /* Center the checkbox / radio button to the text. */ @@ -215,11 +239,6 @@ bgRect.bottom = bgRect.top + sz.cy; bgRect.right = bgRect.left + sz.cx; textRect.left = bgRect.right + 6; - - if (prfFlag == 0) - { - DrawThemeParentBackground(hwnd, hDC, NULL); - }
DrawThemeBackground(theme, hDC, part, state, &bgRect, NULL); if (text) @@ -257,6 +276,9 @@ LOGFONTW lf; HFONT font, hPrevFont = NULL; BOOL created_font = FALSE; + HWND parent; + HBRUSH hBrush; + RECT clientRect;
HRESULT hr = GetThemeFont(theme, hDC, BP_GROUPBOX, state, TMT_FONT, &lf); if (SUCCEEDED(hr)) { @@ -295,6 +317,16 @@ if (IsThemeBackgroundPartiallyTransparent(theme, BP_GROUPBOX, state)) DrawThemeParentBackground(hwnd, hDC, NULL); } + + parent = GetParent(hwnd); + if (!parent) parent = hwnd; + hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC, + (WPARAM)hDC, (LPARAM)hwnd); + if (!hBrush) /* did the app forget to call defwindowproc ? */ + hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC, + (WPARAM)hDC, (LPARAM)hwnd ); + GetClientRect(hwnd, &clientRect); + FillRect( hDC, &clientRect, hBrush );
DrawThemeBackground(theme, hDC, BP_GROUPBOX, state, &bgRect, NULL);
Modified: trunk/reactos/dll/win32/comctl32/trackbar.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/trackbar... ============================================================================== --- trunk/reactos/dll/win32/comctl32/trackbar.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/trackbar.c [iso-8859-1] Tue Apr 25 11:19:22 2017 @@ -938,7 +938,11 @@ if (GetWindowTheme (infoPtr->hwndSelf)) { DrawThemeParentBackground (infoPtr->hwndSelf, hdc, 0); } +#ifndef __REACTOS__ else { +#else + { +#endif HBRUSH brush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC, (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf); FillRect (hdc, &rcClient, brush ? brush : GetSysColorBrush(COLOR_BTNFACE));