Use wxMenu::GetWindow() instead of GetInvokingWindow() in SendEvent().

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
This commit is contained in:
Vadim Zeitlin 2010-04-24 15:07:55 +00:00
parent 341d8cb2cf
commit 7739f9c947

View File

@ -453,30 +453,17 @@ bool wxMenuBase::SendEvent(int id, int checked)
bool processed = false;
// Try the menu's event handler
// if ( !processed )
{
// 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
if ( !processed )
{
const wxMenuBase *menu = this;
while ( menu )
{
wxWindow *win = menu->GetInvokingWindow();
wxWindow * const win = GetWindow();
if ( win )
{
processed = win->HandleWindowEvent(event);
break;
}
menu = menu->GetParent();
}
}
return processed;