X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/03647350fc7cd141953c72e0284e928847d30f44..aa642a456cde1a8e4b97a74bdd16bd575e7123b1:/src/gtk/notebook.cpp?ds=sidebyside diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 4802f31fcd..1185f59526 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -61,10 +61,11 @@ static void event_after(GtkNotebook*, GdkEvent*, wxNotebook*); extern "C" { static void -switch_page_after(GtkWidget* widget, GtkNotebookPage*, guint, wxNotebook* win) +switch_page_after(GtkNotebook* widget, GtkNotebookPage*, guint, wxNotebook* win) { g_signal_handlers_block_by_func(widget, (void*)switch_page_after, win); - win->SendPageChangedEvent(win->m_oldSelection); + + win->GTKOnPageChanged(); } } @@ -125,8 +126,6 @@ void wxNotebook::AddChildGTK(wxWindowGTK* child) // wxNotebook //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxBookCtrlBase) - BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase) EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey) END_EVENT_TABLE() @@ -202,7 +201,7 @@ 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") ); return gtk_notebook_get_current_page( GTK_NOTEBOOK(m_widget) ); } @@ -217,7 +216,7 @@ wxString wxNotebook::GetPageText( size_t page ) const int wxNotebook::GetPageImage( size_t page ) const { - wxCHECK_MSG(page < GetPageCount(), -1, "invalid notebook index"); + wxCHECK_MSG(page < GetPageCount(), wxNOT_FOUND, "invalid notebook index"); return GetNotebookPage(page)->m_imageIndex; } @@ -229,7 +228,7 @@ wxGtkNotebookPage* wxNotebook::GetNotebookPage( int page ) const int wxNotebook::DoSetSelection( size_t page, int flags ) { - wxCHECK_MSG(page < GetPageCount(), -1, "invalid notebook index"); + wxCHECK_MSG(page < GetPageCount(), wxNOT_FOUND, "invalid notebook index"); int selOld = GetSelection(); @@ -245,6 +244,8 @@ int wxNotebook::DoSetSelection( size_t page, int flags ) g_signal_handlers_unblock_by_func(m_widget, (void*)switch_page, this); } + m_selection = page; + wxNotebookPage *client = GetPage(page); if ( client ) client->SetFocus(); @@ -252,6 +253,13 @@ int wxNotebook::DoSetSelection( size_t page, int flags ) return selOld; } +void wxNotebook::GTKOnPageChanged() +{ + m_selection = gtk_notebook_get_current_page(GTK_NOTEBOOK(m_widget)); + + SendPageChangedEvent(m_oldSelection); +} + bool wxNotebook::SetPageText( size_t page, const wxString &text ) { wxCHECK_MSG(page < GetPageCount(), false, "invalid notebook index");