Simplify and correct MSW selection of background brush for children painting.

Check for the transparency of the window background in MSWGetBgBrush() itself
and let MSWGetBgBrushForChild() just return the brush to be used.

This required adding a MSW-specific hack to wxPanel to allow inheriting
background of wxNotebook by its children which is slightly ugly but is exactly
what we need to do in this case and makes the rest of the code much simpler.

Also add a possibility to set the background of the page containing the
control being tested to the widgets sample to test for background inheritance.
This shows problems with wxSlider and wxRadioBox backgrounds but they're not
new with this patch.

Closes #12057.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64372 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-05-21 12:51:20 +00:00
parent d3eb13d2aa
commit ebfee17940
8 changed files with 86 additions and 56 deletions

View File

@@ -395,16 +395,16 @@ public:
// the hDC parameter is the DC background will be drawn on, it can be used
// to call SetBrushOrgEx() on it if the returned brush is a bitmap one
//
// child parameter is never NULL
// child parameter is never NULL, it can be this window itself or one of
// its (grand)children
//
// the base class version returns a solid brush if we have a non default
// background colour or 0 otherwise
virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, wxWindowMSW *child);
// return the background brush to use for painting the given window by
// quering the parent windows via their MSWGetBgBrushForChild() recursively
WXHBRUSH MSWGetBgBrush(WXHDC hDC) { return MSWGetBgBrush(hDC, this); }
WXHBRUSH MSWGetBgBrush(WXHDC hDC, wxWindowMSW *child);
// querying the parent windows via MSWGetBgBrushForChild() recursively
WXHBRUSH MSWGetBgBrush(WXHDC hDC);
enum MSWThemeColour
{