Recurse upwards the menu hierarchy in wxMenu::GetWindow().

Only the top level menus have non-NULL wxMenuBar pointer too, so recurse
upwards the menu hierarchy in GetWindow() and not (just) GetInvokingWindow().

This fixes event processing for submenus broken by the recent changes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64135 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-04-24 20:39:39 +00:00
parent 51fe41000c
commit 394cfde3cf
2 changed files with 9 additions and 14 deletions

View File

@@ -256,11 +256,11 @@ public:
wxEvtHandler *GetEventHandler() const { return m_eventHandler; }
// Invoking window: this is set by wxWindow::PopupMenu() before showing a
// popup menu and reset after it's hidden. Notice that GetInvokingWindow()
// recurses upwards and will return the invoking window for any submenu of
// a popup menu as well as the menu itself.
// popup menu and reset after it's hidden. Notice that you probably want to
// use GetWindow() below instead of GetInvokingWindow() as the latter only
// returns non-NULL for the top level menus
void SetInvokingWindow(wxWindow *win);
wxWindow *GetInvokingWindow() const;
wxWindow *GetInvokingWindow() const { return m_invokingWindow; }
// the window associated with this menu: this is the invoking window for
// popup menus or the top level window to which the menu bar is attached