X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3379ed3789e405f874d9db757d95346f1d378795..6443de026310552cacd68a6d0318e73d14929680:/src/common/framecmn.cpp diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp index 9ec8339d2f..318b662f28 100644 --- a/src/common/framecmn.cpp +++ b/src/common/framecmn.cpp @@ -321,6 +321,13 @@ bool wxFrameBase::SendIconizeEvent(bool iconized) return GetEventHandler()->ProcessEvent(event); } +void wxFrameBase::OnIdle(wxIdleEvent& WXUNUSED(event) ) +{ +#if wxUSE_MENUS + DoMenuUpdates(); +#endif // wxUSE_MENUS +} + // ---------------------------------------------------------------------------- // status bar stuff // ---------------------------------------------------------------------------- @@ -449,16 +456,9 @@ wxToolBar* wxFrameBase::OnCreateToolBar(long style, #endif // wxUSE_TOOLBAR // ---------------------------------------------------------------------------- -// Menu UI updating +// menus // ---------------------------------------------------------------------------- -void wxFrameBase::OnIdle(wxIdleEvent& WXUNUSED(event) ) -{ -#if wxUSE_MENUS - DoMenuUpdates(); -#endif // wxUSE_MENUS -} - #if wxUSE_MENUS // update all menus @@ -510,4 +510,35 @@ void wxFrameBase::DoMenuUpdates(wxMenu* menu, wxWindow* focusWin) } } +void wxFrameBase::DetachMenuBar() +{ + if ( m_frameMenuBar ) + { + m_frameMenuBar->Detach(); + m_frameMenuBar = NULL; + } +} + +void wxFrameBase::AttachMenuBar(wxMenuBar *menubar) +{ + if ( menubar ) + { + m_frameMenuBar = menubar; + menubar->Attach((wxFrame *)this); + } +} + +void wxFrameBase::SetMenuBar(wxMenuBar *menubar) +{ + if ( menubar == GetMenuBar() ) + { + // nothing to do + return; + } + + DetachMenuBar(); + + AttachMenuBar(menubar); +} + #endif // wxUSE_MENUS