added virtual wxFrame::FindItemInMenuBar(): overriding it in wxMDIParentFrame allows to look for the items in the active child when giving help for the current menu item

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46114 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-05-18 17:03:38 +00:00
parent 722ed5bed5
commit 10816efb2c
4 changed files with 34 additions and 29 deletions

View File

@@ -356,15 +356,12 @@ bool wxFrameBase::ShowMenuHelp(int menuId)
wxString helpString;
if ( menuId != wxID_SEPARATOR && menuId != -3 /* 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();
}
const wxMenuItem * const item = FindItemInMenuBar(menuId);
if ( item )
helpString = item->GetHelp();
// notice that it's ok if we don't find the item because it might
// belong to the popup menu, so don't assert here
}
DoGiveHelp(helpString, true);
@@ -560,4 +557,11 @@ void wxFrameBase::SetMenuBar(wxMenuBar *menubar)
this->AttachMenuBar(menubar);
}
const wxMenuItem *wxFrameBase::FindItemInMenuBar(int menuId) const
{
const wxMenuBar * const menuBar = GetMenuBar();
return menuBar ? menuBar->FindItem(menuId) : NULL;
}
#endif // wxUSE_MENUS