wex  v21.04.0
Public Types | Public Member Functions | List of all members
wex::menu_command Class Reference

This class contains a single menu command. More...

#include <wex/menu-command.h>

Inheritance diagram for wex::menu_command:
Inheritance graph
[legend]

Public Types

enum  include { INCLUDE_SUBCOMMAND = 0 , INCLUDE_ACCELL = 1 }
 The command flags as used by get_command. More...
 
enum  {
  IS_POPUP = 0 , IS_MAIN , IS_SELECTED , IS_VISUAL ,
  SEPARATOR , ELLIPSES
}
 The command type flags as read from xml file. More...
 

Public Member Functions

 menu_command (const pugi::xml_node &node=pugi::xml_node())
 Default constructor using xml node.
 
bool ask_flags () const
 Returns true if flags are requested for this command. More...
 
const auto & control () const
 Returns the control key.
 
const auto & flags () const
 Returns the flags.
 
const std::string get_command (include_t type=include_t().set(INCLUDE_SUBCOMMAND)) const
 Returns the command (and subcommand and accelerators if necessary).
 
const auto & submenu () const
 Returns the submenu.
 
bool is_help () const
 Returns true if this is a help like command.
 
auto & type () const
 Returns the type.
 
const auto & text () const
 Returns the menu text.
 
bool use_subcommand () const
 Returns true if a subcommand can be used for this command.
 

Detailed Description

This class contains a single menu command.

The menu command is meant to be used as command as e.g. vcs or debug command directly.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

The command type flags as read from xml file.

Enumerator
IS_POPUP 

command in popup menu

IS_MAIN 

command in main menu

IS_SELECTED 

command only shown if text selected

IS_VISUAL 

command only shown if visual mode

SEPARATOR 

command is followed by a separator

ELLIPSES 

command is followed by an ellipses

◆ include

The command flags as used by get_command.

Enumerator
INCLUDE_SUBCOMMAND 

includes a possible subcommand

INCLUDE_ACCELL 

includes accelerator

Member Function Documentation

◆ ask_flags()

bool wex::menu_command::ask_flags ( ) const
inline

Returns true if flags are requested for this command.

All commands, except help, and if the flags are present in menus.xml, support flags.