Hack for wxWidgets failure to open menu on MSW.

This commit is contained in:
Jeff Young 2019-05-17 15:35:50 +01:00
parent 38cdafd407
commit 13aa503614
2 changed files with 13 additions and 6 deletions

View File

@ -27,6 +27,18 @@
#include <tool/action_menu.h>
CONDITIONAL_MENU::CONDITIONAL_MENU( bool isContextMenu, TOOL_INTERACTIVE* aTool ) :
m_isContextMenu( isContextMenu )
{
m_tool = aTool;
// wxWidgets 3.0.4 on MSW checks for an empty menu before running the MENU_OPEN
// event. Add a dummy item to ensure that the event is dispatched. Evaluate()
// will clear the menu before evaluating all the items anyway.
Append( wxID_ANY, wxT( "dummy menu for MSW" ) );
}
ACTION_MENU* CONDITIONAL_MENU::create() const
{
CONDITIONAL_MENU* clone = new CONDITIONAL_MENU( m_isContextMenu, m_tool );

View File

@ -42,12 +42,7 @@ public:
///> Constant to indicate that we do not care about an ENTRY location in the menu.
static const int ANY_ORDER = -1;
CONDITIONAL_MENU( bool isContextMenu, TOOL_INTERACTIVE* aTool ) :
m_isContextMenu( isContextMenu )
{
m_tool = aTool;
}
CONDITIONAL_MENU( bool isContextMenu, TOOL_INTERACTIVE* aTool );
ACTION_MENU* create() const override;