-static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
- GtkNotebookPage *WXUNUSED(gpage),
- guint page,
- wxNotebook *notebook )
-{
- // are you trying to call SetSelection() from a notebook event handler?
- // you shouldn't!
- wxCHECK_RET( !notebook->m_inSwitchPage,
- _T("gtk_notebook_page_change_callback reentered") );
-
- notebook->m_inSwitchPage = true;
- if (g_isIdle)
- wxapp_install_idle_handler();
-
- int old = notebook->GetSelection();
-
-
- if (notebook->m_skipNextPageChangeEvent)
- {
- // this event was programatically generated by ChangeSelection() and thus must
- // be skipped
- notebook->m_skipNextPageChangeEvent = false;
-
- // make wxNotebook::GetSelection() return the correct (i.e. consistent
- // with wxNotebookEvent::GetSelection()) value even though the page is
- // not really changed in GTK+
- notebook->m_selection = page;
- }
- else
- {
- if ( !notebook->SendPageChangingEvent(page) )
- {
- // program doesn't allow the page change
- g_signal_stop_emission_by_name(notebook->m_widget, "switch_page");
- }
- else // change allowed
- {
- // make wxNotebook::GetSelection() return the correct (i.e. consistent
- // with wxNotebookEvent::GetSelection()) value even though the page is
- // not really changed in GTK+
- notebook->m_selection = page;
-
- notebook->SendPageChangedEvent(old);
- }
- }
-
- notebook->m_inSwitchPage = false;
-}