[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

svn path=/trunk/; revision=74406
This commit is contained in:
Giannis Adamopoulos 2017-04-25 11:19:22 +00:00
parent 83e0dd0595
commit e9846d6f9c
2 changed files with 41 additions and 5 deletions

View file

@ -113,6 +113,8 @@ static void PB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
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);
@ -123,6 +125,11 @@ static void PB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
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);
if (pdata->imlData.himl && ImageList_GetIconSize(pdata->imlData.himl, &ImageSize.cx, &ImageSize.cy))
@ -186,6 +193,8 @@ static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
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 @@ static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
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. */
@ -216,11 +240,6 @@ static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
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 @@ static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
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)) {
@ -296,6 +318,16 @@ static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
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);
SelectClipRgn(hDC, NULL);

View file

@ -938,7 +938,11 @@ TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdcDst)
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));