]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/notebook.cpp
Add missing samples to samples.dsw.
[wxWidgets.git] / src / msw / notebook.cpp
index 82304be26939888b013fe7b848d11ecf86160a18..333a22bfc94cfc3c4e1d73f7d133603ad33adc24 100644 (file)
@@ -30,6 +30,7 @@
     #include "wx/dcclient.h"
     #include "wx/dcmemory.h"
     #include "wx/control.h"
     #include "wx/dcclient.h"
     #include "wx/dcmemory.h"
     #include "wx/control.h"
+    #include "wx/panel.h"
 #endif  // WX_PRECOMP
 
 #include "wx/imaglist.h"
 #endif  // WX_PRECOMP
 
 #include "wx/imaglist.h"
@@ -492,6 +493,8 @@ int wxNotebook::ChangeSelection(size_t nPage)
 {
     wxCHECK_MSG( IS_VALID_PAGE(nPage), wxNOT_FOUND, wxT("notebook page out of range") );
 
 {
     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);
     if ( m_nSelection == wxNOT_FOUND || nPage != (size_t)m_nSelection )
     {
         TabCtrl_SetCurSel(GetHwnd(), nPage);
@@ -499,7 +502,7 @@ int wxNotebook::ChangeSelection(size_t nPage)
         UpdateSelection(nPage);
     }
 
         UpdateSelection(nPage);
     }
 
-    return m_nSelection;
+    return selOld;
 }
 
 bool wxNotebook::SetPageText(size_t nPage, const wxString& strText)
 }
 
 bool wxNotebook::SetPageText(size_t nPage, const wxString& strText)
@@ -816,6 +819,14 @@ bool wxNotebook::InsertPage(size_t nPage,
     // succeeded: save the pointer to the page
     m_pages.Insert(pPage, nPage);
 
     // succeeded: save the pointer to the page
     m_pages.Insert(pPage, nPage);
 
+    // also ensure that the notebook background is used for its pages by making
+    // them transparent: this ensures that MSWGetBgBrush() queries the notebook
+    // for the background brush to be used for erasing them
+    if ( wxPanel *panel = wxDynamicCast(pPage, wxPanel) )
+    {
+        panel->MSWSetTransparentBackground();
+    }
+
     // we may need to adjust the size again if the notebook size changed:
     // normally this only happens for the first page we add (the tabs which
     // hadn't been there before are now shown) but for a multiline notebook it
     // we may need to adjust the size again if the notebook size changed:
     // normally this only happens for the first page we add (the tabs which
     // hadn't been there before are now shown) but for a multiline notebook it
@@ -1248,14 +1259,14 @@ void wxNotebook::UpdateBgBrush()
     }
 }
 
     }
 }
 
-WXHBRUSH wxNotebook::MSWGetBgBrushForChild(WXHDC hDC, WXHWND hWnd)
+WXHBRUSH wxNotebook::MSWGetBgBrushForChild(WXHDC hDC, wxWindow *child)
 {
     if ( m_hbrBackground )
     {
         // before drawing with the background brush, we need to position it
         // correctly
         RECT rc;
 {
     if ( m_hbrBackground )
     {
         // before drawing with the background brush, we need to position it
         // correctly
         RECT rc;
-        ::GetWindowRect((HWND)hWnd, &rc);
+        ::GetWindowRect(GetHwndOf(child), &rc);
 
         ::MapWindowPoints(NULL, GetHwnd(), (POINT *)&rc, 1);
 
 
         ::MapWindowPoints(NULL, GetHwnd(), (POINT *)&rc, 1);
 
@@ -1267,7 +1278,7 @@ WXHBRUSH wxNotebook::MSWGetBgBrushForChild(WXHDC hDC, WXHWND hWnd)
         return m_hbrBackground;
     }
 
         return m_hbrBackground;
     }
 
-    return wxNotebookBase::MSWGetBgBrushForChild(hDC, hWnd);
+    return wxNotebookBase::MSWGetBgBrushForChild(hDC, child);
 }
 
 bool wxNotebook::MSWPrintChild(WXHDC hDC, wxWindow *child)
 }
 
 bool wxNotebook::MSWPrintChild(WXHDC hDC, wxWindow *child)