]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/notebook.cpp
Fixed some problems in converting existing static libs into DLLs.
[wxWidgets.git] / src / gtk / notebook.cpp
index 28634b6cc099b817c131aea610d19f60251c703d..8b23e3256e07a08118ede466989a124f24c39257 100644 (file)
@@ -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 );