|
pflib v3.9.0-rc3-11-g2537d8f
Pretty Fine HGCROC Interaction Library
|
A command in the menu. More...
Public Member Functions | |
| Line (const char *n, const char *d, SingleTargetCommand f, unsigned int category=0) | |
| define a menu line that uses a single target command | |
| Line (const char *n, const char *d, MultipleTargetCommands f, unsigned int category=0) | |
| define a menu line that uses a multiple command function | |
| Line (const char *n, const char *d, std::shared_ptr< Menu > m, unsigned int category=0) | |
| define a menu line that enters a sub menu | |
| Line (const char *n, const char *d) | |
| define an empty menu line with only a name and description | |
| bool | execute (TargetHandle p) const |
| Execute this line. | |
| bool | empty () const |
| Check if this line is an empty one. | |
| void | build () |
| build this line | |
| void | hide (unsigned int categories) |
| pass on configuration on which categories to hide | |
| const char * | name () const |
| name of this line to select it | |
| const char * | desc () const |
| short description to print with menu | |
| unsigned int | category () const |
| category int for hiding if certain categories are disabled | |
| void | print (std::ostream &s, int indent=0) const |
| More specialized printing function to make it easier to recursively printout entire menu with descriptions. | |
Private Attributes | |
| const char * | name_ |
| the name of this line | |
| const char * | desc_ |
| short description for what this line is | |
| std::shared_ptr< Menu > | sub_menu_ |
| pointer to sub menu (if it exists) | |
| SingleTargetCommand | cmd_ |
| function pointer to execute (if exists) | |
| MultipleTargetCommands | mult_cmds_ |
| function handling multiple commands to execute (if exists) | |
| unsigned int | category_ |
| category integer for disabling menu lines by groups | |
Friends | |
| std::ostream & | operator<< (std::ostream &s, const Line &l) |
| Overload output stream operator for easier printing. | |
A command in the menu.
A menu command can do one of two tasks:
There are two ways to execute a command on the target, the user can provide a function that only does one command on the target (the function signature is SingleTargetCommand) or the user can provide a function that can do multiple commands on a target (the function signature is MultipleTargetCommands) where the first argument to that function will be the name of that Line.
|
inline |
define an empty menu line with only a name and description
empty lines are used to exit menus because they will do nothing when execute is called and will leave the do-while loop in Menu::steer
|
inline |
build this line
we only need to do something if this line is a sub-menu in which we case we call build on the submenu.
|
inline |
Execute this line.
If this line is a sub-menu, we give the target to that menu's steer function. Otherwise, we execute the function that is available for this line, perferring the single target command.
| [in] | p | pointer to target |