nsnake
Classic snake game for the terminal
Loading...
Searching...
No Matches
MenuItem.hpp
1#ifndef MENUITEM_H_DEFINED
2#define MENUITEM_H_DEFINED
3
4#include <Interface/Window.hpp>
5
6#include <string>
7
12{
18 {
19 ITEM, LABEL, CHECKBOX, NUMBERBOX, TEXTBOX, TEXTLIST
20 };
21
26 MenuItem(std::string label, int id);
27
28 virtual ~MenuItem() { };
29
35 virtual void draw(Window* window, int x, int y, int width, bool hilite=false);
36
46 virtual void handleInput();
47
52
54 std::string label;
55
57 int id;
58};
59
60#endif //MENUITEM_H_DEFINED
61
A segment of the terminal screen (2D char matrix).
Definition Window.hpp:17
Simplest type of item possible, with a label and user-defined id.
Definition MenuItem.hpp:12
MenuItemType
All possible item types.
Definition MenuItem.hpp:18
virtual void draw(Window *window, int x, int y, int width, bool hilite=false)
Shows this item at #x, #y with #width.
Definition MenuItem.cpp:12
MenuItem(std::string label, int id)
Create a MenuItem, with user-defined id.
Definition MenuItem.cpp:6
virtual void handleInput()
Makes the menu item react to input, as seen on the global InputManager.
Definition MenuItem.cpp:19
MenuItemType type
Specific type of this widget.
Definition MenuItem.hpp:51
std::string label
Text that will be shown on the screen.
Definition MenuItem.hpp:54
int id
User-defined id to identify this item.
Definition MenuItem.hpp:57