]> git.saurik.com Git - wxWidgets.git/commitdiff
No changes, just use symbolic NO_IMAGE constant instead of -1 or wxNOT_FOUND.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 21 Aug 2011 14:08:49 +0000 (14:08 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 21 Aug 2011 14:08:49 +0000 (14:08 +0000)
Existing declarations used -1 in several places to indicate the absence of the
image which wasn't especially clear and was also inconsistent with other
places that used wxNOT_FOUND which didn't make much sense in this context.

Add a new symbolic constant NO_IMAGE in wxWithImages and use it in the classes
deriving from it. This still doesn't help with wx{Tree,List}Ctrl but improves
clarity for the other classes.

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

16 files changed:
include/wx/bookctrl.h
include/wx/choicebk.h
include/wx/cocoa/notebook.h
include/wx/dataview.h
include/wx/generic/notebook.h
include/wx/gtk/notebook.h
include/wx/gtk1/notebook.h
include/wx/listbook.h
include/wx/msw/notebook.h
include/wx/osx/notebook.h
include/wx/palmos/notebook.h
include/wx/toolbook.h
include/wx/treebook.h
include/wx/univ/notebook.h
include/wx/withimages.h
interface/wx/bookctrl.h

index bc2b89d8b33ac7a6cc50417307654a75feb792ad..e42d90487179d86ff7ec050b9c7a52f7c8437f5d 100644 (file)
@@ -181,7 +181,7 @@ public:
     virtual bool AddPage(wxWindow *page,
                          const wxString& text,
                          bool bSelect = false,
-                         int imageId = -1)
+                         int imageId = NO_IMAGE)
     {
         DoInvalidateBestSize();
         return InsertPage(GetPageCount(), page, text, bSelect, imageId);
@@ -192,7 +192,7 @@ public:
                             wxWindow *page,
                             const wxString& text,
                             bool bSelect = false,
-                            int imageId = -1) = 0;
+                            int imageId = NO_IMAGE) = 0;
 
     // set the currently selected page, return the index of the previously
     // selected one (or wxNOT_FOUND on error)
index 5dbbecc10467e421716ff014eec74bb116850f3c..0539b353dd6be41edf040eb0d359650137f19b9e 100644 (file)
@@ -68,7 +68,7 @@ public:
                             wxWindow *page,
                             const wxString& text,
                             bool bSelect = false,
-                            int imageId = -1);
+                            int imageId = NO_IMAGE);
     virtual int SetSelection(size_t n)
         { return DoSetSelection(n, SetSelection_SendEvent); }
     virtual int ChangeSelection(size_t n) { return DoSetSelection(n); }
index 6cc8161ff0b48cca5fa43f1455ba7775c98b86e4..e158a18fdd287ee22c1b1a43850532de8a48f90f 100644 (file)
@@ -97,7 +97,7 @@ public:
                      wxNotebookPage *win,
                      const wxString& strText,
                      bool bSelect = false,
-                     int imageId = -1 );
+                     int imageId = NO_IMAGE );
 
 protected:
 };
index ff6e3b31e3c4649b180eb858190fdbccc614d1d5..96af042c9d558d9d9aa72185bae98ba1a8803e0c 100644 (file)
@@ -1262,20 +1262,20 @@ public:
         { return GetStore()->IsContainer(item); }
 
     wxDataViewItem AppendItem( const wxDataViewItem& parent,
-        const wxString &text, int icon = -1, wxClientData *data = NULL );
+        const wxString &text, int icon = NO_IMAGE, wxClientData *data = NULL );
     wxDataViewItem PrependItem( const wxDataViewItem& parent,
-        const wxString &text, int icon = -1, wxClientData *data = NULL );
+        const wxString &text, int icon = NO_IMAGE, wxClientData *data = NULL );
     wxDataViewItem InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous,
-        const wxString &text, int icon = -1, wxClientData *data = NULL );
+        const wxString &text, int icon = NO_IMAGE, wxClientData *data = NULL );
 
     wxDataViewItem PrependContainer( const wxDataViewItem& parent,
-        const wxString &text, int icon = -1, int expanded = -1,
+        const wxString &text, int icon = NO_IMAGE, int expanded = NO_IMAGE,
         wxClientData *data = NULL );
     wxDataViewItem AppendContainer( const wxDataViewItem& parent,
-        const wxString &text, int icon = -1, int expanded = -1,
+        const wxString &text, int icon = NO_IMAGE, int expanded = NO_IMAGE,
         wxClientData *data = NULL );
     wxDataViewItem InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous,
