]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/mdi.cpp
set selection point to end in wxTextEntryBase::SetValue() as this should be done...
[wxWidgets.git] / src / gtk / mdi.cpp
index da981865bf31a1b38b23885cb3ed678dc9b8e004..f3f027e03e990ecc9b01b8749275e3d124eeed12 100644 (file)
@@ -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()
@@ -402,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();
@@ -415,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;
 }
 
@@ -447,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") ))
     {
@@ -457,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);