check for any parent with non default background in wxControl::MSWControlColor(), not just wxNotebook

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30971 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-12-12 20:21:16 +00:00
parent 7af99268d4
commit 5554336399

View File

@@ -358,9 +358,7 @@ WXHBRUSH wxControl::MSWControlColor(WXHDC pDC)
::SetBkMode((HDC)pDC, TRANSPARENT); ::SetBkMode((HDC)pDC, TRANSPARENT);
#if wxUSE_UXTHEME && wxUSE_NOTEBOOK // check if we should adapt our background to our parent
if ( wxUxThemeEngine::GetIfActive() )
{
for ( wxWindow *win = this; win; win = win->GetParent() ) for ( wxWindow *win = this; win; win = win->GetParent() )
{ {
if ( win->IsTopLevel() ) if ( win->IsTopLevel() )
@@ -369,6 +367,22 @@ WXHBRUSH wxControl::MSWControlColor(WXHDC pDC)
break; break;
} }
if ( win->GetBackgroundStyle() == wxBG_STYLE_COLOUR )
{
// parent window has solid colour, so it doesn't look
// transparent and hence we shouldn't show notebook background
wxBrush *brush = wxTheBrushList->FindOrCreateBrush
(
win->GetBackgroundColour(),
wxSOLID
);
return (WXHBRUSH)brush->GetResourceHandle();
}
#if wxUSE_UXTHEME && wxUSE_NOTEBOOK
// check for the special case of the notebooks which draw themed
// background when themes are enabled
wxNotebook *nbook = wxDynamicCast(win, wxNotebook); wxNotebook *nbook = wxDynamicCast(win, wxNotebook);
if ( nbook ) if ( nbook )
{ {
@@ -377,9 +391,8 @@ WXHBRUSH wxControl::MSWControlColor(WXHDC pDC)
// this message at all, so let default processing take place // this message at all, so let default processing take place
return nbook->GetThemeBackgroundBrush(pDC, this); return nbook->GetThemeBackgroundBrush(pDC, this);
} }
#endif // wxUSE_UXTHEME && wxUSE_NOTEBOOK
} }
}
#endif // wxUSE_UXTHEME
// let the control deal with background itself // let the control deal with background itself
return MSWGetDefaultBgBrush(); return MSWGetDefaultBgBrush();