+static gint
+gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxNotebook *notebook )
+{
+ if (g_blockEventsOnDrag) return FALSE;
+
+ if (!notebook->HasVMT()) return FALSE;
+
+ if (gdk_event->keyval != GDK_Down) return FALSE;
+
+ if (notebook != notebook->FindFocus()) return FALSE;
+
+ if (notebook->m_pages.GetCount() == 0) return FALSE;
+
+ wxNode *node = notebook->m_pages.Nth( notebook->GetSelection() );
+
+ if (!node) return FALSE;
+
+ wxNotebookPage *page = (wxNotebookPage*) node->Data();
+
+ // don't let others the key event
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
+
+ page->m_client->SetFocus();
+
+ return TRUE;
+}
+
+//-----------------------------------------------------------------------------
+// InsertChild callback for wxNotebook
+//-----------------------------------------------------------------------------
+
+static void wxInsertChildInNotebook( wxNotebook* parent, wxWindow* child )
+{
+ wxNotebookPage *page = new wxNotebookPage();
+
+ page->m_id = parent->GetPageCount();
+
+ page->m_box = gtk_hbox_new (FALSE, 0);
+ gtk_container_border_width(GTK_CONTAINER(page->m_box), 2);
+
+ GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget);
+
+ page->m_client = child;
+ gtk_notebook_append_page( notebook, child->m_widget, page->m_box );
+
+ page->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
+
+ page->m_parent = notebook;
+
+ gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
+ GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
+
+ wxASSERT_MSG( page->m_page, "Notebook page creation error" );
+
+ parent->m_pages.Append( page );
+}
+
+//-----------------------------------------------------------------------------
+// wxNotebook
+//-----------------------------------------------------------------------------