X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e6feb95a79834836e88143b15d9f424ebe79621..1facd32a75f3ef190a336e96fabf17632ade7228:/src/common/framecmn.cpp?ds=sidebyside diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp index 714400961b..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 // ---------------------------------------------------------------------------- @@ -385,6 +392,7 @@ void wxFrameBase::SetStatusWidths(int n, const int widths_field[] ) bool wxFrameBase::ShowMenuHelp(wxStatusBar *statbar, int menuId) { +#if wxUSE_MENUS if ( !statbar ) return FALSE; @@ -409,6 +417,9 @@ bool wxFrameBase::ShowMenuHelp(wxStatusBar *statbar, int menuId) statbar->SetStatusText(helpString); return !helpString.IsEmpty(); +#else // !wxUSE_MENUS + return FALSE; +#endif // wxUSE_MENUS/!wxUSE_MENUS } #endif // wxUSE_STATUSBAR @@ -445,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 @@ -506,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