Fix background of wxRadioBox buttons and wxSlider labels in wxMSW.

Handle WM_CTLCOLOR correctly for them, this wasn't done before because the
code assumed that sub-windows (i.e. HWNDs which belong to the same logical wx
control) were always children of the main window, but they could also be its
siblings (like in at least the two above mentioned cases).

Account for this case in wxControl::DoMSWControlColor() too now.

Closes #12271.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76984 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-08-03 12:47:20 +00:00
parent 0ab7522921
commit b932b899af

View File

@ -380,7 +380,18 @@ WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd)
// If this HWND doesn't correspond to a wxWindow, it still might be
// one of its children for which we need to set the background
// brush, e.g. this is the case for the EDIT control that is part
// of wxComboBox. Check for this by asking the parent if it has it:
// of wxComboBox but also e.g. of wxSlider label HWNDs which are
// logically part of it, but are siblings of the main control at
// Windows level.
//
// So check whether it's a sibling of this window which is part of
// the same wx object.
if ( ContainsHWND(hWnd) )
{
win = this;
}
else // Or maybe a child sub-window of this one.
{
HWND parent = ::GetParent(hWnd);
if ( parent )
{
@ -389,6 +400,7 @@ WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd)
win = winParent;
}
}
}
if ( win )
hbr = win->MSWGetBgBrush(pDC);