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()
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
{
- m_clientWindow = new wxMDIClientWindow( this );
- return m_clientWindow;
+ return new wxMDIClientWindow( this );
}
void wxMDIParentFrame::ActivateNext()
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();
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;
}
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") ))
{
}
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);