nsnake
Classic snake game for the terminal
|
A little box that can be checked or not. More...
#include <MenuItemCheckbox.hpp>
Public Member Functions | |
MenuItemCheckbox (std::string label, int id, bool initial=false) | |
void | draw (Window *window, int x, int y, int width, bool hilite=false) |
Shows this item at #x, #y with #width. | |
void | handleInput () |
Makes the menu item react to input, as seen on the global InputManager. | |
void | check (bool option) |
void | toggle () |
bool | isChecked () |
![]() | |
MenuItem (std::string label, int id) | |
Create a MenuItem, with user-defined id. | |
Public Attributes | |
bool | checked |
![]() | |
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. | |
Additional Inherited Members | |
![]() | |
enum | MenuItemType { ITEM , LABEL , CHECKBOX , NUMBERBOX , TEXTBOX , TEXTLIST } |
All possible item types. More... | |
A little box that can be checked or not.
Used to get a boolean from the user.
Definition at line 9 of file MenuItemCheckbox.hpp.
MenuItemCheckbox::MenuItemCheckbox | ( | std::string | label, |
int | id, | ||
bool | initial = false ) |
Definition at line 5 of file MenuItemCheckbox.cpp.
|
inlinevirtual |
Definition at line 13 of file MenuItemCheckbox.hpp.
void MenuItemCheckbox::check | ( | bool | option | ) |
Definition at line 67 of file MenuItemCheckbox.cpp.
|
virtual |
Shows this item at #x, #y with #width.
If this is the current item, send #hilite as true.
Reimplemented from MenuItem.
Definition at line 12 of file MenuItemCheckbox.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 from MenuItem.
Definition at line 49 of file MenuItemCheckbox.cpp.
bool MenuItemCheckbox::isChecked | ( | ) |
Definition at line 75 of file MenuItemCheckbox.cpp.
void MenuItemCheckbox::toggle | ( | ) |
Definition at line 71 of file MenuItemCheckbox.cpp.
bool MenuItemCheckbox::checked |
Definition at line 23 of file MenuItemCheckbox.hpp.