Return correct invoking window for submenus of a popup menu.
SetInvokingWindow() is only called for the top menu being popped up itself but the invoking window should also be associated with its submenus. Modify GetInvokingWindow() to return the parents invoking window for submenus. This fixes a crash due to returning NULL from wxMenu::GetWindow() in wxMSW owner-drawn code. And it also makes redundant some code in wxUniversal wxMenu implementation which can now simply use GetInvokingWindow() in all cases. Closes #11957. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64104 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -254,9 +254,12 @@ public:
|
||||
void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
|
||||
wxEvtHandler *GetEventHandler() const { return m_eventHandler; }
|
||||
|
||||
// invoking window
|
||||
void SetInvokingWindow(wxWindow *win) { m_invokingWindow = win; }
|
||||
wxWindow *GetInvokingWindow() const { return m_invokingWindow; }
|
||||
// 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.
|
||||
void SetInvokingWindow(wxWindow *win);
|
||||
wxWindow *GetInvokingWindow() const;
|
||||
|
||||
// style
|
||||
long GetStyle() const { return m_style; }
|
||||
|
Reference in New Issue
Block a user