+ /* 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_page( notebook, g_list_length( notebook->children ) - 1 );
+
+ m_justInserted = FALSE;
+ return;
+ }
+
+ wxFrame::OnInternalIdle();
+
+ wxMDIChildFrame *active_child_frame = GetActiveChild();
+ bool visible_child_menu = FALSE;
+
+ wxNode *node = m_clientWindow->GetChildren().First();
+ while (node)
+ {
+ wxObject *child = node->Data();
+ wxMDIChildFrame *child_frame = wxDynamicCast(child, 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->m_width = m_width;
+ menu_bar->m_height = wxMENU_HEIGHT;
+ gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
+ menu_bar->m_widget,
+ 0, 0, m_width, wxMENU_HEIGHT );
+ menu_bar->SetInvokingWindow( child_frame );
+ }
+ visible_child_menu = TRUE;
+ }
+ else
+ {
+ if (menu_bar->Show(FALSE))
+ {
+ menu_bar->UnsetInvokingWindow( child_frame );
+ }
+ }
+ }
+ }
+
+ node = node->Next();
+ }
+
+ /* 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 );
+
+ m_frameMenuBar->m_width = m_width;
+ m_frameMenuBar->m_height = wxMENU_HEIGHT;
+ gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
+ m_frameMenuBar->m_widget,
+ 0, 0, m_width, wxMENU_HEIGHT );
+ }
+ }
+}