fix for menu helpstring in the status bar for MDI child frames

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7158 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-04-13 18:03:34 +00:00
parent cbb5561c49
commit 99f55f5c26
6 changed files with 69 additions and 29 deletions

View File

@@ -284,29 +284,7 @@ void wxFrameBase::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
void wxFrameBase::OnMenuHighlight(wxMenuEvent& event)
{
#if wxUSE_STATUSBAR
if ( GetStatusBar() )
{
// if no help string found, we will clear the status bar text
wxString helpString;
int menuId = event.GetMenuId();
if ( menuId != wxID_SEPARATOR && menuId != -2 /* wxID_TITLE */ )
{
wxMenuBar *menuBar = GetMenuBar();
if ( menuBar )
{
// it's ok if we don't find the item because it might belong
// to the popup menu
wxMenuItem *item = menuBar->FindItem(menuId);
if ( item )
helpString = item->GetHelp();
}
}
// set status text even if the string is empty - this will at least
// remove the string from the item which was previously selected
SetStatusText(helpString);
}
(void)ShowMenuHelp(GetStatusBar(), event.GetMenuId());
#endif // wxUSE_STATUSBAR
}
@@ -372,6 +350,34 @@ void wxFrameBase::SetStatusWidths(int n, const int widths_field[] )
PositionStatusBar();
}
bool wxFrameBase::ShowMenuHelp(wxStatusBar *statbar, int menuId)
{
if ( !statbar )
return FALSE;
// if no help string found, we will clear the status bar text
wxString helpString;
if ( menuId != wxID_SEPARATOR && menuId != -2 /* wxID_TITLE */ )
{
wxMenuBar *menuBar = GetMenuBar();
if ( menuBar )
{
// it's ok if we don't find the item because it might belong
// to the popup menu
wxMenuItem *item = menuBar->FindItem(menuId);
if ( item )
helpString = item->GetHelp();
}
}
// 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);
return !helpString.IsEmpty();
}
#endif // wxUSE_STATUSBAR
// ----------------------------------------------------------------------------