]> git.saurik.com Git - wxWidgets.git/commitdiff
Commit mentioned fix/hack to enable controls
authorRobert Roebling <robert@roebling.de>
Sun, 22 Feb 2004 11:51:23 +0000 (11:51 +0000)
committerRobert Roebling <robert@roebling.de>
Sun, 22 Feb 2004 11:51:23 +0000 (11:51 +0000)
   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
src/gtk1/notebook.cpp

index 28634b6cc099b817c131aea610d19f60251c703d..8c7c858c13dd91c89a9622e7655e6f07dd3c23e0 100644 (file)
@@ -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 );
 
index 28634b6cc099b817c131aea610d19f60251c703d..8c7c858c13dd91c89a9622e7655e6f07dd3c23e0 100644 (file)
@@ -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 );