nsnake
Classic snake game for the terminal
MenuItemNumberbox.hpp
1 #ifndef MENUITEMNUMBERBOX_H_DEFINED
2 #define MENUITEMNUMBERBOX_H_DEFINED
3 
4 #include <Interface/Menu/MenuItem.hpp>
5 
18 {
28  MenuItemNumberbox(std::string label, int id, int min, int max, int initial, int jump=1);
29  virtual ~MenuItemNumberbox() { };
30 
31  void draw(Window* window, int x, int y, int width, bool hilite=false);
32 
33  void handleInput();
34 
35  void increase();
36  void decrease();
37  void set(int value);
38  void reset();
39 
40  int min;
41  int max;
42  int initial;
43  int current;
44  int jump;
45 
46 private:
48  void cap();
49 };
50 
51 #endif //MENUITEMNUMBERBOX_H_DEFINED
52 
MenuItemNumberbox::handleInput
void handleInput()
Makes the menu item react to input, as seen on the global InputManager.
Definition: MenuItemNumberbox.cpp:57
MenuItemNumberbox::MenuItemNumberbox
MenuItemNumberbox(std::string label, int id, int min, int max, int initial, int jump=1)
Create a new number box.
Definition: MenuItemNumberbox.cpp:7
Window
A segment of the terminal screen (2D char matrix).
Definition: Window.hpp:17
MenuItem::label
std::string label
Text that will be shown on the screen.
Definition: MenuItem.hpp:54
MenuItem
Simplest type of item possible, with a label and user-defined id.
Definition: MenuItem.hpp:12
MenuItemNumberbox::draw
void draw(Window *window, int x, int y, int width, bool hilite=false)
Shows this item at #x, #y with #width.
Definition: MenuItemNumberbox.cpp:17
MenuItemNumberbox
Allows to select a number, kinda like a slider.
Definition: MenuItemNumberbox.hpp:18