Fix incorrect painting of backgrounds inside notebook.

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
This commit is contained in:
Václav Slavík
2010-05-16 13:21:03 +00:00
parent e91ce12d73
commit 8c62319a81

View 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