}
}
#endif
-
+
return pt;
}
void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
{
- wxFrameBase::AttachMenuBar(menuBar);
+ wxFrame* tlf = wxDynamicCast( wxFindWinFromMacWindow( FrontNonFloatingWindow() ) , wxFrame );
+ bool makeCurrent = false;
+
+ // if this is already the current menubar or we are the frontmost window
+ if ( (tlf == this) || (m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar()) )
+ makeCurrent = true;
+ // or there is an app-level menubar like MDI
+ else if ( tlf && (tlf->GetMenuBar() == NULL) && (((wxFrame*)wxTheApp->GetTopWindow()) == this) )
+ makeCurrent = true;
+
+ wxFrameBase::AttachMenuBar( menuBar );
if (m_frameMenuBar)
+ {
m_frameMenuBar->SetInvokingWindow( this );
+ if (makeCurrent)
+ m_frameMenuBar->MacInstallMenuBar();
+ }
}
void wxFrame::DoGetClientSize(int *x, int *y) const
{
if ( m_frameToolBar == toolbar )
return ;
-
+
#if wxMAC_USE_NATIVE_TOOLBAR
if ( m_frameToolBar )
m_frameToolBar->MacInstallNativeToolbar( false ) ;