X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d4597e138eff53fccbcb41259e8cb7ab2db3bab9..b1a046e821900affb64c4a267c653a6a7eafd94c:/src/common/framecmn.cpp diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp index 7b067ddf0d..8ab73139d8 100644 --- a/src/common/framecmn.cpp +++ b/src/common/framecmn.cpp @@ -76,6 +76,13 @@ wxFrameBase::wxFrameBase() #if wxUSE_STATUSBAR m_frameStatusBar = NULL; #endif // wxUSE_STATUSBAR + + m_statusBarPane = 0; +} + +wxFrameBase::~wxFrameBase() +{ + // this destructor is required for Darwin } wxFrame *wxFrameBase::New(wxWindow *parent, @@ -147,7 +154,7 @@ wxPoint wxFrameBase::GetClientAreaOrigin() const { wxPoint pt = wxTopLevelWindow::GetClientAreaOrigin(); -#if wxUSE_TOOLBAR +#if wxUSE_TOOLBAR && !defined(__WXUNIVERSAL__) wxToolBar *toolbar = GetToolBar(); if ( toolbar && toolbar->IsShown() ) { @@ -191,6 +198,7 @@ bool wxFrameBase::ProcessCommand(int id) if (item->IsCheckable()) { item->Toggle(); + // use the new value commandEvent.SetInt(item->IsChecked()); } @@ -271,16 +279,40 @@ void wxFrameBase::SetStatusWidths(int n, const int widths_field[] ) PositionStatusBar(); } -bool wxFrameBase::ShowMenuHelp(wxStatusBar *statbar, int menuId) +void wxFrameBase::PushStatusText(const wxString& text, int number) { -#if wxUSE_MENUS - if ( !statbar ) - return FALSE; + wxCHECK_RET( m_frameStatusBar != NULL, wxT("no statusbar to set text for") ); + + m_frameStatusBar->PushStatusText(text, number); +} + +void wxFrameBase::PopStatusText(int number) +{ + wxCHECK_RET( m_frameStatusBar != NULL, wxT("no statusbar to set text for") ); + + m_frameStatusBar->PopStatusText(number); +} +void wxFrameBase::DoGiveHelp(const wxString& text, bool show) +{ +#if wxUSE_STATUSBAR + if ( m_statusBarPane < 0 ) return; + wxStatusBar* statbar = GetStatusBar(); + if ( !statbar ) return; + + wxString help = show ? text : wxString(); + statbar->SetStatusText( help, m_statusBarPane ); +#endif // wxUSE_STATUSBAR +} + +bool wxFrameBase::ShowMenuHelp(wxStatusBar *WXUNUSED(statbar), int menuId) +{ +#if wxUSE_MENUS // if no help string found, we will clear the status bar text wxString helpString; + bool show = menuId != wxID_SEPARATOR && menuId != -2 /* wxID_TITLE */; - if ( menuId != wxID_SEPARATOR && menuId != -2 /* wxID_TITLE */ ) + if ( show ) { wxMenuBar *menuBar = GetMenuBar(); if ( menuBar ) @@ -293,9 +325,7 @@ bool wxFrameBase::ShowMenuHelp(wxStatusBar *statbar, int menuId) } } - // set status text even if the string is empty - this will at least - // remove the string from the item which was previously selected - statbar->SetStatusText(helpString); + DoGiveHelp(helpString, show); return !helpString.IsEmpty(); #else // !wxUSE_MENUS @@ -404,8 +434,8 @@ void wxFrameBase::AttachMenuBar(wxMenuBar *menubar) { if ( menubar ) { - m_frameMenuBar = menubar; menubar->Attach((wxFrame *)this); + m_frameMenuBar = menubar; } }