X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/279b5e2ece2a659ee788938cca76045787eaf978..d4a376ac6c526b51dda4b40bc56e7fedb6c15ff5:/src/gtk/notebook.cpp diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 28634b6cc0..8b23e3256e 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -222,9 +222,14 @@ static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk // InsertChild callback for wxNotebook //----------------------------------------------------------------------------- -static void wxInsertChildInNotebook( wxNotebook* WXUNUSED(parent), wxWindow* WXUNUSED(child) ) -{ - /* we don't do anything here but pray */ +static void wxInsertChildInNotebook( wxNotebook* parent, wxWindow* child ) +{ + // Hack alert! We manually set the child window + // parent field so that GTK can query the + // notebook's style and font. Without that, GetBestSize could return + // incorrect size, see bug #901694 for details + // (http://sourceforge.net/tracker/?func=detail&aid=901694&group_id=9863&atid=109863) + child->m_widget->parent = parent->m_widget; } //----------------------------------------------------------------------------- @@ -589,7 +594,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 );