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

@@ -4107,8 +4107,24 @@ public:
these do not include menu command events, which are
handled using wxCommandEvent objects.
The default handler for @c wxEVT_MENU_HIGHLIGHT displays help
text in the first field of the status bar.
Events of this class are generated by both menus that are part of a
wxMenuBar, attached to wxFrame, and popup menus shown by
wxWindow::PopupMenu(). They are sent to the following objects until one of
them handles the event:
-# The menu object itself, as returned by GetMenu(), if any.
-# The wxMenuBar to which this menu is attached, if any.
-# The window associated with the menu, e.g. the one calling
PopupMenu() for the popup menus.
-# The top level parent of that window if it's different from the
window itself.
This is similar to command events generated by the menu items, but, unlike
them, wxMenuEvent are only sent to the window itself and its top level
parent but not any intermediate windows in the hierarchy.
The default handler for @c wxEVT_MENU_HIGHLIGHT in wxFrame displays help
text in the status bar, see wxFrame::SetStatusBarPane().
@beginEventTable{wxMenuEvent}
@event{EVT_MENU_OPEN(func)}