This simplifies the code as we don't need to walk the menu hierarchy upwards
any more (GetInvokingWindow() does it now) and also makes it work for all
menus, not just the popup ones.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64126
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
- // Try the menu's event handler
- // if ( !processed )
- {
- wxEvtHandler *handler = GetEventHandler();
- if ( handler )
- processed = handler->SafelyProcessEvent(event);
- }
+ // Try the menu's event handler first
+ wxEvtHandler *handler = GetEventHandler();
+ if ( handler )
+ processed = handler->SafelyProcessEvent(event);
- // Try the window the menu was popped up from (and up through the
- // hierarchy)
+ // Try the window the menu was popped up from or its menu bar belongs to
- const wxMenuBase *menu = this;
- while ( menu )
- {
- wxWindow *win = menu->GetInvokingWindow();
- if ( win )
- {
- processed = win->HandleWindowEvent(event);
- break;
- }
-
- menu = menu->GetParent();
- }
+ wxWindow * const win = GetWindow();
+ if ( win )
+ processed = win->HandleWindowEvent(event);