simplify OnActivate menubar install code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38438 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Surovell 2006-03-29 20:52:36 +00:00
parent 3c24dad6f7
commit 617bfeecfe

View File

@ -24,7 +24,7 @@
#include "wx/mac/uma.h" #include "wx/mac/uma.h"
extern wxWindowList wxModelessWindows; extern wxWindowList wxModelessWindows;
extern wxList wxPendingDelete; //extern wxList wxPendingDelete;
BEGIN_EVENT_TABLE(wxFrame, wxFrameBase) BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
EVT_ACTIVATE(wxFrame::OnActivate) EVT_ACTIVATE(wxFrame::OnActivate)
@ -134,7 +134,7 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
wxStatusBar *statusBar; wxStatusBar *statusBar;
statusBar = new wxStatusBar(this, id, style, name); statusBar = new wxStatusBar(this, id, style, name);
statusBar->SetSize(100 , WX_MAC_STATUSBAR_HEIGHT); statusBar->SetSize(100, WX_MAC_STATUSBAR_HEIGHT);
statusBar->SetFieldsCount(number); statusBar->SetFieldsCount(number);
return statusBar; return statusBar;
@ -204,21 +204,25 @@ void wxFrame::OnActivate(wxActivateEvent& event)
? m_winLastFocused->GetParent() ? m_winLastFocused->GetParent()
: NULL; : NULL;
if ( !parent ) if (parent == NULL)
parent = this; parent = this;
wxSetFocusToChild(parent, &m_winLastFocused); wxSetFocusToChild(parent, &m_winLastFocused);
if (m_frameMenuBar != NULL) if (m_frameMenuBar != NULL)
{ {
m_frameMenuBar->MacInstallMenuBar() ; m_frameMenuBar->MacInstallMenuBar();
} }
else if (wxTheApp->GetTopWindow() && wxTheApp->GetTopWindow()->IsKindOf(CLASSINFO(wxFrame))) else
{ {
// Trying toplevel frame membar wxFrame *tlf = wxDynamicCast( wxTheApp->GetTopWindow(), wxFrame );
if (((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar()) if (tlf != NULL)
((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar()->MacInstallMenuBar(); {
} // Trying top-level frame membar
if (tlf->GetMenuBar())
tlf->GetMenuBar()->MacInstallMenuBar();
}
}
} }
} }