X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c58d22381aaeece1c27c1d9061061ed68f269ae3..50bedb7b44f859e06e23326a89abcac8e98a0a35:/src/gtk/notebook.cpp diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 0b95ed355e..13bc0dae9d 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -104,7 +104,7 @@ static void event_after(GtkNotebook* widget, GdkEvent*, wxNotebook* win) // InsertChild callback for wxNotebook //----------------------------------------------------------------------------- -static void wxInsertChildInNotebook(wxWindow* parent, wxWindow* child) +void wxNotebook::AddChildGTK(wxWindowGTK* child) { // Hack Alert! (Part I): This sets the notebook as the parent of the child // widget, and takes care of some details such as updating the state and @@ -114,7 +114,7 @@ static void wxInsertChildInNotebook(wxWindow* parent, wxWindow* child) // incorrect sizes since the widget's style context is not fully known. // See bug #901694 for details // (http://sourceforge.net/tracker/?func=detail&aid=901694&group_id=9863&atid=109863) - gtk_widget_set_parent(child->m_widget, parent->m_widget); + gtk_widget_set_parent(child->m_widget, m_widget); // NOTE: This should be considered a temporary workaround until we can // work out the details and implement delaying the setting of the initial @@ -160,8 +160,6 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) { - m_insertCallback = wxInsertChildInNotebook; - if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) style |= wxBK_TOP; @@ -174,6 +172,7 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id, m_widget = gtk_notebook_new(); + g_object_ref(m_widget); gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 ); @@ -345,7 +344,6 @@ wxNotebookPage *wxNotebook::DoRemovePage( size_t page ) if ( !client ) return NULL; - gtk_widget_ref( client->m_widget ); gtk_widget_unrealize( client->m_widget ); // we don't need to unparent the client->m_widget; GTK+ will do @@ -377,12 +375,9 @@ bool wxNotebook::InsertPage( size_t position, wxCHECK_MSG( position <= GetPageCount(), false, _T("invalid page index in wxNotebookPage::InsertPage()") ); - // Hack Alert! (Part II): See above in wxInsertChildInNotebook callback - // why this has to be done. NOTE: using gtk_widget_unparent here does not - // work as it seems to undo too much and will cause errors in the - // gtk_notebook_insert_page below, so instead just clear the parent by - // hand here. - win->m_widget->parent = NULL; + // Hack Alert! (Part II): See above in wxNotebook::AddChildGTK + // why this has to be done. + gtk_widget_unparent(win->m_widget); if (m_themeEnabled) win->SetThemeEnabled(true);