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

@@ -309,6 +309,13 @@ public:
// the checked parameter may have boolean value or -1 for uncheckable items
bool SendEvent(int itemid, int checked = -1);
// called to dispatch a wxMenuEvent to the right recipients, menu pointer
// can be NULL if we failed to find the associated menu (this happens at
// least in wxMSW for the events from the system menus)
static
bool ProcessMenuEvent(wxMenu* menu, wxMenuEvent& event, wxWindow* win);
// compatibility: these functions are deprecated, use the new ones instead
// -----------------------------------------------------------------------
@@ -390,8 +397,8 @@ protected:
private:
// Helper of SendEvent(): sends the event to its intended recipients,
// returns true if it was processed.
// Common part of SendEvent() and ProcessMenuEvent(): sends the event to
// its intended recipients, returns true if it was processed.
static bool DoProcessEvent(wxMenuBase* menu, wxEvent& event, wxWindow* win);
wxDECLARE_NO_COPY_CLASS(wxMenuBase);