nsnake
Classic snake game for the terminal
Loading...
Searching...
No Matches
src
Interface
Menu
MenuItem.hpp
1
#ifndef MENUITEM_H_DEFINED
2
#define MENUITEM_H_DEFINED
3
4
#include <Interface/Window.hpp>
5
6
#include <string>
7
11
struct
MenuItem
12
{
17
enum
MenuItemType
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
51
MenuItemType
type
;
52
54
std::string
label
;
55
57
int
id
;
58
};
59
60
#endif
//MENUITEM_H_DEFINED
61
Window
A segment of the terminal screen (2D char matrix).
Definition
Window.hpp:17
MenuItem
Simplest type of item possible, with a label and user-defined id.
Definition
MenuItem.hpp:12
MenuItem::MenuItemType
MenuItemType
All possible item types.
Definition
MenuItem.hpp:18
MenuItem::draw
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::MenuItem
MenuItem(std::string label, int id)
Create a MenuItem, with user-defined id.
Definition
MenuItem.cpp:6
MenuItem::handleInput
virtual void handleInput()
Makes the menu item react to input, as seen on the global InputManager.
Definition
MenuItem.cpp:19
MenuItem::type
MenuItemType type
Specific type of this widget.
Definition
MenuItem.hpp:51
MenuItem::label
std::string label
Text that will be shown on the screen.
Definition
MenuItem.hpp:54
MenuItem::id
int id
User-defined id to identify this item.
Definition
MenuItem.hpp:57
Generated on Thu Jul 20 2023 00:00:00 for nsnake by
1.12.0