]> git.saurik.com Git - wxWidgets.git/commitdiff
check for any parent with non default background in wxControl::MSWControlColor()...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 12 Dec 2004 20:21:16 +0000 (20:21 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 12 Dec 2004 20:21:16 +0000 (20:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30971 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/control.cpp

index 7dc54a51146a5c8129c57b655f3abeeda2cfbe91..304829225a6104f85e147f603bf260bbe29aaaf5 100644 (file)
@@ -358,28 +358,41 @@ WXHBRUSH wxControl::MSWControlColor(WXHDC pDC)
 
     ::SetBkMode((HDC)pDC, TRANSPARENT);
 
 
     ::SetBkMode((HDC)pDC, TRANSPARENT);
 
-#if wxUSE_UXTHEME && wxUSE_NOTEBOOK
-    if ( wxUxThemeEngine::GetIfActive() )
+    // check if we should adapt our background to our parent
+    for ( wxWindow *win = this; win; win = win->GetParent() )
     {
     {
-        for ( wxWindow *win = this; win; win = win->GetParent() )
+        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 )
         {
         {
-            if ( win->IsTopLevel() )
-            {
-                // don't go beyond the first top level parent
-                break;
-            }
-
-            wxNotebook *nbook = wxDynamicCast(win, wxNotebook);
-            if ( nbook )
-            {
-                // return value may be NULL but it is ok: if the first parent
-                // notebook doesn't use themes, then we don't have to process
-                // this message at all, so let default processing take place
-                return nbook->GetThemeBackgroundBrush(pDC, this);
-            }
+            // return value may be NULL but it is ok: if the first parent
+            // notebook doesn't use themes, then we don't have to process
+            // this message at all, so let default processing take place
+            return nbook->GetThemeBackgroundBrush(pDC, this);
         }
         }
+#endif // wxUSE_UXTHEME && wxUSE_NOTEBOOK
     }
     }
-#endif // wxUSE_UXTHEME
 
     // let the control deal with background itself
     return MSWGetDefaultBgBrush();
 
     // let the control deal with background itself
     return MSWGetDefaultBgBrush();