Browse Source

Hack for wxWidgets failure to open menu on MSW.

pull/15/head
Jeff Young 7 years ago
parent
commit
13aa503614
  1. 12
      common/tool/conditional_menu.cpp
  2. 7
      include/tool/conditional_menu.h

12
common/tool/conditional_menu.cpp

@ -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 );

7
include/tool/conditional_menu.h

@ -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;

Loading…
Cancel
Save