Defines the menu that is made of buttons.
More...
#include <menu.h>
Defines the menu that is made of buttons.
◆ Menu()
| ConsoleUI::Menu::Menu |
( |
bool |
horizontal = false | ) |
|
Construct a new Menu object.
- Parameters
-
| horizontal | is the menu horizontal or vertical |
◆ addButton()
| void ConsoleUI::Menu::addButton |
( |
const std::string & |
label, |
|
|
std::function< void()> |
action |
|
) |
| |
Add a button to the menu.
- Parameters
-
| label | the label on the button |
| action | the function associtated with the button |
◆ draw()
| void ConsoleUI::Menu::draw |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
Draw the menu.
- Parameters
-
| x | left most position |
| y | top most position |
◆ getButtonCount()
| size_t ConsoleUI::Menu::getButtonCount |
( |
| ) |
const |
Get the number of buttons in the menu.
- Returns
- size_t
◆ getButtonWidth()
| size_t ConsoleUI::Menu::getButtonWidth |
( |
size_t |
index | ) |
const |
Get the width of the button by index.
- Parameters
-
| index | index of the button in the menu |
- Returns
- size_t
◆ getMaxWidth()
| size_t ConsoleUI::Menu::getMaxWidth |
( |
| ) |
const |
Get the width of the widest button in the menu.
- Returns
- size_t
◆ getSelectedIndex()
| size_t ConsoleUI::Menu::getSelectedIndex |
( |
| ) |
const |
|
inline |
Get the index of the selected menu button.
- Returns
- size_t
◆ isBackButtonPressed()
| bool ConsoleUI::Menu::isBackButtonPressed |
( |
| ) |
const |
determines if the menu back button has been pressed
- Returns
- true back button pressed
-
false back button not pressed
The documentation for this class was generated from the following files:
- /home/runner/work/StudyDungeon/StudyDungeon/src/menu.h
- /home/runner/work/StudyDungeon/StudyDungeon/src/menu.cpp