remove the recently added MSWFindMenuBarItem() as we already had FindItemInMenuBar() for the same purpose; just change the latter to return a non-const pointer; this fixes help string display in the status bar for the window menu items

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58478 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-01-28 09:14:07 +00:00
parent 838e6ed707
commit 79f9ea0541
6 changed files with 10 additions and 25 deletions

View File

@@ -83,7 +83,7 @@ public:
// find the item by id in the frame menu bar: this is an internal function // find the item by id in the frame menu bar: this is an internal function
// and exists mainly in order to be overridden in the MDI parent frame // and exists mainly in order to be overridden in the MDI parent frame
// which also looks at its active child menu bar // which also looks at its active child menu bar
virtual const wxMenuItem *FindItemInMenuBar(int menuId) const; virtual wxMenuItem *FindItemInMenuBar(int menuId) const;
// generate menu command corresponding to the given menu item // generate menu command corresponding to the given menu item
// //

View File

@@ -107,9 +107,6 @@ public:
// get the currently active menu: this is the same as the frame menu for // get the currently active menu: this is the same as the frame menu for
// normal frames but is overridden by wxMDIParentFrame // normal frames but is overridden by wxMDIParentFrame
virtual WXHMENU MSWGetActiveMenu() const { return m_hMenu; } virtual WXHMENU MSWGetActiveMenu() const { return m_hMenu; }
// find the item in our menu bar: this is again a hook for MDI frames
virtual wxMenuItem *MSWFindMenuBarItem(WXWORD id);
#endif // wxUSE_MENUS #endif // wxUSE_MENUS
protected: protected:

View File

@@ -104,8 +104,8 @@ public:
#if wxUSE_MENUS #if wxUSE_MENUS
// override wxFrameBase function to also look in the active child menu bar // override wxFrameBase function to also look in the active child menu bar
virtual const wxMenuItem *FindItemInMenuBar(int menuId) const; // and the "Window" menu
virtual wxMenuItem *MSWFindMenuBarItem(WXWORD id); virtual wxMenuItem *FindItemInMenuBar(int menuId) const;
#endif // wxUSE_MENUS #endif // wxUSE_MENUS
protected: protected:

View File

@@ -551,7 +551,7 @@ void wxFrameBase::SetMenuBar(wxMenuBar *menubar)
this->AttachMenuBar(menubar); this->AttachMenuBar(menubar);
} }
const wxMenuItem *wxFrameBase::FindItemInMenuBar(int menuId) const wxMenuItem *wxFrameBase::FindItemInMenuBar(int menuId) const
{ {
const wxMenuBar * const menuBar = GetMenuBar(); const wxMenuBar * const menuBar = GetMenuBar();

View File

@@ -901,7 +901,7 @@ bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
if ( !wxCurrentPopupMenu ) if ( !wxCurrentPopupMenu )
#endif // wxUSE_MENUS_NATIVE #endif // wxUSE_MENUS_NATIVE
{ {
wxMenuItem * const mitem = MSWFindMenuBarItem(id); wxMenuItem * const mitem = FindItemInMenuBar((signed short)id);
if ( mitem ) if ( mitem )
return ProcessCommand(mitem); return ProcessCommand(mitem);
} }
@@ -913,12 +913,6 @@ bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
#if wxUSE_MENUS #if wxUSE_MENUS
wxMenuItem *wxFrame::MSWFindMenuBarItem(WXWORD id)
{
wxMenuBar * const mbar = GetMenuBar();
return mbar ? mbar->FindItem((signed short)id) : NULL;
}
bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu)
{ {
int item; int item;

View File

@@ -406,14 +406,17 @@ void wxMDIParentFrame::DoMenuUpdates(wxMenu* menu)
} }
} }
const wxMenuItem *wxMDIParentFrame::FindItemInMenuBar(int menuId) const wxMenuItem *wxMDIParentFrame::FindItemInMenuBar(int menuId) const
{ {
const wxMenuItem *item = wxFrame::FindItemInMenuBar(menuId); wxMenuItem *item = wxFrame::FindItemInMenuBar(menuId);
if ( !item && GetActiveChild() ) if ( !item && GetActiveChild() )
{ {
item = GetActiveChild()->FindItemInMenuBar(menuId); item = GetActiveChild()->FindItemInMenuBar(menuId);
} }
if ( !item && m_windowMenu )
item = m_windowMenu->FindItem(menuId);
return item; return item;
} }
@@ -683,15 +686,6 @@ void wxMDIParentFrame::OnMDICommand(wxCommandEvent& event)
::SendMessage(GetWinHwnd(GetClientWindow()), msg, wParam, lParam); ::SendMessage(GetWinHwnd(GetClientWindow()), msg, wParam, lParam);
} }
wxMenuItem *wxMDIParentFrame::MSWFindMenuBarItem(WXWORD id)
{
wxMenuItem *mitem = wxFrame::MSWFindMenuBarItem(id);
if ( !mitem && m_windowMenu )
mitem = m_windowMenu->FindItem((signed short)id);
return mitem;
}
#endif // wxUSE_MENUS #endif // wxUSE_MENUS
bool wxMDIParentFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd) bool wxMDIParentFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd)