Harmonize wxMenuEvent handling between all major ports.

Send these events to the menu itself first, then to the menu bar containing
it or the window invoking it if it's a popup menu and, finally, to the top
level window in all of wxGTK, wxMSW and wxOSX.

In particular, this ensures that help strings are now shown in the parent MDI
frame status bar by default, even when the menus are attached to the client
MDI frame or shown as popup menus.

At the implementation level, this logic is now encapsulated in a new static
wxMenu::ProcessMenuEvent() method which can be easily modified and reused in
other ports.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78230 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-12-05 22:17:58 +00:00
parent 62763ad541
commit 2d20e3fc51
7 changed files with 79 additions and 53 deletions

View File

@@ -2269,9 +2269,7 @@ wxWindowMSW::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu)
item = wxID_NONE;
wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item);
event.SetEventObject(this);
if ( HandleWindowEvent(event) )
if ( wxMenu::ProcessMenuEvent(MSWFindMenuFromHMENU(hMenu), event, this) )
return true;
// by default, i.e. if the event wasn't handled above, clear the status bar
@@ -2291,9 +2289,8 @@ bool
wxWindowMSW::DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu)
{
wxMenuEvent event(evtType, menu && !menu->IsAttached() ? wxID_ANY : 0, menu);
event.SetEventObject(menu);
return HandleWindowEvent(event);
return wxMenu::ProcessMenuEvent(menu, event, this);
}
bool wxWindowMSW::HandleMenuPopup(wxEventType evtType, WXHMENU hMenu)