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();
}
}
// wxNotebook
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxBookCtrlBase)
-
BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase)
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
END_EVENT_TABLE()
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) );
}
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;
}
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();
g_signal_handlers_unblock_by_func(m_widget, (void*)switch_page, this);
}
+ m_selection = page;
+
wxNotebookPage *client = GetPage(page);
if ( client )
client->SetFocus();
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");
wxGtkNotebookPage* p = GetNotebookPage(page);
m_pagesData.DeleteObject(p);
delete p;
-
+
return client;
}
wxT("Can't add a page whose parent is not the notebook!") );
wxCHECK_MSG( position <= GetPageCount(), false,
- _T("invalid page index in wxNotebookPage::InsertPage()") );
+ wxT("invalid page index in wxNotebookPage::InsertPage()") );
// Hack Alert! (Part II): See above in wxNotebook::AddChildGTK
// why this has to be done.
gtk_notebook_insert_page(notebook, win->m_widget, pageData->m_box, position);
/* apply current style */
- GtkRcStyle *style = CreateWidgetStyle();
+ GtkRcStyle *style = GTKCreateWidgetStyle();
if ( style )
{
gtk_widget_modify_style(pageData->m_label, style);