using a dynamic cast to wxFrame in order to get the MenuBar correctly from the frontmost window

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37018 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2006-01-20 21:16:55 +00:00
parent be6068f6c3
commit 487eedb8d8

View File

@@ -232,14 +232,14 @@ void wxFrame::DetachMenuBar()
void wxFrame::AttachMenuBar( wxMenuBar *menuBar ) void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
{ {
wxTopLevelWindowMac* tlw = wxFindWinFromMacWindow( FrontNonFloatingWindow() ); wxFrame* tlf = wxDynamicCast( wxFindWinFromMacWindow( FrontNonFloatingWindow() ) , wxFrame );
bool makeCurrent = false; bool makeCurrent = false;
// if this is already the current menubar or we are the frontmost window // if this is already the current menubar or we are the frontmost window
if ( (tlw == this) || (m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar()) ) if ( (tlf == this) || (m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar()) )
makeCurrent = true; makeCurrent = true;
// or there is an app-level menubar like MDI // or there is an app-level menubar like MDI
else if ( (GetMenuBar() == NULL) && (((wxFrame*)wxTheApp->GetTopWindow()) == this) ) else if ( tlf && (tlf->GetMenuBar() == NULL) && (((wxFrame*)wxTheApp->GetTopWindow()) == this) )
makeCurrent = true; makeCurrent = true;
wxFrameBase::AttachMenuBar( menuBar ); wxFrameBase::AttachMenuBar( menuBar );