]> git.saurik.com Git - wxWidgets.git/commitdiff
using a dynamic cast to wxFrame in order to get the MenuBar correctly from the frontm...
authorStefan Csomor <csomor@advancedconcepts.ch>
Fri, 20 Jan 2006 21:16:55 +0000 (21:16 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Fri, 20 Jan 2006 21:16:55 +0000 (21:16 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37018 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/frame.cpp

index 8a07a0bbc62193657599a308a27b900acd6bc75e..12853edfa48683492d2c2e78c584a9df6866887f 100644 (file)
@@ -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 );