+ wxWindow::AddChild( child );
+}
+
+static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
+{
+ menu->SetInvokingWindow( win );
+ wxNode *node = menu->GetItems().First();
+ while (node)
+ {
+ wxMenuItem *menuitem = (wxMenuItem*)node->Data();
+ if (menuitem->IsSubMenu())
+ SetInvokingWindow( menuitem->GetSubMenu(), win );
+ node = node->Next();
+ }
+}
+
+void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
+{
+ m_menuBar = menu_bar;
+
+ if (m_menuBar)
+ {
+ wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent;
+
+ if (m_menuBar->m_parent != this)
+ {
+ wxNode *node = m_menuBar->GetMenus().First();
+ while (node)
+ {
+ wxMenu *menu = (wxMenu*)node->Data();
+ SetInvokingWindow( menu, this );
+ node = node->Next();
+ }
+
+ m_menuBar->m_parent = mdi_frame;
+ }
+
+ /* the menu bar of the child window is shown in idle time as needed */
+ gtk_widget_hide( m_menuBar->m_widget );
+
+ /* insert the invisible menu bar into the _parent_ mdi frame */
+ gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_mainWidget), m_menuBar->m_widget, 0, 0 );
+ gtk_widget_set_usize( menu_bar->m_widget, mdi_frame->m_width, wxMENU_HEIGHT );
+ }
+}
+
+wxMenuBar *wxMDIChildFrame::GetMenuBar() const
+{
+ return m_menuBar;
+}
+
+void wxMDIChildFrame::Activate()
+{
+}
+
+void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) )
+{
+}
+
+//-----------------------------------------------------------------------------
+// "size_allocate"
+//-----------------------------------------------------------------------------
+
+static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
+{
+ if ((win->m_x == alloc->x) &&
+ (win->m_y == alloc->y) &&
+ (win->m_width == alloc->width) &&
+ (win->m_height == alloc->height) &&
+ (win->m_sizeSet))
+ {
+ return;
+ }
+
+ win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
+}
+
+//-----------------------------------------------------------------------------
+// InsertChild callback for wxMDIClientWindow
+//-----------------------------------------------------------------------------
+
+static void wxInsertChildInMDI( wxMDIClientWindow* parent, wxMDIChildFrame* child )
+{
+ wxString s = child->m_title;
+ if (s.IsNull()) s = _("MDI child");
+
+ GtkWidget *label_widget = gtk_label_new( s.mbc_str() );
+ gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
+
+ gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
+ GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
+
+ GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget);
+
+ gtk_notebook_append_page( notebook, child->m_widget, label_widget );
+
+ child->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
+
+ wxMDIParentFrame *parent_frame = (wxMDIParentFrame*) parent->m_parent;
+ parent_frame->m_justInserted = TRUE;
+}