+ return client;
+}
+
+bool wxNotebook::InsertPage( size_t position,
+ wxNotebookPage* win,
+ const wxString& text,
+ bool select,
+ int imageId )
+{
+ wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid notebook") );
+
+ wxCHECK_MSG( win->GetParent() == this, FALSE,
+ wxT("Can't add a page whose parent is not the notebook!") );
+
+ wxCHECK_MSG( position <= GetPageCount(), FALSE,
+ _T("invalid page index in wxNotebookPage::InsertPage()") );
+
+ /* don't receive switch page during addition */
+ gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
+ GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer) this );
+
+ if (m_themeEnabled)
+ win->SetThemeEnabled(TRUE);
+
+ GtkNotebook *notebook = GTK_NOTEBOOK(m_widget);
+
+ wxGtkNotebookPage *nb_page = new wxGtkNotebookPage();
+
+ if ( position == GetPageCount() )
+ m_pagesData.Append( nb_page );
+ else
+ m_pagesData.Insert( m_pagesData.Item( position ), nb_page );
+
+ m_pages.Insert(win, position);
+
+ nb_page->m_box = gtk_hbox_new( FALSE, 1 );
+ gtk_container_border_width( GTK_CONTAINER(nb_page->m_box), 2 );
+
+ gtk_signal_connect( GTK_OBJECT(win->m_widget), "size_allocate",
+ GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)win );
+
+#ifndef __VMS
+ // On VMS position is unsigned and thus always positive
+ if (position < 0)
+ gtk_notebook_append_page( notebook, win->m_widget, nb_page->m_box );
+ else
+#endif
+ gtk_notebook_insert_page( notebook, win->m_widget, nb_page->m_box, position );
+
+ nb_page->m_page = (GtkNotebookPage*) g_list_last(notebook->children)->data;
+
+ /* set the label image */
+ nb_page->m_image = imageId;
+
+ if (imageId != -1)
+ {
+ wxASSERT( m_imageList != NULL );
+
+ const wxBitmap *bmp = m_imageList->GetBitmap(imageId);
+ GdkPixmap *pixmap = bmp->GetPixmap();
+ GdkBitmap *mask = (GdkBitmap*) NULL;
+ if ( bmp->GetMask() )
+ {
+ mask = bmp->GetMask()->GetBitmap();
+ }
+
+ GtkWidget *pixmapwid = gtk_pixmap_new (pixmap, mask );
+
+ gtk_box_pack_start(GTK_BOX(nb_page->m_box), pixmapwid, FALSE, FALSE, m_padding);
+
+ gtk_widget_show(pixmapwid);
+ }
+
+ /* set the label text */
+ nb_page->m_text = text;
+ if (nb_page->m_text.IsEmpty()) nb_page->m_text = wxT("");