From 79f9ea0541e410d65899631db630e955af3b6a84 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 28 Jan 2009 09:14:07 +0000 Subject: [PATCH] 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 --- include/wx/frame.h | 2 +- include/wx/msw/frame.h | 3 --- include/wx/msw/mdi.h | 4 ++-- src/common/framecmn.cpp | 2 +- src/msw/frame.cpp | 8 +------- src/msw/mdi.cpp | 16 +++++----------- 6 files changed, 10 insertions(+), 25 deletions(-) diff --git a/include/wx/frame.h b/include/wx/frame.h index fe6694fbc7..82588b26e3 100644 --- a/include/wx/frame.h +++ b/include/wx/frame.h @@ -83,7 +83,7 @@ public: // 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 // 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 // diff --git a/include/wx/msw/frame.h b/include/wx/msw/frame.h index e43cc2247e..348853262a 100644 --- a/include/wx/msw/frame.h +++ b/include/wx/msw/frame.h @@ -107,9 +107,6 @@ public: // get the currently active menu: this is the same as the frame menu for // normal frames but is overridden by wxMDIParentFrame 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 protected: diff --git a/include/wx/msw/mdi.h b/include/wx/msw/mdi.h index 127cc968ba..857f9bed3c 100644 --- a/include/wx/msw/mdi.h +++ b/include/wx/msw/mdi.h @@ -104,8 +104,8 @@ public: #if wxUSE_MENUS // override wxFrameBase function to also look in the active child menu bar - virtual const wxMenuItem *FindItemInMenuBar(int menuId) const; - virtual wxMenuItem *MSWFindMenuBarItem(WXWORD id); + // and the "Window" menu + virtual wxMenuItem *FindItemInMenuBar(int menuId) const; #endif // wxUSE_MENUS protected: diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp index baab1cfa3e..df7261eefc 100644 --- a/src/common/framecmn.cpp +++ b/src/common/framecmn.cpp @@ -551,7 +551,7 @@ void wxFrameBase::SetMenuBar(wxMenuBar *menubar) this->AttachMenuBar(menubar); } -const wxMenuItem *wxFrameBase::FindItemInMenuBar(int menuId) const +wxMenuItem *wxFrameBase::FindItemInMenuBar(int menuId) const { const wxMenuBar * const menuBar = GetMenuBar(); diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 774e99e27b..2559981536 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -901,7 +901,7 @@ bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) if ( !wxCurrentPopupMenu ) #endif // wxUSE_MENUS_NATIVE { - wxMenuItem * const mitem = MSWFindMenuBarItem(id); + wxMenuItem * const mitem = FindItemInMenuBar((signed short)id); if ( mitem ) return ProcessCommand(mitem); } @@ -913,12 +913,6 @@ bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) #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) { int item; diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index af398a3de6..0a72ab2ea7 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -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() ) { item = GetActiveChild()->FindItemInMenuBar(menuId); } + if ( !item && m_windowMenu ) + item = m_windowMenu->FindItem(menuId); + return item; } @@ -683,15 +686,6 @@ void wxMDIParentFrame::OnMDICommand(wxCommandEvent& event) ::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 bool wxMDIParentFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd) -- 2.45.2