+ if ( win->IsTopLevel() )
+ {
+ // don't go beyond the first top level parent
+ 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);
+ if ( nbook )