nsnake
Classic snake game for the terminal
MenuItemTextlist.hpp
1 #ifndef MENUITEMTEXTLIST_H_DEFINED
2 #define MENUITEMTEXTLIST_H_DEFINED
3 
4 #include <Interface/Menu/MenuItem.hpp>
5 
6 #include <vector>
7 #include <string>
8 
11 {
12 public:
13  MenuItemTextlist(std::string label, int id, std::vector<std::string> options, std::string initial);
14 
15  virtual ~MenuItemTextlist() { };
16 
17  void draw(Window* window, int x, int y, int width, bool hilite);
18  void handleInput();
19 
20  void increase();
21  void decrease();
22  void reset();
23 
24  std::string currentText();
25 
26 private:
27  std::vector<std::string> options;
28  int currentIndex;
29 };
30 
31 #endif //MENUITEMTEXTLIST_H_DEFINED
32 
A segment of the terminal screen (2D char matrix).
Definition: Window.hpp:16
void handleInput()
Makes the menu item react to input, as seen on the global InputManager.
void draw(Window *window, int x, int y, int width, bool hilite)
Shows this item at #x, #y with #width.
A list of selectable text.
Simplest type of item possible, with a label and user-defined id.
Definition: MenuItem.hpp:11
std::string label
Text that will be shown on the screen.
Definition: MenuItem.hpp:54