-        const wxString &text, int icon = -1, int expanded = -1,
+        const wxString &text, int icon = NO_IMAGE, int expanded = NO_IMAGE,
         wxClientData *data = NULL );
 
     wxDataViewItem GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const
index 32deb7564d70a925ac4c42a9c941b917aef38437..1bd34877be4e339944e4b989087332ed272dd12c 100644 (file)
@@ -107,7 +107,7 @@ public:
                   wxNotebookPage *pPage,
                   const wxString& strText,
                   bool bSelect = false,
-                  int imageId = -1);
+                  int imageId = NO_IMAGE);
 
   // callbacks
   // ---------
index bad2b59524a576c1fa9ac80ea28d17cb1288c8c0..aeb5399ea28ca95b9d5a29e054fdec2ddca06652 100644 (file)
@@ -89,7 +89,7 @@ public:
                      wxNotebookPage *win,
                      const wxString& strText,
                      bool bSelect = false,
-                     int imageId = -1 );
+                     int imageId = NO_IMAGE );
 
     // handler for tab navigation
     // --------------------------
index 78c7ce5125055c0262f28e7d4e96fa12d0b8f6ec..5be3df0b5b16465d6e72a88bfcd50d9c0f0632b5 100644 (file)
@@ -89,7 +89,7 @@ public:
                      wxNotebookPage *win,
                      const wxString& strText,
                      bool bSelect = false,
-                     int imageId = -1 );
+                     int imageId = NO_IMAGE );
 
     // handler for tab navigation
     // --------------------------
index 052b4630249767461a6ad5b7d0559f20a417d493..48140dc0bb7dfd5ad269729619a58c36d04acdb0 100644 (file)
@@ -69,7 +69,7 @@ public:
                             wxWindow *page,
                             const wxString& text,
                             bool bSelect = false,
-                            int imageId = -1);
+                            int imageId = NO_IMAGE);
     virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); }
     virtual int ChangeSelection(size_t n) { return DoSetSelection(n); }
     virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
index 70993e4d617cb220fdc52e308b6b8caf2453bd2b..bb8ca64cc2d870ba31d37cad14c08a860c4f1911 100644 (file)
@@ -96,7 +96,7 @@ public:
                   wxNotebookPage *pPage,
                   const wxString& strText,
                   bool bSelect = false,
-                  int imageId = -1);
+                  int imageId = NO_IMAGE);
 
     // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
     // style.
index 3447388f95d1857006720bc0016cd809ff429275..1affba34a98cac88eefae3f231dd543631aaae8e 100644 (file)
@@ -95,7 +95,7 @@ public:
                   wxNotebookPage *pPage,
                   const wxString& strText,
                   bool bSelect = false,
-                  int imageId = -1);
+                  int imageId = NO_IMAGE);
 
   // callbacks
   // ---------
index 5e85e4259d009eb4def0838d162566c61d9da5f9..3c603a8169da3a68e05453b963198b3fd90b60a0 100644 (file)
@@ -127,7 +127,7 @@ public:
                     wxNotebookPage *pPage,
                     const wxString& strText,
                     bool bSelect = false,
-                    int imageId = -1);
+                    int imageId = NO_IMAGE);
 
     void AddPageInfo( wxNotebookPageInfo* info ) { AddPage( info->GetPage() , info->GetText() , info->GetSelected() , info->GetImageId() ) ; }
     const wxNotebookPageInfoList& GetPageInfos() const ;
index d39df2e99f597d0b4c211ce6465b9142d168d7b8..bfe6211e8fcf33b7249b7a263749a20a05680ebe 100644 (file)
@@ -78,7 +78,7 @@ public:
                             wxWindow *page,
                             const wxString& text,
                             bool bSelect = false,
-                            int imageId = -1);
+                            int imageId = NO_IMAGE);
     virtual int SetSelection(size_t n) { return DoSetSelection(n, SetSelection_SendEvent); }
     virtual int ChangeSelection(size_t n) { return DoSetSelection(n); }
     virtual void SetImageList(wxImageList *imageList);
