|
nsnake
Classic snake game for the terminal
|
Allows to select a number, kinda like a slider. More...
#include <MenuItemNumberbox.hpp>


Public Member Functions | |
| MenuItemNumberbox (std::string label, int id, int min, int max, int initial, int jump=1) | |
| Create a new number box. | |
| 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 | increase () |
| void | decrease () |
| void | set (int value) |
| void | reset () |
| Public Member Functions inherited from MenuItem | |
| MenuItem (std::string label, int id) | |
| Create a MenuItem, with user-defined id. | |
Public Attributes | |
| int | min |
| int | max |
| int | initial |
| int | current |
| int | jump |
| Public Attributes inherited from MenuItem | |
| 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 | |
| Public Types inherited from MenuItem | |
| enum | MenuItemType { ITEM , LABEL , CHECKBOX , NUMBERBOX , TEXTBOX , TEXTLIST } |
| All possible item types. More... | |
Allows to select a number, kinda like a slider.
There's a number and by pressing left and right you add or remove units of it.
Definition at line 17 of file MenuItemNumberbox.hpp.
| MenuItemNumberbox::MenuItemNumberbox | ( | std::string | label, |
| int | id, | ||
| int | min, | ||
| int | max, | ||
| int | initial, | ||
| int | jump = 1 ) |
Create a new number box.
| label | Textual label on the left of the item |
| id | Unique identifier so the menu can know which item this is |
| min | Minimal allowed value for the number |
| max | Maximum allowed value for the number |
| initial | Initial value for the number |
| jump | How many units will the number jump when user press left or right |
Definition at line 7 of file MenuItemNumberbox.cpp.
|
inlinevirtual |
Definition at line 29 of file MenuItemNumberbox.hpp.
| void MenuItemNumberbox::decrease | ( | ) |
Definition at line 144 of file MenuItemNumberbox.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 17 of file MenuItemNumberbox.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 57 of file MenuItemNumberbox.cpp.
| void MenuItemNumberbox::increase | ( | ) |
Definition at line 139 of file MenuItemNumberbox.cpp.
| void MenuItemNumberbox::reset | ( | ) |
Definition at line 149 of file MenuItemNumberbox.cpp.
| void MenuItemNumberbox::set | ( | int | value | ) |
Definition at line 134 of file MenuItemNumberbox.cpp.
| int MenuItemNumberbox::current |
Definition at line 43 of file MenuItemNumberbox.hpp.
| int MenuItemNumberbox::initial |
Definition at line 42 of file MenuItemNumberbox.hpp.
| int MenuItemNumberbox::jump |
Definition at line 44 of file MenuItemNumberbox.hpp.
| int MenuItemNumberbox::max |
Definition at line 41 of file MenuItemNumberbox.hpp.
| int MenuItemNumberbox::min |
Definition at line 40 of file MenuItemNumberbox.hpp.