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/branches/WX_3_0_BRANCH@76950 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-07-25 17:34:07 +00:00
parent 5c51b91562
commit 8b38ba9726
2 changed files with 20 additions and 7 deletions

View File

@@ -595,6 +595,7 @@ wxMSW:
- Fix Cygwin 1.7 build.
- Include x64 configurations in MSVC 8/9 project files too.
- Fix parallel build of MSVC 11/12 solutions (Artur Wieczorek).
- Fix background of wxRadioBox buttons and wxSlider (Artur Wieczorek).
- Fix appearance of wxToggleButtons with non default colours (Artur Wieczorek).

View File

@@ -372,14 +372,26 @@ 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:
HWND parent = ::GetParent(hWnd);
if ( parent )
// 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) )
{
wxWindow *winParent = wxFindWinFromHandle( parent );
if( winParent && winParent->ContainsHWND( hWnd ) )
win = winParent;
}
win = this;
}
else // Or maybe a child sub-window of this one.
{
HWND parent = ::GetParent(hWnd);
if ( parent )
{
wxWindow *winParent = wxFindWinFromHandle( parent );
if( winParent && winParent->ContainsHWND( hWnd ) )
win = winParent;
}
}
}
if ( win )