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 
343 void ACTION_MENU::OnIdle( wxIdleEvent& event )
344 {
346 }
347 
348 
349 void ACTION_MENU::OnMenuEvent( wxMenuEvent& aEvent )
350 {
351  OPT_TOOL_EVENT evt;
352  wxString menuText;
353  wxEventType type = aEvent.GetEventType();
354 
355  if( type == wxEVT_MENU_OPEN )
356  {
357  if( m_dirty && m_tool )
358  getToolManager()->RunAction( ACTIONS::updateMenu, true, this );
359 
361  }
362  else if( type == wxEVT_MENU_HIGHLIGHT )
363  {
364  if( aEvent.GetId() > 0 )
365  g_last_menu_highlighted_id = aEvent.GetId();
366 
367  evt = TOOL_EVENT( TC_COMMAND, TA_CHOICE_MENU_UPDATE, aEvent.GetId() );
368  }
369  else if( type == wxEVT_COMMAND_MENU_SELECTED )
370  {
371  // Store the selected position, so it can be checked by the tools
372  m_selected = aEvent.GetId();
373 
374  ACTION_MENU* parent = dynamic_cast<ACTION_MENU*>( GetParent() );
375 
376  while( parent )
377  {
378  parent->m_selected = m_selected;
379  parent = dynamic_cast<ACTION_MENU*>( parent->GetParent() );
380  }
381 
382  // Check if there is a TOOL_ACTION for the given ID
383  if( m_selected >= ACTION_ID )
384  evt = findToolAction( m_selected );
385 
386  if( !evt )
387  {
388 #ifdef __WINDOWS__
389  if( !evt )
390  {
391  // Try to find the submenu which holds the selected item
392  wxMenu* menu = nullptr;
393  FindItem( m_selected, &menu );
394 
395  // This conditional compilation is probably not needed.
396  // It will be removed later, for the Kicad V 6.x version.
397  // But in "old" 3.0 version, the "&& menu != this" contition was added to avoid hang
398  // This hang is no longer encountered in wxWidgets 3.0.4 version, and this condition is no longer needed.
399  // And in 3.1.2, we have to remove it, as "menu != this" never happens
400  // ("menu != this" always happens in 3.1.1 and older!).
401  #if wxCHECK_VERSION(3, 1, 2)
402  if( menu )
403  #else
404  if( menu && menu != this )
405  #endif
406  {
407  ACTION_MENU* cxmenu = static_cast<ACTION_MENU*>( menu );
408  evt = cxmenu->eventHandler( aEvent );
409  }
410  }
411 #else
412  if( !evt )
413  runEventHandlers( aEvent, evt );
414 #endif
415 
416  // Handling non-action menu entries (e.g. items in clarification list)
417  // in some context menus, that have IDs explicitly chosen between
418  // ID_POPUP_MENU_START and ID_POPUP_MENU_END
419  // Note also items in clarification list have an id >= 0 and < wxID_LOWEST
420  // in fact 0 to n-1 for n items in clarification list)
421  // id < 0 are automatically created for menuitems created with wxID_ANY
422  #define ID_CONTEXT_MENU_ID_MAX wxID_LOWEST /* = 100 should be enough and better */
423 
424  if( !evt &&
425  ( ( m_selected >= 0 && m_selected < ID_CONTEXT_MENU_ID_MAX ) ||
427  {
428  menuText = GetLabelText( aEvent.GetId() );
430  &menuText );
431  }
432  }
433  }
434 
435  // forward the action/update event to the TOOL_MANAGER
436  // clients that don't supply a tool will have to check GetSelected() themselves
437  if( evt && m_tool )
438  {
439 
440  wxLogTrace( kicadTraceToolStack, "ACTION_MENU::OnMenuEvent %s", evt->Format() );
441 
442  TOOL_MANAGER* toolMgr = m_tool->GetManager();
443 
444  if( g_last_menu_highlighted_id == aEvent.GetId() && !m_isContextMenu )
445  evt->SetHasPosition( false );
446 
447  if( toolMgr->GetEditFrame() && !toolMgr->GetEditFrame()->GetDoImmediateActions() )
448  {
449  // An tool-selection-event has no position
450  if( evt->GetCommandStr().is_initialized()
451  && evt->GetCommandStr().get() != toolMgr->GetEditFrame()->CurrentToolName() )
452  {
453  evt->SetHasPosition( false );
454  }
455  }
456 
457  if( m_tool->GetManager() )
458  m_tool->GetManager()->ProcessEvent( *evt );
459  }
460  else
461  {
462  aEvent.Skip();
463  }
464 }
465 
466 
467 void ACTION_MENU::runEventHandlers( const wxMenuEvent& aMenuEvent, OPT_TOOL_EVENT& aToolEvent )
468 {
469  aToolEvent = eventHandler( aMenuEvent );
470 
471  if( !aToolEvent )
472  runOnSubmenus( std::bind( &ACTION_MENU::runEventHandlers, _1, aMenuEvent, aToolEvent ) );
473 }
474 
475 
476 void ACTION_MENU::runOnSubmenus( std::function<void(ACTION_MENU*)> aFunction )
477 {
478  try
479  {
480  std::for_each( m_submenus.begin(), m_submenus.end(), [&]( ACTION_MENU* m ) {
481  aFunction( m );
482  m->runOnSubmenus( aFunction );
483  } );
484  }
485  catch( std::exception& e )
486  {
487  wxLogDebug( wxString::Format( "ACTION_MENU runOnSubmenus exception: %s", e.what() ) );
488  }
489 }
490 
491 
493 {
494  OPT_TOOL_EVENT evt;
495 
496  auto findFunc = [&]( ACTION_MENU* m ) {
497  if( evt )
498  return;
499 
500  const auto it = m->m_toolActions.find( aId );
501 
502  if( it != m->m_toolActions.end() )
503  evt = it->second->MakeEvent();
504  };
505 
506  findFunc( this );
507 
508  if( !evt )
509  runOnSubmenus( findFunc );
510 
511  return evt;
512 }
513 
514 
515 void ACTION_MENU::copyFrom( const ACTION_MENU& aMenu )
516 {
517  m_icon = aMenu.m_icon;
518  m_title = aMenu.m_title;
520  m_selected = -1; // aMenu.m_selected;
521  m_tool = aMenu.m_tool;
523 
524  // Copy all menu entries
525  for( int i = 0; i < (int) aMenu.GetMenuItemCount(); ++i )
526  {
527  wxMenuItem* item = aMenu.FindItemByPosition( i );
528  appendCopy( item );
529  }
530 }
531 
532 
533 wxMenuItem* ACTION_MENU::appendCopy( const wxMenuItem* aSource )
534 {
535  wxMenuItem* newItem = new wxMenuItem( this, aSource->GetId(), aSource->GetItemLabel(),
536  aSource->GetHelp(), aSource->GetKind() );
537 
538  // Add the source bitmap if it is not the wxNullBitmap
539  // On Windows, for Checkable Menu items, adding a null bitmap adds also
540  // our predefined checked alternate bitmap
541  const wxBitmap& src_bitmap = aSource->GetBitmap();
542 
543  if( src_bitmap.IsOk() && src_bitmap.GetHeight() > 1 ) // a null bitmap has a 0 size
544  AddBitmapToMenuItem( newItem, src_bitmap );
545 
546  if( aSource->IsSubMenu() )
547  {
548  ACTION_MENU* menu = dynamic_cast<ACTION_MENU*>( aSource->GetSubMenu() );
549  wxASSERT_MSG( menu, "Submenus are expected to be a ACTION_MENU" );
550 
551  if( menu )
552  {
553  ACTION_MENU* menuCopy = menu->Clone();
554  newItem->SetSubMenu( menuCopy );
555  m_submenus.push_back( menuCopy );
556  }
557  }
558 
559  // wxMenuItem has to be added before enabling/disabling or checking
560  Append( newItem );
561 
562  if( aSource->IsCheckable() )
563  newItem->Check( aSource->IsChecked() );
564 
565  newItem->Enable( aSource->IsEnabled() );
566 
567  return newItem;
568 }
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:168
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:144
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:597
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
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:548
void DisplayTitle(bool aDisplay=true)
Function DisplayTitle() Decides whether a title for a pop up menu should be displayed.
Definition: action_menu.cpp:97