]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix incorrect painting of backgrounds inside notebook.
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 16 May 2010 13:21:03 +0000 (13:21 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 16 May 2010 13:21:03 +0000 (13:21 +0000)
Children without transparent background (e.g. wxListBox) were still
pained using notebook's background brush. They shouldn't, it should
apply only to transparent-bg controls.

This fix is not perfect, see #12057.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64314 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/notebook.cpp

index 87a6ca1a35875f110c80b7b7a80213a205ffa03a..7148d34139424790a81ead54c004b9eb769824d6 100644 (file)
@@ -1252,7 +1252,23 @@ void wxNotebook::UpdateBgBrush()
 
 WXHBRUSH wxNotebook::MSWGetBgBrushForChild(WXHDC hDC, wxWindow *child)
 {
-    if ( m_hbrBackground )
+    // Only apply to notebook pages and transparent children, see
+    // wxWindow::MSWGetBgBrushForChild() for explanation
+    bool shouldApply;
+    if ( child->GetParent() == this )
+    {
+        // notebook page -- apply background
+        shouldApply = true;
+    }
+    else
+    {
+        // controls in a notebook page with transparent background should
+        // be handled too
+        shouldApply = child->HasTransparentBackground() &&
+                      child->GetParent()->GetParent() == this;
+    }
+
+    if ( m_hbrBackground && shouldApply )
     {
         // before drawing with the background brush, we need to position it
         // correctly