From d7f1759ac12007c85f5e63b66901cde202bf79dc Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sun, 22 Feb 2004 11:51:23 +0000 Subject: [PATCH] Commit mentioned fix/hack to enable controls inside a notebook to calculate the right size. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25914 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/notebook.cpp | 13 ++++++++++--- src/gtk1/notebook.cpp | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 28634b6cc0..8c7c858c13 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -222,9 +222,12 @@ static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk // InsertChild callback for wxNotebook //----------------------------------------------------------------------------- -static void wxInsertChildInNotebook( wxNotebook* WXUNUSED(parent), wxWindow* WXUNUSED(child) ) +static void wxInsertChildInNotebook( wxNotebook* parent, wxWindow* child ) { - /* we don't do anything here but pray */ + // Hack alert! We manually set the child window + // parent field so that GTK can query the + // notebook's style and font. + child->m_widget->parent = parent->m_widget; } //----------------------------------------------------------------------------- @@ -589,7 +592,11 @@ bool wxNotebook::InsertPage( size_t position, wxCHECK_MSG( position <= GetPageCount(), FALSE, _T("invalid page index in wxNotebookPage::InsertPage()") ); - /* don't receive switch page during addition */ + // Hack alert part II! See above in InsertChildInNotebook + // callback why this has to be done. + win->m_widget->parent = NULL; + + // 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 ); diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index 28634b6cc0..8c7c858c13 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -222,9 +222,12 @@ static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk // InsertChild callback for wxNotebook //----------------------------------------------------------------------------- -static void wxInsertChildInNotebook( wxNotebook* WXUNUSED(parent), wxWindow* WXUNUSED(child) ) +static void wxInsertChildInNotebook( wxNotebook* parent, wxWindow* child ) { - /* we don't do anything here but pray */ + // Hack alert! We manually set the child window + // parent field so that GTK can query the + // notebook's style and font. + child->m_widget->parent = parent->m_widget; } //----------------------------------------------------------------------------- @@ -589,7 +592,11 @@ bool wxNotebook::InsertPage( size_t position, wxCHECK_MSG( position <= GetPageCount(), FALSE, _T("invalid page index in wxNotebookPage::InsertPage()") ); - /* don't receive switch page during addition */ + // Hack alert part II! See above in InsertChildInNotebook + // callback why this has to be done. + win->m_widget->parent = NULL; + + // 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 );