index 86aa0acabcbb58f2b338bbb37ba1ed1746351a69..30bc563e0da023949dd71184d244c4f9c5e9ac63 100644 (file)
@@ -74,27 +74,27 @@ public:
                             wxWindow *page,
                             const wxString& text,
                             bool bSelect = false,
-                            int imageId = wxNOT_FOUND);
+                            int imageId = NO_IMAGE);
 
     // Inserts a new sub-page to the end of children of the page at given pos.
     virtual bool InsertSubPage(size_t pos,
                                wxWindow *page,
                                const wxString& text,
                                bool bSelect = false,
-                               int imageId = wxNOT_FOUND);
+                               int imageId = NO_IMAGE);
 
     // Adds a new page at top level after all other pages.
     virtual bool AddPage(wxWindow *page,
                          const wxString& text,
                          bool bSelect = false,
-                         int imageId = wxNOT_FOUND);
+                         int imageId = NO_IMAGE);
 
     // Adds a new child-page to the last top-level page inserted.
     // Useful when constructing 1 level tree structure.
     virtual bool AddSubPage(wxWindow *page,
                             const wxString& text,
                             bool bSelect = false,
-                            int imageId = wxNOT_FOUND);
+                            int imageId = NO_IMAGE);
 
     // Deletes the page and ALL its children. Could trigger page selection
     // change in a case when selected page is removed. In that case its parent
@@ -169,16 +169,16 @@ private:
                       wxWindow *page,
                       const wxString& text,
                       bool bSelect = false,
-                      int imageId = wxNOT_FOUND);
+                      int imageId = NO_IMAGE);
     bool DoInsertSubPage(size_t pos,
                          wxWindow *page,
                          const wxString& text,
                          bool bSelect = false,
-                         int imageId = wxNOT_FOUND);
+                         int imageId = NO_IMAGE);
     bool DoAddSubPage(wxWindow *page,
                          const wxString& text,
                          bool bSelect = false,
-                         int imageId = wxNOT_FOUND);
+                         int imageId = NO_IMAGE);
 
     // Sets selection in the tree control and updates the page being shown.
     int DoSetSelection(size_t pos, int flags = 0);
index 7fa65423be6d81a7e765e7c379bb3b9521ae2ef4..cf982afe6cd01dfb90353d91a8078e9110323661 100644 (file)
@@ -86,7 +86,7 @@ public:
                             wxNotebookPage *pPage,
                             const wxString& strText,
                             bool bSelect = false,
-                            int imageId = -1);
+                            int imageId = NO_IMAGE);
 
     // style tests
     // -----------
index 6ca0c902e93b0686b14979c4d2233e5f65030eec..e36380dfd2af854a6f4e470c783dab78db8249ec 100644 (file)
 class WXDLLIMPEXP_CORE wxWithImages
 {
 public:
+    enum
+    {
+        NO_IMAGE = -1
+    };
+
     wxWithImages()
     {
         m_imageList = NULL;
@@ -55,13 +60,13 @@ protected:
 
     // 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
+    // If there is no image list or if index == NO_IMAGE, silently returns
     // wxNullIcon.
     wxIcon GetImage(int iconIndex) const
     {
-        return m_imageList && iconIndex != -1 ? m_imageList->GetIcon(iconIndex)
-                                              : wxNullIcon;
+        return m_imageList && iconIndex != NO_IMAGE
+                    ? m_imageList->GetIcon(iconIndex)
+                    : wxNullIcon;
     }
 
 private:
index 450cd6d4eb2467769a7e8be8e955fa8d08b39470..06092c4eaf60e5a5aeef9c65c52b7562690b642c 100644 (file)
 class wxBookCtrlBase : public wxControl
 {
 public:
+    enum
+    {
+        /// Symbolic constant indicating that no image should be used.
+        NO_IMAGE = -1
+    };
+
     /**
         Default ctor.
     */
@@ -243,7 +249,7 @@ public:
         @see InsertPage()
     */
     virtual bool AddPage(wxWindow* page, const wxString& text,
-                         bool select = false, int imageId = wxNOT_FOUND);
+                         bool select = false, int imageId = NO_IMAGE);
 
     /**
         Deletes all pages.
@@ -280,7 +286,7 @@ public:
                             wxWindow* page,
                             const wxString& text,
                             bool select = false,
-                            int imageId = wxNOT_FOUND) = 0;
+                            int imageId = NO_IMAGE) = 0;
 
     /**
         Deletes the specified page, without deleting the associated window.