]> git.saurik.com Git - wxWidgets.git/commitdiff
no changes, just resolved conflicts (due to the fact that I had forgotten to commit...
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 21 Aug 2003 20:52:02 +0000 (20:52 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 21 Aug 2003 20:52:02 +0000 (20:52 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23081 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/notebmac.cpp
src/mac/notebmac.cpp

index 94f142fb03dad9c0eb7d2c949825ffdb1825ea9e..3a45c336fa799beadc14973a1021c98a80547def 100644 (file)
@@ -31,7 +31,7 @@
 // ----------------------------------------------------------------------------
 
 // check that the page index is valid
-#define IS_VALID_PAGE(nPage) (((nPage) >= 0) && ((nPage) < GetPageCount()))
+#define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount())
 
 
 // ----------------------------------------------------------------------------
@@ -296,7 +296,7 @@ int wxNotebook::GetPageImage(size_t nPage) const
     return m_images[nPage];
 }
 
-bool wxNotebook::SetPageImage(size_t nPage , int nImage)
+bool wxNotebook::SetPageImage(size_t nPage, int nImage)
 {
     wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("invalid notebook page") );
 
@@ -329,7 +329,7 @@ wxNotebookPage* wxNotebook::DoRemovePage(size_t nPage)
 
     MacSetupTabs();
 
-    if(m_nSelection >= GetPageCount()) {
+    if(m_nSelection >= (int)GetPageCount()) {
         m_nSelection = GetPageCount() - 1;
     }
     if(m_nSelection >= 0) {
@@ -357,14 +357,11 @@ bool wxNotebook::InsertPage(size_t nPage,
                             bool bSelect,
                             int imageId)
 {
-    wxASSERT( pPage != NULL );
-    wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
+    if ( !wxNotebookBase::InsertPage(nPage, pPage, strText, bSelect, imageId) )
+        return false;
 
     pPage->SetLabel(strText);
 
-    // save the pointer to the page
-    m_pages.Insert(pPage, nPage);
-
     m_images.Insert(imageId, nPage);
 
     MacSetupTabs();
@@ -375,7 +372,7 @@ bool wxNotebook::InsertPage(size_t nPage,
     else if ( m_nSelection == -1 ) {
         m_nSelection = 0;
     }
-    else if (m_nSelection >= nPage) {
+    else if ((size_t)m_nSelection >= nPage) {
         m_nSelection++;
     }
     // don't show pages by default (we'll need to adjust their size first)
@@ -406,7 +403,8 @@ void wxNotebook::MacSetupTabs()
     wxNotebookPage *page;
     ControlTabInfoRec info;
 
-    for(int ii = 0; ii < GetPageCount(); ii++)
+    const size_t countPages = GetPageCount();
+    for(size_t ii = 0; ii < countPages; ii++)
     {
         page = m_pages[ii];
         info.version = 0;
index 94f142fb03dad9c0eb7d2c949825ffdb1825ea9e..3a45c336fa799beadc14973a1021c98a80547def 100644 (file)
@@ -31,7 +31,7 @@
 // ----------------------------------------------------------------------------
 
 // check that the page index is valid
-#define IS_VALID_PAGE(nPage) (((nPage) >= 0) && ((nPage) < GetPageCount()))
+#define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount())
 
 
 // ----------------------------------------------------------------------------
@@ -296,7 +296,7 @@ int wxNotebook::GetPageImage(size_t nPage) const
     return m_images[nPage];
 }
 
-bool wxNotebook::SetPageImage(size_t nPage , int nImage)
+bool wxNotebook::SetPageImage(size_t nPage, int nImage)
 {
     wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("invalid notebook page") );
 
@@ -329,7 +329,7 @@ wxNotebookPage* wxNotebook::DoRemovePage(size_t nPage)
 
     MacSetupTabs();
 
-    if(m_nSelection >= GetPageCount()) {
+    if(m_nSelection >= (int)GetPageCount()) {
         m_nSelection = GetPageCount() - 1;
     }
     if(m_nSelection >= 0) {
@@ -357,14 +357,11 @@ bool wxNotebook::InsertPage(size_t nPage,
                             bool bSelect,
                             int imageId)
 {
-    wxASSERT( pPage != NULL );
-    wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
+    if ( !wxNotebookBase::InsertPage(nPage, pPage, strText, bSelect, imageId) )
+        return false;
 
     pPage->SetLabel(strText);
 
-    // save the pointer to the page
-    m_pages.Insert(pPage, nPage);
-
     m_images.Insert(imageId, nPage);
 
     MacSetupTabs();
@@ -375,7 +372,7 @@ bool wxNotebook::InsertPage(size_t nPage,
     else if ( m_nSelection == -1 ) {
         m_nSelection = 0;
     }
-    else if (m_nSelection >= nPage) {
+    else if ((size_t)m_nSelection >= nPage) {
         m_nSelection++;
     }
     // don't show pages by default (we'll need to adjust their size first)
@@ -406,7 +403,8 @@ void wxNotebook::MacSetupTabs()
     wxNotebookPage *page;
     ControlTabInfoRec info;
 
-    for(int ii = 0; ii < GetPageCount(); ii++)
+    const size_t countPages = GetPageCount();
+    for(size_t ii = 0; ii < countPages; ii++)
     {
         page = m_pages[ii];
         info.version = 0;