-void wxMDIParentFrame::SetMDIMenuBar( wxMenuBar *menu_bar )
-{
- if (m_mdiMenuBar) m_mdiMenuBar->Show( FALSE );
- m_mdiMenuBar = menu_bar;
- if (m_mdiMenuBar)
- {
- int x = 0;
- int y = 0;
- GetClientSize( &x, &y );
- m_mdiMenuBar->SetSize( 1, 1, x-2, 26 );
- m_mdiMenuBar->Show( TRUE );
- }
-}
+ 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))
+ {
+ // Attach() asserts if we call it for an already
+ // attached menu bar so don't do it if we're already
+ // associated with this frame (it would be nice to get
+ // rid of this check and ensure that this doesn't
+ // happen...)
+ if ( menu_bar->GetFrame() != child_frame )
+ menu_bar->Attach( child_frame );
+ }
+ visible_child_menu = true;
+ }
+ else
+ {
+ if (menu_bar->Show(false))
+ {
+ menu_bar->Detach();
+ }
+ }
+ }
+ }
+
+ node = node->GetNext();
+ }