nsnake
Classic snake game for the terminal
|
Simplest type of item possible, with a label and user-defined id. More...
#include <MenuItem.hpp>
Public Types | |
enum | MenuItemType { ITEM , LABEL , CHECKBOX , NUMBERBOX , TEXTBOX , TEXTLIST } |
All possible item types. More... | |
Public Member Functions | |
MenuItem (std::string label, int id) | |
Create a MenuItem, with user-defined id. | |
virtual void | draw (Window *window, int x, int y, int width, bool hilite=false) |
Shows this item at #x, #y with #width. | |
virtual void | handleInput () |
Makes the menu item react to input, as seen on the global InputManager. | |
Public Attributes | |
MenuItemType | type |
Specific type of this widget. | |
std::string | label |
Text that will be shown on the screen. | |
int | id |
User-defined id to identify this item. | |
Simplest type of item possible, with a label and user-defined id.
Definition at line 11 of file MenuItem.hpp.
All possible item types.
When inheriting and creating your own, make sure to place it here.
Definition at line 17 of file MenuItem.hpp.
MenuItem::MenuItem | ( | std::string | label, |
int | id ) |
Create a MenuItem, with user-defined id.
Definition at line 6 of file MenuItem.cpp.
|
inlinevirtual |
Definition at line 28 of file MenuItem.hpp.
|
virtual |
Shows this item at #x, #y with #width.
If this is the current item, send #hilite as true.
Reimplemented in MenuItemCheckbox, MenuItemLabel, MenuItemNumberbox, MenuItemTextbox, and MenuItemTextlist.
Definition at line 12 of file MenuItem.cpp.
|
virtual |
Makes the menu item react to input, as seen on the global InputManager.
Each type of MenuItem might react to input differently. A text box might want to show printable characters, a check box might want to check if space bar was pressed, whatever.
When inheriting this, make sure to implement it.
Reimplemented in MenuItemCheckbox, MenuItemLabel, MenuItemNumberbox, MenuItemTextbox, and MenuItemTextlist.
Definition at line 19 of file MenuItem.cpp.
int MenuItem::id |
User-defined id to identify this item.
Definition at line 57 of file MenuItem.hpp.
std::string MenuItem::label |
Text that will be shown on the screen.
Definition at line 54 of file MenuItem.hpp.
MenuItemType MenuItem::type |
Specific type of this widget.
Definition at line 51 of file MenuItem.hpp.