From 8c62319a8167892bd8d41e04b8b53729d48c3af1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 16 May 2010 13:21:03 +0000 Subject: [PATCH] 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 --- src/msw/notebook.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 87a6ca1a35..7148d34139 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -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 -- 2.45.2