From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Sun, 9 Oct 2011 22:01:57 +0000 (+0000)
Subject: Fix inheriting parent background colour in wxPanel in wxMSW.
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4506b42ce9ad4d6ef9c4eb2650df84fd9eb4f031

Fix inheriting parent background colour in wxPanel in wxMSW.

wxPanel didn't inherit the background colour set for its parent any more in
wxMSW because its HasTransparentBackground() didn't return true unless the
panel was a child of wxNotebook. This was wrong because not only themed
notebook background should be inherited but also any solid background
explicitly set for a panel parent.

Fix this by returning true from MSWHasInheritableBackground(), which is used
by wxPanel::HasTransparentBackground() under MSW, if the window has an
explicitly set and inheritable background colour.

Closes #13487.

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

diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h
index 95a9d72206..6526461c31 100644
--- a/include/wx/msw/window.h
+++ b/include/wx/msw/window.h
@@ -467,7 +467,13 @@ public:
     // This should be overridden to return true for the controls which have
     // themed background that should through their children. Currently only
     // wxNotebook uses this.
-    virtual bool MSWHasInheritableBackground() const { return false; }
+    //
+    // The base class version already returns true if we have a solid
+    // background colour that should be propagated to our children.
+    virtual bool MSWHasInheritableBackground() const
+    {
+        return InheritsBackgroundColour();
+    }
 
 #if !defined(__WXWINCE__) && !defined(__WXUNIVERSAL__)
     #define wxHAS_MSW_BACKGROUND_ERASE_HOOK