From: David Surovell Date: Wed, 29 Mar 2006 20:52:36 +0000 (+0000) Subject: simplify OnActivate menubar install code X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/617bfeecfeeaecec2443d10545879d114c4dff0d simplify OnActivate menubar install code git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38438 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/frame.cpp b/src/mac/carbon/frame.cpp index 399749a1b3..c888e6c41d 100644 --- a/src/mac/carbon/frame.cpp +++ b/src/mac/carbon/frame.cpp @@ -24,7 +24,7 @@ #include "wx/mac/uma.h" extern wxWindowList wxModelessWindows; -extern wxList wxPendingDelete; +//extern wxList wxPendingDelete; BEGIN_EVENT_TABLE(wxFrame, wxFrameBase) EVT_ACTIVATE(wxFrame::OnActivate) @@ -134,7 +134,7 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id, wxStatusBar *statusBar; statusBar = new wxStatusBar(this, id, style, name); - statusBar->SetSize(100 , WX_MAC_STATUSBAR_HEIGHT); + statusBar->SetSize(100, WX_MAC_STATUSBAR_HEIGHT); statusBar->SetFieldsCount(number); return statusBar; @@ -204,21 +204,25 @@ void wxFrame::OnActivate(wxActivateEvent& event) ? m_winLastFocused->GetParent() : NULL; - if ( !parent ) + if (parent == NULL) parent = this; wxSetFocusToChild(parent, &m_winLastFocused); if (m_frameMenuBar != NULL) { - m_frameMenuBar->MacInstallMenuBar() ; + m_frameMenuBar->MacInstallMenuBar(); } - else if (wxTheApp->GetTopWindow() && wxTheApp->GetTopWindow()->IsKindOf(CLASSINFO(wxFrame))) + else { - // Trying toplevel frame membar - if (((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar()) - ((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar()->MacInstallMenuBar(); - } + wxFrame *tlf = wxDynamicCast( wxTheApp->GetTopWindow(), wxFrame ); + if (tlf != NULL) + { + // Trying top-level frame membar + if (tlf->GetMenuBar()) + tlf->GetMenuBar()->MacInstallMenuBar(); + } + } } }