KiCad PCB EDA Suite
action_menu.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2013-2019 CERN
5  * Copyright (C) 2013-2019 KiCad Developers, see AUTHORS.txt for contributors.
6  * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
7  * @author Maciej Suminski <maciej.suminski@cern.ch>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
27 #include <eda_base_frame.h>
28 #include <functional>
29 #include <id.h>
30 #include <menus_helpers.h>
31 #include <tool/action_menu.h>
32 #include <tool/actions.h>
33 #include <tool/tool_event.h>
34 #include <tool/tool_interactive.h>
35 #include <tool/tool_manager.h>
36 #include <trace_helpers.h>
37 #include <wx/log.h>
38 
39 
40 using namespace std::placeholders;
41 
42 
43 ACTION_MENU::ACTION_MENU( bool isContextMenu ) :
44  m_dirty( true ),
45  m_titleDisplayed( false ),
46  m_isContextMenu( isContextMenu ),
47  m_icon( nullptr ),
48  m_selected( -1 ),
49  m_tool( nullptr )
50 {
51  setupEvents();
52 }
53 
54 
56 {
57  // Set parent to NULL to prevent submenus from unregistering from a notexisting object
58  for( auto menu : m_submenus )
59  menu->SetParent( nullptr );
60 
61  ACTION_MENU* parent = dynamic_cast<ACTION_MENU*>( GetParent() );
62 
63  if( parent )
64  parent->m_submenus.remove( this );
65 }
66 
67 
68 void ACTION_MENU::SetIcon( const BITMAP_OPAQUE* aIcon )
69 {
70  m_icon = aIcon;
71 }
72 
73 
75 {
76 // See wxWidgets hack in EDA_BASE_FRAME::OnMenuOpen().
77 // Connect( wxEVT_MENU_OPEN, wxMenuEventHandler( ACTION_MENU::OnMenuEvent ), NULL, this );
78 // Connect( wxEVT_MENU_HIGHLIGHT, wxMenuEventHandler( ACTION_MENU::OnMenuEvent ), NULL, this );
79 // Connect( wxEVT_MENU_CLOSE, wxMenuEventHandler( ACTION_MENU::OnMenuEvent ), NULL, this );
80 
81  Connect( wxEVT_COMMAND_MENU_SELECTED, wxMenuEventHandler( ACTION_MENU::OnMenuEvent ), NULL, this );
82  Connect( wxEVT_IDLE, wxIdleEventHandler( ACTION_MENU::OnIdle ), NULL, this );
83 }
84 
85 
86 void ACTION_MENU::SetTitle( const wxString& aTitle )
87 {
88  // Unfortunately wxMenu::SetTitle() does not work very well, so this is an alternative version
89  m_title = aTitle;
90 
91  // Update the menu title
92  if( m_titleDisplayed )
93  DisplayTitle( true );
94 }
95 
96 
97 void ACTION_MENU::DisplayTitle( bool aDisplay )
98 {
99  if( ( !aDisplay || m_title.IsEmpty() ) && m_titleDisplayed )
100  {
101  // Destroy the menu entry keeping the title..
102  wxMenuItem* item = FindItemByPosition( 0 );
103  wxASSERT( item->GetItemLabelText() == GetTitle() );
104  Destroy( item );
105  // ..and separator
106  item = FindItemByPosition( 0 );
107  wxASSERT( item->IsSeparator() );
108  Destroy( item );
109  m_titleDisplayed = false;
110  }
111 
112  else if( aDisplay && !m_title.IsEmpty() )
113  {
114  if( m_titleDisplayed )
115  {
116  // Simply update the title
117  FindItemByPosition( 0 )->SetItemLabel( m_title );
118  }
119  else
120  {
121  // Add a separator and a menu entry to display the title
122  InsertSeparator( 0 );
123  Insert( 0, new wxMenuItem( this, wxID_NONE, m_title, wxEmptyString, wxITEM_NORMAL ) );
124 
125  if( m_icon )
126  AddBitmapToMenuItem( FindItemByPosition( 0 ), KiBitmap( m_icon ) );
127 
128  m_titleDisplayed = true;
129  }
130  }
131 }
132 
133 
134 wxMenuItem* ACTION_MENU::Add( const wxString& aLabel, int aId, const BITMAP_OPAQUE* aIcon )
135 {
136  wxASSERT_MSG( FindItem( aId ) == nullptr, "Duplicate menu IDs!" );
137 
138  wxMenuItem* item = new wxMenuItem( this, aId, aLabel, wxEmptyString, wxITEM_NORMAL );
139 
140  if( aIcon )
141  AddBitmapToMenuItem( item, KiBitmap( aIcon ) );
142 
143  return Append( item );
144 }
145 
146 
147 wxMenuItem* ACTION_MENU::Add( const wxString& aLabel, const wxString& aTooltip, int aId,
148  const BITMAP_OPAQUE* aIcon )
149 {
150  wxASSERT_MSG( FindItem( aId ) == nullptr, "Duplicate menu IDs!" );
151 
152  wxMenuItem* item = new wxMenuItem( this, aId, aLabel, aTooltip, wxITEM_NORMAL );
153 
154  if( aIcon )
155  AddBitmapToMenuItem( item, KiBitmap( aIcon ) );
156 
157  return Append( item );
158 }
159 
160 
161 wxMenuItem* ACTION_MENU::Add( const TOOL_ACTION& aAction, bool aIsCheckmarkEntry )
162 {
164  const BITMAP_OPAQUE* icon = aAction.GetIcon();
165 
166  wxMenuItem* item = new wxMenuItem( this, getMenuId( aAction ), aAction.GetMenuItem(),
167  aAction.GetDescription(),
168  aIsCheckmarkEntry ? wxITEM_CHECK : wxITEM_NORMAL );
169 
170  if( icon )
171  AddBitmapToMenuItem( item, KiBitmap( icon ) );
172 
173  m_toolActions[getMenuId( aAction )] = &aAction;
174 
175  return Append( item );
176 }
177 
178 
179 wxMenuItem* ACTION_MENU::Add( ACTION_MENU* aMenu )
180 {
181  ACTION_MENU* menuCopy = aMenu->Clone();
182  m_submenus.push_back( menuCopy );
183 
184  wxASSERT_MSG( !menuCopy->m_title.IsEmpty(), "Set a title for ACTION_MENU using SetTitle()" );
185 
186  if( aMenu->m_icon )
187  {
188  wxMenuItem* newItem = new wxMenuItem( this, -1, menuCopy->m_title );
189  AddBitmapToMenuItem( newItem, KiBitmap( aMenu->m_icon ) );
190  newItem->SetSubMenu( menuCopy );
191  return Append( newItem );
192  }
193  else
194  {
195  return AppendSubMenu( menuCopy, menuCopy->m_title );
196  }
197 }
198 
199 
201 {
202  m_titleDisplayed = false;
203 
204  for( int i = GetMenuItemCount() - 1; i >= 0; --i )
205  Destroy( FindItemByPosition( i ) );
206 
207  m_toolActions.clear();
208  m_submenus.clear();
209 
210  wxASSERT( GetMenuItemCount() == 0 );
211 }
212 
213 
215 {
216  bool hasEnabled = false;
217 
218  auto& items = GetMenuItems();
219 
220  for( auto item : items )
221  {
222  if( item->IsEnabled() && !item->IsSeparator() )
223  {
224  hasEnabled = true;
225  break;
226  }
227  }
228 
229  return hasEnabled;
230 }
231 
232 
234 {
235  try
236  {
237  update();
238  }
239  catch( std::exception& e )
240  {
241  wxLogDebug( wxString::Format( "ACTION_MENU update handler exception: %s", e.what() ) );
242  }
243 
244  if( m_tool )
245  updateHotKeys();
246 
247  runOnSubmenus( std::bind( &ACTION_MENU::UpdateAll, _1 ) );
248 }
249 
250 
252 {
253  m_dirty = false;
254  runOnSubmenus( std::bind( &ACTION_MENU::ClearDirty, _1 ) );
255 }
256 
257 
259 {
260  m_dirty = true;
261  runOnSubmenus( std::bind( &ACTION_MENU::SetDirty, _1 ) );
262 }
263 
264 
266 {
267  m_tool = aTool;
268  runOnSubmenus( std::bind( &ACTION_MENU::SetTool, _1, aTool ) );
269 }
270 
271 
273 {
274  ACTION_MENU* clone = create();
275  clone->Clear();
276  clone->copyFrom( *this );
277  return clone;
278 }
279 
280 
282 {
283  ACTION_MENU* menu = new ACTION_MENU( false );
284 
285  wxASSERT_MSG( typeid( *this ) == typeid( *menu ),
286  wxString::Format( "You need to override create() method for class %s", typeid(*this).name() ) );
287 
288  return menu;
289 }
290 
291 
293 {
294  wxASSERT( m_tool );
295  return m_tool ? m_tool->GetManager() : nullptr;
296 }
297 
298 
300 {
301  TOOL_MANAGER* toolMgr = getToolManager();
302 
303  for( auto& ii : m_toolActions )
304  {
305  int id = ii.first;
306  const TOOL_ACTION& action = *ii.second;
307  int key = toolMgr->GetHotKey( action ) & ~MD_MODIFIER_MASK;
308 
309  if( key )
310  {
311  int mod = toolMgr->GetHotKey( action ) & MD_MODIFIER_MASK;
312  int flags = 0;
313  wxMenuItem* item = FindChildItem( id );
314 
315  if( item )
316  {
317  flags |= ( mod & MD_ALT ) ? wxACCEL_ALT : 0;
318  flags |= ( mod & MD_CTRL ) ? wxACCEL_CTRL : 0;
319  flags |= ( mod & MD_SHIFT ) ? wxACCEL_SHIFT : 0;
320 
321  if( !flags )
322  flags = wxACCEL_NORMAL;
323 
324  wxAcceleratorEntry accel( flags, key, id, item );
325  item->SetAccel( &accel );
326  }
327  }
328  }
329 }
330 
331 
332 // wxWidgets doesn't tell us when a menu command was generated from a hotkey or from
333 // a menu selection. It's important to us because a hotkey can be an immediate action
334 // while the menu selection can not (as it has no associated position).
335 //
336 // We get around this by storing the last highlighted menuId. If it matches the command
337 // id then we know this is a menu selection. (You might think we could use the menuOpen
338 // menuClose events, but these are actually generated for hotkeys as well.)
339 
341 
342 // We need to store the position of the mouse when the menu was opened so it can be passed
343 // to the command event generated when the menu item is selected.
345 
346 
347 void ACTION_MENU::OnIdle( wxIdleEvent& event )
348 {
350  g_menu_open_position.x = 0.0;
351  g_menu_open_position.y = 0.0;
352 }
353 
354 
355 void ACTION_MENU::OnMenuEvent( wxMenuEvent& aEvent )
356 {
357  OPT_TOOL_EVENT evt;
358  wxString menuText;
359  wxEventType type = aEvent.GetEventType();
360 
361  if( type == wxEVT_MENU_OPEN )
362  {
363  if( m_dirty && m_tool )
364  getToolManager()->RunAction( ACTIONS::updateMenu, true, this );
365 
366  wxMenu* parent = dynamic_cast<wxMenu*>( GetParent() );
367 
368  // Don't update the position if this menu has a parent
369  if( !parent && m_tool )
371 
373  }
374  else if( type == wxEVT_MENU_HIGHLIGHT )
375  {
376  if( aEvent.GetId() > 0 )
377  g_last_menu_highlighted_id = aEvent.GetId();
378 
379  evt = TOOL_EVENT( TC_COMMAND, TA_CHOICE_MENU_UPDATE, aEvent.GetId() );
380  }
381  else if( type == wxEVT_COMMAND_MENU_SELECTED )
382  {
383  // Store the selected position, so it can be checked by the tools
384  m_selected = aEvent.GetId();
385 
386  ACTION_MENU* parent = dynamic_cast<ACTION_MENU*>( GetParent() );
387 
388  while( parent )
389  {
390  parent->m_selected = m_selected;
391  parent = dynamic_cast<ACTION_MENU*>( parent->GetParent() );
392  }
393 
394  // Check if there is a TOOL_ACTION for the given ID
395  if( m_selected >= ACTION_ID )
396  evt = findToolAction( m_selected );
397 
398  if( !evt )
399  {
400 #ifdef __WINDOWS__
401  if( !evt )
402  {
403  // Try to find the submenu which holds the selected item
404  wxMenu* menu = nullptr;
405  FindItem( m_selected, &menu );
406 
407  // This conditional compilation is probably not needed.
408  // It will be removed later, for the Kicad V 6.x version.
409  // But in "old" 3.0 version, the "&& menu != this" contition was added to avoid hang
410  // This hang is no longer encountered in wxWidgets 3.0.4 version, and this condition is no longer needed.
411  // And in 3.1.2, we have to remove it, as "menu != this" never happens
412  // ("menu != this" always happens in 3.1.1 and older!).
413  #if wxCHECK_VERSION(3, 1, 2)
414  if( menu )
415  #else
416  if( menu && menu != this )
417  #endif
418  {
419  ACTION_MENU* cxmenu = static_cast<ACTION_MENU*>( menu );
420  evt = cxmenu->eventHandler( aEvent );
421  }
422  }
423 #else
424  if( !evt )
425  runEventHandlers( aEvent, evt );
426 #endif
427 
428  // Handling non-action menu entries (e.g. items in clarification list)
429  // in some context menus, that have IDs explicitly chosen between
430  // ID_POPUP_MENU_START and ID_POPUP_MENU_END
431  // Note also items in clarification list have an id >= 0 and < wxID_LOWEST
432  // in fact 0 to n-1 for n items in clarification list)
433  // id < 0 are automatically created for menuitems created with wxID_ANY
434  #define ID_CONTEXT_MENU_ID_MAX wxID_LOWEST /* = 100 should be enough and better */
435 
436  if( !evt &&
437  ( ( m_selected >= 0 && m_selected < ID_CONTEXT_MENU_ID_MAX ) ||
439  {
440  menuText = GetLabelText( aEvent.GetId() );
442  &menuText );
443  }
444  }
445  }
446 
447  // forward the action/update event to the TOOL_MANAGER
448  // clients that don't supply a tool will have to check GetSelected() themselves
449  if( evt && m_tool )
450  {
451 
452  wxLogTrace( kicadTraceToolStack, "ACTION_MENU::OnMenuEvent %s", evt->Format() );
453 
454  TOOL_MANAGER* toolMgr = m_tool->GetManager();
455 
456  // Pass the position the menu was opened from into the generated event if it is a select event
457  if( type == wxEVT_COMMAND_MENU_SELECTED )
458  evt->SetMousePosition( g_menu_open_position );
459  else
460  evt->SetMousePosition( getToolManager()->GetMousePosition() );
461 
462  if( g_last_menu_highlighted_id == aEvent.GetId() && !m_isContextMenu )
463  evt->SetHasPosition( false );
464 
465  if( toolMgr->GetEditFrame() && !toolMgr->GetEditFrame()->GetDoImmediateActions() )
466  {
467  // An tool-selection-event has no position
468  if( evt->GetCommandStr().is_initialized()
469  && evt->GetCommandStr().get() != toolMgr->GetEditFrame()->CurrentToolName() )
470  {
471  evt->SetHasPosition( false );
472  }
473  }
474 
475  if( m_tool->GetManager() )
476  m_tool->GetManager()->ProcessEvent( *evt );
477  }
478  else
479  {
480  aEvent.Skip();
481  }
482 }
483 
484 
485 void ACTION_MENU::runEventHandlers( const wxMenuEvent& aMenuEvent, OPT_TOOL_EVENT& aToolEvent )
486 {
487  aToolEvent = eventHandler( aMenuEvent );
488 
489  if( !aToolEvent )
490  runOnSubmenus( std::bind( &ACTION_MENU::runEventHandlers, _1, aMenuEvent, aToolEvent ) );
491 }
492 
493 
494 void ACTION_MENU::runOnSubmenus( std::function<void(ACTION_MENU*)> aFunction )
495 {
496  try
497  {
498  std::for_each( m_submenus.begin(), m_submenus.end(), [&]( ACTION_MENU* m ) {
499  aFunction( m );
500  m->runOnSubmenus( aFunction );
501  } );
502  }
503  catch( std::exception& e )
504  {
505  wxLogDebug( wxString::Format( "ACTION_MENU runOnSubmenus exception: %s", e.what() ) );
506  }
507 }
508 
509 
511 {
512  OPT_TOOL_EVENT evt;
513 
514  auto findFunc = [&]( ACTION_MENU* m ) {
515  if( evt )
516  return;
517 
518  const auto it = m->m_toolActions.find( aId );
519 
520  if( it != m->m_toolActions.end() )
521  evt = it->second->MakeEvent();
522  };
523 
524  findFunc( this );
525 
526  if( !evt )
527  runOnSubmenus( findFunc );
528 
529  return evt;
530 }
531 
532 
533 void ACTION_MENU::copyFrom( const ACTION_MENU& aMenu )
534 {
535  m_icon = aMenu.m_icon;
536  m_title = aMenu.m_title;
538  m_selected = -1; // aMenu.m_selected;
539  m_tool = aMenu.m_tool;
541 
542  // Copy all menu entries
543  for( int i = 0; i < (int) aMenu.GetMenuItemCount(); ++i )
544  {
545  wxMenuItem* item = aMenu.FindItemByPosition( i );
546  appendCopy( item );
547  }
548 }
549 
550 
551 wxMenuItem* ACTION_MENU::appendCopy( const wxMenuItem* aSource )
552 {
553  wxMenuItem* newItem = new wxMenuItem( this, aSource->GetId(), aSource->GetItemLabel(),
554  aSource->GetHelp(), aSource->GetKind() );
555 
556  // Add the source bitmap if it is not the wxNullBitmap
557  // On Windows, for Checkable Menu items, adding a null bitmap adds also
558  // our predefined checked alternate bitmap
559  const wxBitmap& src_bitmap = aSource->GetBitmap();
560 
561  if( src_bitmap.IsOk() && src_bitmap.GetHeight() > 1 ) // a null bitmap has a 0 size
562  AddBitmapToMenuItem( newItem, src_bitmap );
563 
564  if( aSource->IsSubMenu() )
565  {
566  ACTION_MENU* menu = dynamic_cast<ACTION_MENU*>( aSource->GetSubMenu() );
567  wxASSERT_MSG( menu, "Submenus are expected to be a ACTION_MENU" );
568 
569  if( menu )
570  {
571  ACTION_MENU* menuCopy = menu->Clone();
572  newItem->SetSubMenu( menuCopy );
573  m_submenus.push_back( menuCopy );
574  }
575  }
576 
577  // wxMenuItem has to be added before enabling/disabling or checking
578  Append( newItem );
579 
580  if( aSource->IsCheckable() )
581  newItem->Check( aSource->IsChecked() );
582 
583  newItem->Enable( aSource->IsEnabled() );
584 
585  return newItem;
586 }
wxMenuItem * Add(const wxString &aLabel, int aId, const BITMAP_OPAQUE *aIcon)
Function Add() Adds a wxWidgets-style entry to the menu.
virtual void update()
Update menu state stub.
Definition: action_menu.h:170
bool m_titleDisplayed
Definition: action_menu.h:214
OPT_TOOL_EVENT findToolAction(int aId)
Checks if any of submenus contains a TOOL_ACTION with a specific ID.
int GetHotKey(const TOOL_ACTION &aAction)
static int g_last_menu_highlighted_id
static int getMenuId(const TOOL_ACTION &aAction)
Returns the corresponding wxMenuItem identifier for a TOOL_ACTION object.
Definition: action_menu.h:161
Class ACTION_MENU.
Definition: action_menu.h:43
const BITMAP_OPAQUE * m_icon
Optional icon
Definition: action_menu.h:221
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
void runEventHandlers(const wxMenuEvent &aMenuEvent, OPT_TOOL_EVENT &aToolEvent)
Traverses the submenus tree looking for a submenu capable of handling a particular menu event.
void ClearDirty()
Function ClearDirty() Clears the dirty flag on the menu and all descendants.
void UpdateAll()
Function UpdateAll() Runs update handlers for the menu and its submenus.
virtual ACTION_MENU * create() const
Returns an instance of this class. It has to be overridden in inheriting classes.
const BITMAP_OPAQUE * GetIcon() const
Returns an icon associated with the action.
Definition: tool_action.h:149
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
TOOL_MANAGER * GetManager() const
Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.
Definition: tool_base.h:143
virtual OPT_TOOL_EVENT eventHandler(const wxMenuEvent &)
Event handler stub.
Definition: action_menu.h:178
wxString GetDescription() const
Definition: tool_action.cpp:83
Class TOOL_MANAGER.
Definition: tool_manager.h:50
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
#define ID_CONTEXT_MENU_ID_MAX
void copyFrom(const ACTION_MENU &aMenu)
Copies another menus data to this instance.
void AddBitmapToMenuItem(wxMenuItem *aMenu, const wxBitmap &aImage)
Add a bitmap to a menuitem.
Definition: bitmap.cpp:223
bool m_isContextMenu
Definition: action_menu.h:215
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
wxString m_title
Menu title
Definition: action_menu.h:218
std::list< ACTION_MENU * > m_submenus
List of submenus.
Definition: action_menu.h:236
void SetIcon(const BITMAP_OPAQUE *aIcon)
Function SetIcon() Assigns an icon for the entry.
Definition: action_menu.cpp:68
Class TOOL_EVENT.
Definition: tool_event.h:171
static VECTOR2D g_menu_open_position
Base window classes and related definitions.
int m_selected
Stores the id number of selected item.
Definition: action_menu.h:224
wxLogTrace helper definitions.
ACTION_MENU * Clone() const
Creates a deep, recursive copy of this ACTION_MENU.
static const int ACTION_ID
Menu items with ID higher than that are considered TOOL_ACTIONs
Definition: action_menu.h:230
static TOOL_ACTION updateMenu
Definition: actions.h:158
All active tools
Definition: tool_event.h:147
TOOL_INTERACTIVE * m_tool
Creator of the menu
Definition: action_menu.h:227
wxMenuItem * appendCopy(const wxMenuItem *aSource)
Function appendCopy Appends a copy of wxMenuItem.
void runOnSubmenus(std::function< void(ACTION_MENU *)> aFunction)
Runs a function on the menu and all its submenus.
std::map< int, const TOOL_ACTION * > m_toolActions
Associates tool actions with menu item IDs. Non-owning.
Definition: action_menu.h:233
void OnMenuEvent(wxMenuEvent &aEvent)
void SetTitle(const wxString &aTitle) override
Function SetTitle() Sets title for the menu.
Definition: action_menu.cpp:86
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
TOOL_MANAGER * getToolManager() const
Returns an instance of TOOL_MANAGER class.
Class TOOL_ACTION.
Definition: tool_action.h:46
size_t i
Definition: json11.cpp:649
void setupEvents()
Initializes handlers for events.
Definition: action_menu.cpp:74
void Clear()
Function Clear() Removes all the entries from the menu (as well as its title).
const wxChar *const kicadTraceToolStack
Flag to enable tracing of the tool handling stack.
bool HasEnabledItems() const
Function HasEnabledItems();.
void OnIdle(wxIdleEvent &event)
ACTION_MENU(bool isContextMenu)
Default constructor
Definition: action_menu.cpp:43
VECTOR2D GetMousePosition()
void updateHotKeys()
Updates hot key settings for TOOL_ACTIONs in this menu.
wxString GetMenuItem() const
Definition: tool_action.cpp:75
~ACTION_MENU() override
Definition: action_menu.cpp:55
void SetDirty()
#define mod(a, n)
Definition: greymap.cpp:24
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:556
void DisplayTitle(bool aDisplay=true)
Function DisplayTitle() Decides whether a title for a pop up menu should be displayed.
Definition: action_menu.cpp:97