Revert "Avoid generating wxEVT_MENU_OPEN and CLOSE for disabled menus in wxMSW."
The check for top level menus being disabled added in r77657 is broken as it's used, with the expectedly bad consequences, for non top level menus as well, as can be seen by opening any submenu, so revert it. See #2168. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77704 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -987,47 +987,6 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara
|
||||
}
|
||||
break;
|
||||
#endif // !__WXMICROWIN__
|
||||
|
||||
#if wxUSE_MENUS
|
||||
case WM_INITMENUPOPUP:
|
||||
{
|
||||
wxMenuBar* const bar = GetMenuBar();
|
||||
if ( bar && !bar->IsEnabledTop(LOWORD(lParam)) )
|
||||
{
|
||||
// Skip sending of wxEVT_MENU_OPEN in the base class
|
||||
// MSWWindowProc() for disabled top level menus.
|
||||
return MSWDefWindowProc(message, wParam, lParam);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_UNINITMENUPOPUP:
|
||||
{
|
||||
wxMenuBar* const bar = GetMenuBar();
|
||||
if ( !bar )
|
||||
break;
|
||||
|
||||
// Unlike in WM_INITMENUPOPUP above, we don't have the position
|
||||
// of the menu in the message itself, so find it ourselves.
|
||||
const HMENU hmenu = (HMENU)wParam;
|
||||
|
||||
const size_t count = bar->GetMenuCount();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
wxMenu* const menu = bar->GetMenu(n);
|
||||
if ( GetHmenuOf(menu) == hmenu )
|
||||
{
|
||||
if ( !bar->IsEnabledTop(n) )
|
||||
{
|
||||
// If we skipped sending wxEVT_MENU_OPEN, don't
|
||||
// send wxEVT_MENU_CLOSE neither.
|
||||
return MSWDefWindowProc(message, wParam, lParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif // wxUSE_MENUS
|
||||
}
|
||||
#if wxUSE_TASKBARBUTTON
|
||||
if ( message == wxMsgTaskbarButtonCreated )
|
||||
|
Reference in New Issue
Block a user