]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/notebook.cpp
Added quick implementation of wxDataViewChoiceByIndexRenderer, closes #11970 (wxDataV...
[wxWidgets.git] / src / msw / notebook.cpp
index 831680858f107f4450e31b0274a04455e428ddc2..7148d34139424790a81ead54c004b9eb769824d6 100644 (file)
@@ -492,6 +492,8 @@ int wxNotebook::ChangeSelection(size_t nPage)
 {
     wxCHECK_MSG( IS_VALID_PAGE(nPage), wxNOT_FOUND, wxT("notebook page out of range") );
 
+    const int selOld = m_nSelection;
+
     if ( m_nSelection == wxNOT_FOUND || nPage != (size_t)m_nSelection )
     {
         TabCtrl_SetCurSel(GetHwnd(), nPage);
@@ -499,7 +501,7 @@ int wxNotebook::ChangeSelection(size_t nPage)
         UpdateSelection(nPage);
     }
 
-    return m_nSelection;
+    return selOld;
 }
 
 bool wxNotebook::SetPageText(size_t nPage, const wxString& strText)
@@ -1250,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