From: Stefan Csomor Date: Fri, 20 Jan 2006 21:16:55 +0000 (+0000) Subject: using a dynamic cast to wxFrame in order to get the MenuBar correctly from the frontm... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/487eedb8d804fd5f6d60ac5962ed49d983fce48e 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 --- diff --git a/src/mac/carbon/frame.cpp b/src/mac/carbon/frame.cpp index 8a07a0bbc6..12853edfa4 100644 --- a/src/mac/carbon/frame.cpp +++ b/src/mac/carbon/frame.cpp @@ -232,14 +232,14 @@ void wxFrame::DetachMenuBar() void wxFrame::AttachMenuBar( wxMenuBar *menuBar ) { - wxTopLevelWindowMac* tlw = wxFindWinFromMacWindow( FrontNonFloatingWindow() ); + wxFrame* tlf = wxDynamicCast( wxFindWinFromMacWindow( FrontNonFloatingWindow() ) , wxFrame ); bool makeCurrent = false; // 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; // 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; wxFrameBase::AttachMenuBar( menuBar );