]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/notebook.cpp
Fixed HRGN leak in DoSetClippingRegion
[wxWidgets.git] / src / msw / notebook.cpp
index dc4f4d5d4c176c0f592f1cb8f4ca608373f74c95..c6c7066c5b35a06a2ed316c3d0943657d61d1f8a 100644 (file)
@@ -110,7 +110,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
 // common part of all ctors
 void wxNotebook::Init()
 {
-  m_bOwnsImageList = FALSE;
   m_imageList = NULL;
   m_nSelection = -1;
 }
@@ -193,16 +192,10 @@ bool wxNotebook::Create(wxWindow *parent,
   return TRUE;
 }
 
-// dtor
-wxNotebook::~wxNotebook()
-{
-  if (m_bOwnsImageList)
-      delete m_imageList;
-}
-
 // ----------------------------------------------------------------------------
 // wxNotebook accessors
 // ----------------------------------------------------------------------------
+
 int wxNotebook::GetPageCount() const
 {
   // consistency check
@@ -276,21 +269,12 @@ bool wxNotebook::SetPageImage(int nPage, int nImage)
 
 void wxNotebook::SetImageList(wxImageList* imageList)
 {
-  if ( m_bOwnsImageList )
+  wxNotebookBase::SetImageList(imageList);
+
+  if ( imageList )
   {
-      delete m_imageList;
+    TabCtrl_SetImageList(m_hwnd, (HIMAGELIST)imageList->GetHIMAGELIST());
   }
-
-  m_bOwnsImageList = FALSE;
-  m_imageList = imageList;
-
-  TabCtrl_SetImageList(m_hwnd, (HIMAGELIST)imageList->GetHIMAGELIST());
-}
-
-void wxNotebook::AssignImageList(wxImageList* imageList)
-{
-  SetImageList(imageList);
-  m_bOwnsImageList = TRUE;
 }
 
 // ----------------------------------------------------------------------------
@@ -358,13 +342,12 @@ bool wxNotebook::DeletePage(int nPage)
 // remove one page from the notebook, without deleting
 wxNotebookPage *wxNotebook::DoRemovePage(int nPage)
 {
-  wxCHECK_MSG( IS_VALID_PAGE(nPage), NULL, wxT("notebook page out of range") );
+  wxNotebookPage *pageRemoved = wxNotebookBase::DoRemovePage(nPage);
+  if ( !pageRemoved )
+      return NULL;
 
   TabCtrl_DeleteItem(m_hwnd, nPage);
 
-  wxNotebookPage *pageRemoved = m_pages[nPage];
-  m_pages.Remove(nPage);
-
   if ( m_pages.IsEmpty() )
     m_nSelection = -1;
   else