#endif
#include "wx/notebook.h"
+
+#if wxUSE_NOTEBOOK
+
#include "wx/panel.h"
#include "wx/utils.h"
#include "wx/imaglist.h"
{
m_imageList = (wxImageList *) NULL;
m_pages.DeleteContents( TRUE );
+ m_lastSelection = -1;
}
wxNotebook::wxNotebook()
GtkNotebook *notebook = GTK_NOTEBOOK(m_widget);
- GtkNotebookPage *page = GTK_NOTEBOOK_PAGE( notebook->cur_page );
+ if (notebook->cur_page == NULL) return m_lastSelection;
- wxCHECK_MSG( page, -1, "no notebook page selected/current" );
-
- return g_list_index( pages, (gpointer)page );
+ return g_list_index( pages, (gpointer)(notebook->cur_page) );
}
int wxNotebook::GetPageCount() const
wxNotebookPage* nb_page = GetNotebookPage(page);
if (!nb_page) return FALSE;
+ /* GTK sets GtkNotebook.cur_page to NULL before sending
+ the switvh page event */
+ m_lastSelection = GetSelection();
+
nb_page->m_client->Destroy();
-
m_pages.DeleteObject( nb_page );
+
+ m_lastSelection = -1;
return TRUE;
}
page->m_box = gtk_hbox_new( FALSE, 0 );
gtk_container_border_width( GTK_CONTAINER(page->m_box), 2 );
+ gtk_signal_connect( GTK_OBJECT(win->m_widget), "size_allocate",
+ GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)win );
+
if (position < 0)
gtk_notebook_append_page( notebook, win->m_widget, page->m_box );
else
gtk_notebook_insert_page( notebook, win->m_widget, page->m_box, position );
- page->m_page = GTK_NOTEBOOK_PAGE( g_list_last(notebook->children)->data );
-
- gtk_signal_connect( GTK_OBJECT(win->m_widget), "size_allocate",
- GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)win );
+ page->m_page = (GtkNotebookPage*) g_list_last(notebook->children)->data;
/* set the label image */
page->m_image = imageId;
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
+#endif
\ No newline at end of file