]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/notebook.cpp
move variable definitions to more appropriate places, remove now-empty src/common...
[wxWidgets.git] / src / gtk1 / notebook.cpp
index 1b821aad1e7bffc9a3ffb7e2959feec3de1b54ed..780ef4d3db75371b4897f2bf08665904e2ab351f 100644 (file)
@@ -107,7 +107,7 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
         // make wxNotebook::GetSelection() return the correct (i.e. consistent
         // with wxBookCtrlEvent::GetSelection()) value even though the page is
         // not really changed in GTK+
-        notebook->m_selection = page;
+        notebook->SetSelection(page);
     }
     else
     {
@@ -121,7 +121,7 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
             // make wxNotebook::GetSelection() return the correct (i.e. consistent
             // with wxBookCtrlEvent::GetSelection()) value even though the page is
             // not really changed in GTK+
-            notebook->m_selection = page;
+            notebook->SetSelection(page);
 
             notebook->SendPageChangedEvent(old);
         }
@@ -227,7 +227,7 @@ static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk
     if ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab))
     {
         int sel = notebook->GetSelection();
-        if (sel == -1)
+        if (sel == wxNOT_FOUND)
             return TRUE;
         wxGtkNotebookPage *nb_page = notebook->GetNotebookPage(sel);
         wxCHECK_MSG( nb_page, FALSE, wxT("invalid selection in wxNotebook") );
@@ -292,7 +292,6 @@ void wxNotebook::Init()
     m_inSwitchPage = false;
 
     m_imageList = NULL;
-    m_selection = -1;
     m_themeEnabled = true;
 }
 
@@ -362,9 +361,9 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
 
 int wxNotebook::GetSelection() const
 {
-    wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") );
+    wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid notebook") );
 
-    if ( m_selection == -1 )
+    if ( m_selection == wxNOT_FOUND )
     {
         GList *nb_pages = GTK_NOTEBOOK(m_widget)->children;
 
@@ -375,8 +374,8 @@ int wxNotebook::GetSelection() const
             gpointer cur = notebook->cur_page;
             if ( cur != NULL )
             {
-                wxConstCast(this, wxNotebook)->m_selection =
-                    g_list_index( nb_pages, cur );
+                const_cast<wxNotebook *>(this)->
+                    SetSelection(g_list_index( nb_pages, cur ));
             }
         }
     }
@@ -417,7 +416,7 @@ wxGtkNotebookPage* wxNotebook::GetNotebookPage( int page ) const
 
 int wxNotebook::DoSetSelection( size_t page, int flags )
 {
-    wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") );
+    wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid notebook") );
 
     wxCHECK_MSG( page < m_pagesData.GetCount(), -1, wxT("invalid notebook index") );
 
@@ -597,10 +596,10 @@ bool wxNotebook::DeleteAllPages()
 
 wxNotebookPage *wxNotebook::DoRemovePage( size_t page )
 {
-    if ( m_selection != -1 && (size_t)m_selection >= page )
+    if ( m_selection != wxNOT_FOUND && (size_t)m_selection >= page )
     {
         // the index will become invalid after the page is deleted
-        m_selection = -1;
+        m_selection = wxNOT_FOUND;
     }
 
     wxNotebookPage *client = wxNotebookBase::DoRemovePage(page);