Remove "isPopup" parameter from DoSendMenuOpenCloseEvent() in wxMSW.
This parameter is redundant, we can find out whether a menu is a popup one or not from the menu itself, assuming that we always have a valid wxMenu pointer for popup menus events, which really should be the case (we may not have one for the events from system menus). This allows to handle popup menu events case in the base class version of MSWFindMenuFromHMENU() which will allow to reuse it from places other than DoSendMenuOpenCloseEvent() without code duplication now. There should be no changes to the behaviour, this is just a simplification. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78227 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2288,9 +2288,9 @@ wxWindowMSW::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu)
|
||||
}
|
||||
|
||||
bool
|
||||
wxWindowMSW::DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu, bool popup)
|
||||
wxWindowMSW::DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu)
|
||||
{
|
||||
wxMenuEvent event(evtType, popup ? wxID_ANY : 0, menu);
|
||||
wxMenuEvent event(evtType, menu && !menu->IsAttached() ? wxID_ANY : 0, menu);
|
||||
event.SetEventObject(menu);
|
||||
|
||||
return HandleWindowEvent(event);
|
||||
@@ -2298,25 +2298,16 @@ wxWindowMSW::DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu, bool po
|
||||
|
||||
bool wxWindowMSW::HandleMenuPopup(wxEventType evtType, WXHMENU hMenu)
|
||||
{
|
||||
bool isPopup = false;
|
||||
wxMenu* menu = NULL;
|
||||
if ( wxCurrentPopupMenu && wxCurrentPopupMenu->GetHMenu() == hMenu )
|
||||
{
|
||||
menu = wxCurrentPopupMenu;
|
||||
isPopup = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
menu = MSWFindMenuFromHMENU(hMenu);
|
||||
}
|
||||
wxMenu* const menu = MSWFindMenuFromHMENU(hMenu);
|
||||
|
||||
|
||||
return DoSendMenuOpenCloseEvent(evtType, menu, isPopup);
|
||||
return DoSendMenuOpenCloseEvent(evtType, menu);
|
||||
}
|
||||
|
||||
wxMenu* wxWindowMSW::MSWFindMenuFromHMENU(WXHMENU WXUNUSED(hMenu))
|
||||
wxMenu* wxWindowMSW::MSWFindMenuFromHMENU(WXHMENU hMenu)
|
||||
{
|
||||
// We don't have any menus at this level.
|
||||
if ( wxCurrentPopupMenu && wxCurrentPopupMenu->GetHMenu() == hMenu )
|
||||
return wxCurrentPopupMenu;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user