Set popup menu invoking window in wxWindowBase and not in all ports.

Don't duplicate the code for setting (and unsetting, which was forgotten by at
least wxGTK) the popup menu invoking window in all ports but do it in the base
class PopupMenu() itself.

Also add a helper wxMenuInvokingWindowSetter class which ensures that the
invoking window will be unset in any case.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64143 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-04-26 14:19:17 +00:00
parent 6de0a414a5
commit c59aa14a6c
10 changed files with 56 additions and 61 deletions

View File

@@ -2267,7 +2267,6 @@ static void wxYieldForCommandsOnly()
bool wxWindowMSW::DoPopupMenu(wxMenu *menu, int x, int y)
{
menu->SetInvokingWindow(this);
menu->UpdateUI();
if ( x == wxDefaultCoord && y == wxDefaultCoord )
@@ -2310,8 +2309,6 @@ bool wxWindowMSW::DoPopupMenu(wxMenu *menu, int x, int y)
// for example) and so we do need to process the event immediately
wxYieldForCommandsOnly();
menu->SetInvokingWindow(NULL);
return true;
}