]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/notebook.cpp
another GetInt/GetId bug fix
[wxWidgets.git] / src / msw / notebook.cpp
index 63d108cf3288c7bca8c0aa5fb398a47f9d3111c0..dbaa99823a4ae7038f975c9c1b6d5b81445fc6b2 100644 (file)
 #include  <windowsx.h>  // for SetWindowFont
 
 #ifndef __TWIN32__
-#ifdef __GNUWIN32__
-#ifndef wxUSE_NORLANDER_HEADERS
-  #include "wx/msw/gnuwin32/extra.h"
-#endif
-#endif
+    #ifdef __GNUWIN32_OLD__
+        #include "wx/msw/gnuwin32/extra.h"
+    #endif
 #endif
 
-#if !defined(__GNUWIN32__) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS)
-  #include <commctrl.h>
+#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__))
+    #include <commctrl.h>
 #endif
 
 // ----------------------------------------------------------------------------
@@ -108,6 +106,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
 void wxNotebook::Init()
 {
   m_pImageList = NULL;
+  m_bOwnsImageList = FALSE;
   m_nSelection = -1;
 }
 
@@ -190,6 +189,7 @@ bool wxNotebook::Create(wxWindow *parent,
 // dtor
 wxNotebook::~wxNotebook()
 {
+  if (m_bOwnsImageList) delete m_pImageList;
 }
 
 // ----------------------------------------------------------------------------
@@ -278,10 +278,18 @@ bool wxNotebook::SetPageImage(int nPage, int nImage)
 
 void wxNotebook::SetImageList(wxImageList* imageList)
 {
+  if (m_bOwnsImageList) delete m_pImageList;
   m_pImageList = imageList;
+  m_bOwnsImageList = FALSE;
   TabCtrl_SetImageList(m_hwnd, (HIMAGELIST)imageList->GetHIMAGELIST());
 }
 
+void wxNotebook::AssignImageList(wxImageList* imageList)
+{
+  SetImageList(imageList);
+  m_bOwnsImageList = TRUE;
+}
+
 // ----------------------------------------------------------------------------
 // wxNotebook size settings
 // ----------------------------------------------------------------------------