]> git.saurik.com Git - wxWidgets.git/commitdiff
Add wxWithImages helper mix-in with {Set,Get,Assign}ImageList() methods.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 21 Aug 2011 14:08:43 +0000 (14:08 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 21 Aug 2011 14:08:43 +0000 (14:08 +0000)
Avoid defining SetImageList() in several different places in wx API as not
only this resulted in (trivial) code duplication but this method also had
different semantics before: it didn't take ownership of the pointer passed to
it in wxTreeCtrl, wxListCtrl and wxBookCtrl and derived classes but did take
its ownership in wxDataViewTreeCtrl and wxRichTextFormattingDialog.

Harmonize this for all the classes now: SetImageList() never takes ownership
while AssignImageList() (which is now available in all classes having
SetImageList()) always does.

Also add convenience wxWithImages::GetImage() helper to avoid (more) code
duplication in wxDataViewTreeCtrl code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68809 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

17 files changed:
Makefile.in
build/bakefiles/files.bkl
build/msw/wx_core.dsp
build/msw/wx_vc7_core.vcproj
build/msw/wx_vc8_core.vcproj
build/msw/wx_vc9_core.vcproj
include/wx/bookctrl.h
include/wx/dataview.h
include/wx/richtext/richtextformatdlg.h
include/wx/withimages.h [new file with mode: 0644]
samples/dataview/dataview.cpp
src/common/bookctrl.cpp
src/common/datavcmn.cpp
src/gtk/notebook.cpp
src/msw/notebook.cpp
src/osx/notebook_osx.cpp
src/richtext/richtextformatdlg.cpp

index e156c7e867ef7ac15a95369256da49f38be18ed9..5484f93194cde2c04244851f7196cea0dbc7115f 100644 (file)
@@ -3946,6 +3946,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS =  \
        wx/valnum.h \
        wx/window.h \
        wx/windowid.h \
+       wx/withimages.h \
        wx/wrapsizer.h \
        wx/wupdlock.h \
        wx/accel.h \
index 02dbf51f0948cbd07d2d2ddf3b6f2bce8044a3d2..b4434de65634ba390a68549cbf8d0f88ac1f023b 100644 (file)
@@ -920,6 +920,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     wx/valnum.h
     wx/window.h
     wx/windowid.h
+    wx/withimages.h
     wx/wrapsizer.h
     wx/wupdlock.h
 
index 5b6ecf620fdcf8a8323cdcfb7e3529d30be19bbf..b29e9c77324163a99df908aa17373595d52d3c92 100644 (file)
@@ -6960,6 +6960,10 @@ SOURCE=..\..\include\wx\windowid.h
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\include\wx\withimages.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\include\wx\wizard.h\r
 # End Source File\r
 # Begin Source File\r
index 94a0489a2ce79709d3ca6f2d8420d1f755a50da9..30aa6ce196eb40858f48335bc170e587d101fd63 100644 (file)
                                RelativePath="..\..\include\wx\windowid.h">\r
                        </File>\r
                        <File\r
+                               RelativePath="..\..\include\wx\withimages.h">
+                       </File>
+                       <File
                                RelativePath="..\..\include\wx\wizard.h">\r
                        </File>\r
                        <File\r
index 274e33168181ae81848a43f8c12b71d57a65dabb..8c1e61804054add4178931236952f87671a0eed0 100644 (file)
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath="..\..\include\wx\withimages.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\..\include\wx\wizard.h"\r
                                >\r
                        </File>\r
index 7dbebad0988c3479bd9e7bb79fcf6eab734e1823..06b39192c03a303fc03fd7b4b0f10df07b0641a2 100644 (file)
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath="..\..\include\wx\withimages.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\..\include\wx\wizard.h"\r
                                >\r
                        </File>\r
index 86a89acfd13c2b634cbcd136049da14382625a6f..bc2b89d8b33ac7a6cc50417307654a75feb792ad 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "wx/control.h"
 #include "wx/dynarray.h"
+#include "wx/withimages.h"
 
 WX_DEFINE_EXPORTED_ARRAY_PTR(wxWindow *, wxArrayPages);
 
@@ -54,7 +55,8 @@ enum
 // wxBookCtrlBase
 // ----------------------------------------------------------------------------
 
-class WXDLLIMPEXP_CORE wxBookCtrlBase : public wxControl
+class WXDLLIMPEXP_CORE wxBookCtrlBase : public wxControl,
+                                        public wxWithImages
 {
 public:
     // construction
@@ -85,9 +87,6 @@ public:
                 long style = 0,
                 const wxString& name = wxEmptyString);
 
-    // dtor
-    virtual ~wxBookCtrlBase();
-
 
     // accessors
     // ---------
@@ -117,15 +116,6 @@ public:
     // images belong to the same image list)
     // ---------------------------------------------------------------------
 
-    // sets the image list to use, it is *not* deleted by the control
-    virtual void SetImageList(wxImageList *imageList);
-
-    // as SetImageList() but we will delete the image list ourselves
-    void AssignImageList(wxImageList *imageList);
-
-    // get pointer (may be NULL) to the associated image list
-    wxImageList* GetImageList() const { return m_imageList; }
-
     // sets/returns item's image index in the current image list
     virtual int GetPageImage(size_t n) const = 0;
     virtual bool SetPageImage(size_t n, int imageId) = 0;
@@ -320,12 +310,6 @@ protected:
     // the array of all pages of this control
     wxArrayPages m_pages;
 
-    // the associated image list or NULL
-    wxImageList *m_imageList;
-
-    // true if we must delete m_imageList
-    bool m_ownsImageList;
-
     // get the page area
     virtual wxRect GetPageRect() const;
 
index 87bfcf12e22c59cb13265a6f313b23480dbe25db..ff6e3b31e3c4649b180eb858190fdbccc614d1d5 100644 (file)
@@ -24,6 +24,7 @@
 #include "wx/weakref.h"
 #include "wx/vector.h"
 #include "wx/dataobj.h"
+#include "wx/withimages.h"
 
 class WXDLLIMPEXP_FWD_CORE wxImageList;
 
@@ -1230,10 +1231,11 @@ public:
 
 //-----------------------------------------------------------------------------
 
-class WXDLLIMPEXP_ADV wxDataViewTreeCtrl: public wxDataViewCtrl
+class WXDLLIMPEXP_ADV wxDataViewTreeCtrl: public wxDataViewCtrl,
+                                          public wxWithImages
 {
 public:
-    wxDataViewTreeCtrl() { Init(); }
+    wxDataViewTreeCtrl() { }
     wxDataViewTreeCtrl(wxWindow *parent,
                        wxWindowID id,
                        const wxPoint& pos = wxDefaultPosition,
@@ -1241,13 +1243,9 @@ public:
                        long style = wxDV_NO_HEADER | wxDV_ROW_LINES,
                        const wxValidator& validator = wxDefaultValidator)
     {
-        Init();
-
         Create(parent, id, pos, size, style, validator);
     }
 
-    virtual ~wxDataViewTreeCtrl();
-
     bool Create(wxWindow *parent,
                 wxWindowID id,
                 const wxPoint& pos = wxDefaultPosition,
@@ -1263,9 +1261,6 @@ public:
     bool IsContainer( const wxDataViewItem& item ) const
         { return GetStore()->IsContainer(item); }
 
-    void SetImageList( wxImageList *imagelist );
-    wxImageList* GetImageList() { return m_imageList; }
-
     wxDataViewItem AppendItem( const wxDataViewItem& parent,
         const wxString &text, int icon = -1, wxClientData *data = NULL );
     wxDataViewItem PrependItem( const wxDataViewItem& parent,
@@ -1310,14 +1305,6 @@ public:
     void OnCollapsed( wxDataViewEvent &event );
     void OnSize( wxSizeEvent &event );
 
-private:
-    void Init()
-    {
-        m_imageList = NULL;
-    }
-
-    wxImageList *m_imageList;
-
 private:
     DECLARE_EVENT_TABLE()
     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewTreeCtrl)
index 9b0898e491d19e213ddcc3291a4794e5859727c1..53abf8ac7d5f38430dca3c2251c3f5fb77f23cf3 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "wx/propdlg.h"
 #include "wx/bookctrl.h"
+#include "wx/withimages.h"
 
 #if wxUSE_HTML
 #include "wx/htmllbox.h"
@@ -32,7 +33,6 @@
 #include "wx/richtext/richtextuicustomization.h"
 
 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFormattingDialog;
-class WXDLLIMPEXP_FWD_CORE wxImageList;
 class WXDLLIMPEXP_FWD_CORE wxComboBox;
 class WXDLLIMPEXP_FWD_CORE wxCheckBox;
 
@@ -119,7 +119,8 @@ public:
  * Formatting dialog for a wxRichTextCtrl
  */
 
-class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialog: public wxPropertySheetDialog
+class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialog: public wxPropertySheetDialog,
+                                                       public wxWithImages
 {
 DECLARE_CLASS(wxRichTextFormattingDialog)
 DECLARE_HELP_PROVISION()
@@ -194,10 +195,6 @@ public:
     void OnHelp(wxCommandEvent& event);
     void OnUpdateHelp(wxUpdateUIEvent& event);
 
-    /// Set/get image list
-    void SetImageList(wxImageList* imageList) { m_imageList = imageList; }
-    wxImageList* GetImageList() const { return m_imageList; }
-
     /// Get/set formatting factory object
     static void SetFormattingDialogFactory(wxRichTextFormattingDialogFactory* factory);
     static wxRichTextFormattingDialogFactory* GetFormattingDialogFactory() { return ms_FormattingDialogFactory; }
@@ -237,7 +234,6 @@ public:
 
 protected:
 
-    wxImageList*                                m_imageList;
     wxRichTextAttr                              m_attributes;
     //wxRichTextAttr                              m_resetAttributes;
     wxRichTextStyleDefinition*                  m_styleDefinition;
diff --git a/include/wx/withimages.h b/include/wx/withimages.h
new file mode 100644 (file)
index 0000000..6ca0c90
--- /dev/null
@@ -0,0 +1,91 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        wx/withimages.h
+// Purpose:     Declaration of a simple wxWithImages class.
+// Author:      Vadim Zeitlin
+// Created:     2011-08-17
+// RCS-ID:      $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $
+// Copyright:   (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WITHIMAGES_H_
+#define _WX_WITHIMAGES_H_
+
+#include "wx/defs.h"
+#include "wx/imaglist.h"
+
+// ----------------------------------------------------------------------------
+// wxWithImages: mix-in class providing access to wxImageList.
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxWithImages
+{
+public:
+    wxWithImages()
+    {
+        m_imageList = NULL;
+        m_ownsImageList = false;
+    }
+
+    virtual ~wxWithImages()
+    {
+        FreeIfNeeded();
+    }
+
+    // Sets the image list to use, it is *not* deleted by the control.
+    virtual void SetImageList(wxImageList* imageList)
+    {
+        FreeIfNeeded();
+        m_imageList = imageList;
+    }
+
+    // As SetImageList() but we will delete the image list ourselves.
+    void AssignImageList(wxImageList* imageList)
+    {
+        SetImageList(imageList);
+        m_ownsImageList = true;
+    }
+
+    // Get pointer (may be NULL) to the associated image list.
+    wxImageList* GetImageList() const { return m_imageList; }
+
+protected:
+    // Return true if we have a valid image list.
+    bool HasImageList() const { return m_imageList != NULL; }
+
+    // Return the image with the given index from the image list.
+    //
+    // If there is no image list or if index == -1 (which traditionally means
+    // that no image should be used for the given item), silently returns
+    // wxNullIcon.
+    wxIcon GetImage(int iconIndex) const
+    {
+        return m_imageList && iconIndex != -1 ? m_imageList->GetIcon(iconIndex)
+                                              : wxNullIcon;
+    }
+
+private:
+    // Free the image list if necessary, i.e. if we own it.
+    void FreeIfNeeded()
+    {
+        if ( m_ownsImageList )
+        {
+            delete m_imageList;
+            m_imageList = NULL;
+
+            // We don't own it any more.
+            m_ownsImageList = false;
+        }
+    }
+
+
+    // The associated image list or NULL.
+    wxImageList* m_imageList;
+
+    // False by default, if true then we delete m_imageList.
+    bool m_ownsImageList;
+
+    wxDECLARE_NO_COPY_CLASS(wxWithImages);
+};
+
+#endif // _WX_WITHIMAGES_H_
index f3c8bb2074764a82dc907c1f4a0fd3b012011234..5fb2a2683dce206dd64a43b177199e1ad46768d2 100644 (file)
@@ -684,7 +684,7 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned l
 
             wxImageList *ilist = new wxImageList( 16, 16 );
             ilist->Add( wxIcon(wx_small_xpm) );
-            tc->SetImageList( ilist );
+            tc->AssignImageList( ilist );
 
             wxDataViewItem parent =
                 tc->AppendContainer( wxDataViewItem(0), "The Root", 0 );
index 5392388681f206df02125550ebbe1127f924d4c6..cc2141b7935999191f17c9ff2cb8ffa3d61391bf 100644 (file)
@@ -55,8 +55,6 @@ void wxBookCtrlBase::Init()
 {
     m_selection = wxNOT_FOUND;
     m_bookctrl = NULL;
-    m_imageList = NULL;
-    m_ownsImageList = false;
     m_fitToCurrentPage = false;
 
 #if defined(__WXWINCE__)
@@ -89,39 +87,6 @@ wxBookCtrlBase::Create(wxWindow *parent,
                      );
 }
 
-wxBookCtrlBase::~wxBookCtrlBase()
-{
-    if ( m_ownsImageList )
-    {
-        // may be NULL, ok
-        delete m_imageList;
-    }
-}
-
-// ----------------------------------------------------------------------------
-// image list
-// ----------------------------------------------------------------------------
-
-void wxBookCtrlBase::SetImageList(wxImageList *imageList)
-{
-    if ( m_ownsImageList )
-    {
-        // may be NULL, ok
-        delete m_imageList;
-
-        m_ownsImageList = false;
-    }
-
-    m_imageList = imageList;
-}
-
-void wxBookCtrlBase::AssignImageList(wxImageList* imageList)
-{
-    SetImageList(imageList);
-
-    m_ownsImageList = true;
-}
-
 // ----------------------------------------------------------------------------
 // geometry
 // ----------------------------------------------------------------------------
index c5540283fc6bbe1d2e0d9490b9edbf34cef46be5..7c2f06f45733cac0648d05eb7918890c0e007d93 100644 (file)
@@ -2248,11 +2248,6 @@ BEGIN_EVENT_TABLE(wxDataViewTreeCtrl,wxDataViewCtrl)
    EVT_SIZE( wxDataViewTreeCtrl::OnSize )
 END_EVENT_TABLE()
 
-wxDataViewTreeCtrl::~wxDataViewTreeCtrl()
-{
-    delete m_imageList;
-}
-
 bool wxDataViewTreeCtrl::Create( wxWindow *parent, wxWindowID id,
            const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator )
 {
@@ -2277,21 +2272,11 @@ bool wxDataViewTreeCtrl::Create( wxWindow *parent, wxWindowID id,
     return true;
 }
 
-void wxDataViewTreeCtrl::SetImageList( wxImageList *imagelist )
-{
-    delete m_imageList;
-
-    m_imageList = imagelist;
-}
-
 wxDataViewItem wxDataViewTreeCtrl::AppendItem( const wxDataViewItem& parent,
         const wxString &text, int iconIndex, wxClientData *data )
 {
-    wxIcon icon = wxNullIcon;
-    if (m_imageList && (iconIndex != -1))
-        icon = m_imageList->GetIcon( iconIndex );
-
-    wxDataViewItem res = GetStore()->AppendItem( parent, text, icon, data );
+    wxDataViewItem res = GetStore()->
+        AppendItem( parent, text, GetImage(iconIndex), data );
 
     GetStore()->ItemAdded( parent, res );
 
@@ -2301,11 +2286,8 @@ wxDataViewItem wxDataViewTreeCtrl::AppendItem( const wxDataViewItem& parent,
 wxDataViewItem wxDataViewTreeCtrl::PrependItem( const wxDataViewItem& parent,
         const wxString &text, int iconIndex, wxClientData *data )
 {
-    wxIcon icon = wxNullIcon;
-    if (m_imageList && (iconIndex != -1))
-        icon = m_imageList->GetIcon( iconIndex );
-
-    wxDataViewItem res = GetStore()->PrependItem( parent, text, icon, data );
+    wxDataViewItem res = GetStore()->
+        PrependItem( parent, text, GetImage(iconIndex), data );
 
     GetStore()->ItemAdded( parent, res );
 
@@ -2315,11 +2297,8 @@ wxDataViewItem wxDataViewTreeCtrl::PrependItem( const wxDataViewItem& parent,
 wxDataViewItem wxDataViewTreeCtrl::InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous,
         const wxString &text, int iconIndex, wxClientData *data )
 {
-    wxIcon icon = wxNullIcon;
-    if (m_imageList && (iconIndex != -1))
-        icon = m_imageList->GetIcon( iconIndex );
-
-    wxDataViewItem res = GetStore()->InsertItem( parent, previous, text, icon, data );
+    wxDataViewItem res = GetStore()->
+        InsertItem( parent, previous, text, GetImage(iconIndex), data );
 
     GetStore()->ItemAdded( parent, res );
 
@@ -2329,15 +2308,9 @@ wxDataViewItem wxDataViewTreeCtrl::InsertItem( const wxDataViewItem& parent, con
 wxDataViewItem wxDataViewTreeCtrl::PrependContainer( const wxDataViewItem& parent,
         const wxString &text, int iconIndex, int expandedIndex, wxClientData *data )
 {
-    wxIcon icon = wxNullIcon;
-    if (m_imageList && (iconIndex != -1))
-        icon = m_imageList->GetIcon( iconIndex );
-
-    wxIcon expanded = wxNullIcon;
-    if (m_imageList && (expandedIndex != -1))
-        expanded = m_imageList->GetIcon( expandedIndex );
-
-    wxDataViewItem res = GetStore()->PrependContainer( parent, text, icon, expanded, data );
+    wxDataViewItem res = GetStore()->
+        PrependContainer( parent, text,
+                          GetImage(iconIndex), GetImage(expandedIndex), data );
 
     GetStore()->ItemAdded( parent, res );
 
@@ -2347,15 +2320,9 @@ wxDataViewItem wxDataViewTreeCtrl::PrependContainer( const wxDataViewItem& paren
 wxDataViewItem wxDataViewTreeCtrl::AppendContainer( const wxDataViewItem& parent,
         const wxString &text, int iconIndex, int expandedIndex, wxClientData *data )
 {
-    wxIcon icon = wxNullIcon;
-    if (m_imageList && (iconIndex != -1))
-        icon = m_imageList->GetIcon( iconIndex );
-
-    wxIcon expanded = wxNullIcon;
-    if (m_imageList && (expandedIndex != -1))
-        expanded = m_imageList->GetIcon( expandedIndex );
-
-    wxDataViewItem res = GetStore()->AppendContainer( parent, text, icon, expanded, data );
+    wxDataViewItem res = GetStore()->
+        AppendContainer( parent, text,
+                         GetImage(iconIndex), GetImage(expandedIndex), data );
 
     GetStore()->ItemAdded( parent, res );
 
@@ -2365,15 +2332,9 @@ wxDataViewItem wxDataViewTreeCtrl::AppendContainer( const wxDataViewItem& parent
 wxDataViewItem wxDataViewTreeCtrl::InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous,
         const wxString &text, int iconIndex, int expandedIndex, wxClientData *data )
 {
-    wxIcon icon = wxNullIcon;
-    if (m_imageList && (iconIndex != -1))
-        icon = m_imageList->GetIcon( iconIndex );
-
-    wxIcon expanded = wxNullIcon;
-    if (m_imageList && (expandedIndex != -1))
-        expanded = m_imageList->GetIcon( expandedIndex );
-
-    wxDataViewItem res = GetStore()->InsertContainer( parent, previous, text, icon, expanded, data );
+    wxDataViewItem res = GetStore()->
+        InsertContainer( parent, previous, text,
+                         GetImage(iconIndex), GetImage(expandedIndex), data );
 
     GetStore()->ItemAdded( parent, res );
 
@@ -2442,7 +2403,7 @@ void  wxDataViewTreeCtrl::DeleteAllItems()
 
 void wxDataViewTreeCtrl::OnExpanded( wxDataViewEvent &event )
 {
-    if (m_imageList) return;
+    if (HasImageList()) return;
 
     wxDataViewTreeStoreContainerNode* container = GetStore()->FindContainerNode( event.GetItem() );
     if (!container) return;
@@ -2454,7 +2415,7 @@ void wxDataViewTreeCtrl::OnExpanded( wxDataViewEvent &event )
 
 void wxDataViewTreeCtrl::OnCollapsed( wxDataViewEvent &event )
 {
-    if (m_imageList) return;
+    if (HasImageList()) return;
 
     wxDataViewTreeStoreContainerNode* container = GetStore()->FindContainerNode( event.GetItem() );
     if (!container) return;
index f418384a367a0d2f6d3744d8e60e1fb5d64bf32a..9cf75ee56be8e065c97e54004f4dc3a59653d521 100644 (file)
@@ -277,8 +277,8 @@ bool wxNotebook::SetPageImage( size_t page, int image )
     wxGtkNotebookPage* pageData = GetNotebookPage(page);
     if (image >= 0)
     {
-        wxCHECK_MSG(m_imageList, false, "invalid notebook imagelist");
-        const wxBitmap* bitmap = m_imageList->GetBitmapPtr(image);
+        wxCHECK_MSG(HasImageList(), false, "invalid notebook imagelist");
+        const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(image);
         if (bitmap == NULL)
             return false;
         if (pageData->m_image)
@@ -410,9 +410,9 @@ bool wxNotebook::InsertPage( size_t position,
     pageData->m_image = NULL;
     if (imageId != -1)
     {
-        if (m_imageList)
+        if (HasImageList())
         {
-            const wxBitmap* bitmap = m_imageList->GetBitmapPtr(imageId);
+            const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(imageId);
             pageData->m_image = gtk_image_new_from_pixbuf(bitmap->GetPixbuf());
             gtk_box_pack_start(GTK_BOX(pageData->m_box),
                 pageData->m_image, false, false, m_padding);
index 1879bb2ba3df3c3f59009e00ce8eb1aadad33d12..e69fd60c43b2859307031a05f0e2798971e88edc 100644 (file)
@@ -138,8 +138,6 @@ END_EVENT_TABLE()
 // common part of all ctors
 void wxNotebook::Init()
 {
-    m_imageList = NULL;
-
 #if wxUSE_UXTHEME
     m_hbrBackground = NULL;
 #endif // wxUSE_UXTHEME
index 0f0ea5f37ba14239fe8222ddce0140e9c0f6e891..68ff2095b5ef8a765863f3b6d2545c667a727010 100644 (file)
@@ -145,7 +145,7 @@ bool wxNotebook::SetPageImage(size_t nPage, int nImage)
 {
     wxCHECK_MSG( IS_VALID_PAGE(nPage), false,
         wxT("SetPageImage: invalid notebook page") );
-    wxCHECK_MSG( m_imageList && nImage < m_imageList->GetImageCount(), false,
+    wxCHECK_MSG( HasImageList() && nImage < GetImageList()->GetImageCount(), false,
         wxT("SetPageImage: invalid image index") );
 
     if ( nImage != m_images[nPage] )
index 768ef405b003ddbb46afc7b47ad09b81ef359315..032268117c3085c20c9752c8aaa277dfcce4d777 100644 (file)
@@ -94,7 +94,6 @@ wxRichTextFormattingDialogFactory* wxRichTextFormattingDialog::ms_FormattingDial
 
 void wxRichTextFormattingDialog::Init()
 {
-    m_imageList = NULL;
     m_styleDefinition = NULL;
     m_styleSheet = NULL;
     m_object = NULL;
@@ -102,7 +101,6 @@ void wxRichTextFormattingDialog::Init()
 
 wxRichTextFormattingDialog::~wxRichTextFormattingDialog()
 {
-    delete m_imageList;
     delete m_styleDefinition;
 }