Inherit notebook background recursively under wxMSW.
With MSWSetTransparentBackground() hack only the panel which was the immediate child of wxNotebook (i.e. its page) inherited the notebook background but not its children. This resulted in jarring background discontinuities when nested panels were used. Fix this by inheriting notebook background in all child panels by testing for the return value of the parents MSWHasInheritableBackground() method in wxPanel::HasTransparentBackground() recursively. Closes #12317. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65238 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -77,17 +77,10 @@ public:
|
||||
#endif
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// This is a hack to support inheriting of background through child
|
||||
// wxPanel: at least wxNotebook needs this under wxMSW as its background
|
||||
// should apply to its children which are usually wxPanels which normally
|
||||
// don't have a transparent background. Calling this function allows to
|
||||
// change this for the panels which are used as notebook pages.
|
||||
void MSWSetTransparentBackground(bool isTransparent = true)
|
||||
{
|
||||
m_isTransparent = isTransparent;
|
||||
}
|
||||
|
||||
virtual bool HasTransparentBackground() { return m_isTransparent; }
|
||||
// This is overridden for MSW to return true for all panels that are child
|
||||
// of a window with themed background (such as wxNotebook) which should
|
||||
// show through the child panels.
|
||||
virtual bool HasTransparentBackground();
|
||||
#endif // __WXMSW__
|
||||
|
||||
WX_DECLARE_CONTROL_CONTAINER();
|
||||
@@ -100,10 +93,6 @@ protected:
|
||||
virtual wxBorder GetDefaultBorder() const { return wxWindowBase::GetDefaultBorder(); }
|
||||
|
||||
private:
|
||||
#ifdef __WXMSW__
|
||||
bool m_isTransparent;
|
||||
#endif // __WXMSW__
|
||||
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxPanel)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
Reference in New Issue
Block a user