X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0472ece753aa3c018dd2cc9816d3cd755f28efe8..878711c01c1b9ad5b97d35f379a048b8ce1bfb49:/src/common/framecmn.cpp diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp index 77d1c1e1c4..87911b477f 100644 --- a/src/common/framecmn.cpp +++ b/src/common/framecmn.cpp @@ -4,7 +4,7 @@ // Author: Julian Smart, Vadim Zeitlin // Created: 01/02/97 // Id: $Id$ -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Copyright: (c) 1998 Robert Roebling and Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -41,11 +41,6 @@ #include "wx/statusbr.h" #endif -// FIXME - temporary hack in absence of wxTLW in all ports! -#ifndef wxTopLevelWindowNative - #define wxTopLevelWindow wxTopLevelWindowBase -#endif - // ---------------------------------------------------------------------------- // event table // ---------------------------------------------------------------------------- @@ -76,6 +71,8 @@ wxFrameBase::wxFrameBase() #if wxUSE_STATUSBAR m_frameStatusBar = NULL; #endif // wxUSE_STATUSBAR + + m_statusBarPane = 0; } wxFrameBase::~wxFrameBase() @@ -202,7 +199,8 @@ bool wxFrameBase::ProcessCommand(int id) } } - return GetEventHandler()->ProcessEvent(commandEvent); + GetEventHandler()->ProcessEvent(commandEvent); + return TRUE; #else // !wxUSE_MENUS return FALSE; #endif // wxUSE_MENUS/!wxUSE_MENUS @@ -277,16 +275,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 ) @@ -299,9 +321,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