+ return true;
+}
+
+void wxMDIParentFrame::OnInternalIdle()
+{
+ /* if a an MDI child window has just been inserted
+ it has to be brought to the top in idle time. we
+ simply set the last notebook page active as new
+ pages can only be appended at the end */
+
+ if (m_justInserted)
+ {
+ GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
+ gtk_notebook_set_current_page( notebook, g_list_length( notebook->children ) - 1 );
+
+ /* need to set the menubar of the child */
+ wxMDIChildFrame *active_child_frame = GetActiveChild();
+ if (active_child_frame != NULL)
+ {
+ wxMenuBar *menu_bar = active_child_frame->m_menuBar;
+ if (menu_bar)
+ {
+ menu_bar->SetInvokingWindow(active_child_frame);
+ }
+ }
+ m_justInserted = false;
+ return;
+ }
+
+ wxFrame::OnInternalIdle();
+
+ wxMDIChildFrame *active_child_frame = GetActiveChild();
+ bool visible_child_menu = false;
+
+ wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
+ while (node)
+ {
+ wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
+
+ if ( child_frame )
+ {
+ wxMenuBar *menu_bar = child_frame->m_menuBar;
+ if ( menu_bar )
+ {
+ if (child_frame == active_child_frame)
+ {
+ if (menu_bar->Show(true))
+ {
+ menu_bar->SetInvokingWindow( child_frame );
+ }
+ visible_child_menu = true;
+ }
+ else
+ {
+ if (menu_bar->Show(false))
+ {
+ menu_bar->UnsetInvokingWindow( child_frame );
+ }
+ }
+ }
+ }
+
+ node = node->GetNext();
+ }
+
+ /* show/hide parent menu bar as required */
+ if ((m_frameMenuBar) &&
+ (m_frameMenuBar->IsShown() == visible_child_menu))
+ {
+ if (visible_child_menu)
+ {
+ m_frameMenuBar->Show( false );
+ m_frameMenuBar->UnsetInvokingWindow( this );
+ }
+ else
+ {
+ m_frameMenuBar->Show( true );
+ m_frameMenuBar->SetInvokingWindow( this );
+ }
+ }
+}
+
+void wxMDIParentFrame::DoGetClientSize(int* width, int* height) const
+{
+ wxFrame::DoGetClientSize(width, height);
+
+ if (height)
+ {
+ wxMDIChildFrame* active_child_frame = GetActiveChild();
+ if (active_child_frame)
+ {
+ wxMenuBar* menubar = active_child_frame->m_menuBar;
+ if (menubar && menubar->IsShown())
+ {
+ GtkRequisition req;
+ gtk_widget_size_request(menubar->m_widget, &req);
+ *height -= req.height;
+ if (*height < 0) *height = 0;
+ }
+ }
+ }
+}
+
+wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const