X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/937013e0fd914d4c42f9f5ec98da665986b93dfa..357d2b88cb15fa0ad97b1676fdbc88c2abc85451:/src/gtk/mdi.cpp diff --git a/src/gtk/mdi.cpp b/src/gtk/mdi.cpp index ef4c027e25..f3f027e03e 100644 --- a/src/gtk/mdi.cpp +++ b/src/gtk/mdi.cpp @@ -99,11 +99,12 @@ bool wxMDIParentFrame::Create(wxWindow *parent, long style, const wxString& name ) { - wxFrame::Create( parent, id, title, pos, size, style, name ); + if ( !wxFrame::Create( parent, id, title, pos, size, style, name ) ) + return false; - OnCreateClient(); + m_clientWindow = OnCreateClient(); - return true; + return m_clientWindow != NULL; } void wxMDIParentFrame::OnInternalIdle() @@ -246,8 +247,7 @@ wxMDIClientWindow *wxMDIParentFrame::GetClientWindow() const wxMDIClientWindow *wxMDIParentFrame::OnCreateClient() { - m_clientWindow = new wxMDIClientWindow( this ); - return m_clientWindow; + return new wxMDIClientWindow( this ); } void wxMDIParentFrame::ActivateNext() @@ -293,6 +293,10 @@ wxMDIChildFrame::~wxMDIChildFrame() { if (m_menuBar) delete m_menuBar; + + // wxMDIClientWindow does not get redrawn properly after last child is removed + if (m_parent && m_parent->GetChildren().size() <= 1) + gtk_widget_queue_draw(m_parent->m_widget); } bool wxMDIChildFrame::Create( wxMDIParentFrame *parent, @@ -398,11 +402,7 @@ void wxMDIChildFrame::SetTitle( const wxString &title ) gtk_notebook_set_tab_label_text(notebook, m_widget, wxGTK_CONV( title ) ); } -//----------------------------------------------------------------------------- -// InsertChild callback for wxMDIClientWindow -//----------------------------------------------------------------------------- - -static void wxInsertChildInMDI(wxWindow* parent, wxWindow* child) +void wxMDIClientWindow::AddChildGTK(wxWindowGTK* child) { wxMDIChildFrame* child_frame = wx_static_cast(wxMDIChildFrame*, child); wxString s = child_frame->GetTitle(); @@ -411,13 +411,13 @@ static void wxInsertChildInMDI(wxWindow* parent, wxWindow* child) GtkWidget *label_widget = gtk_label_new( s.mbc_str() ); gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 ); - GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget); + GtkNotebook* notebook = GTK_NOTEBOOK(m_widget); gtk_notebook_append_page( notebook, child->m_widget, label_widget ); child_frame->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data); - wxMDIParentFrame *parent_frame = wx_static_cast(wxMDIParentFrame*, parent->GetParent()); + wxMDIParentFrame* parent_frame = wx_static_cast(wxMDIParentFrame*, GetParent()); parent_frame->m_justInserted = true; } @@ -443,8 +443,6 @@ wxMDIClientWindow::~wxMDIClientWindow() bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style ) { - m_insertCallback = wxInsertChildInMDI; - if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) || !CreateBase( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("wxMDIClientWindow") )) { @@ -453,6 +451,7 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style ) } m_widget = gtk_notebook_new(); + g_object_ref(m_widget); g_signal_connect (m_widget, "switch_page", G_CALLBACK (gtk_mdi_page_change_callback), parent);