76 lines
1.4 KiB
C++
76 lines
1.4 KiB
C++
/**
|
|
* @file menu.h
|
|
* @author Alexander Klein (alex@kleiax.de)
|
|
* @brief Contains the Menu class
|
|
* @version 0.1
|
|
* @date 2022-01-12
|
|
*
|
|
* @copyright Copyright (c) 2022
|
|
*
|
|
*/
|
|
#ifndef MENU_H
|
|
#define MENU_H
|
|
|
|
#include <list>
|
|
|
|
#include "menuAction.h"
|
|
#include "menuControl.h"
|
|
|
|
class MenuAction;
|
|
|
|
/**
|
|
* @brief A class to build menu structures
|
|
*/
|
|
class Menu : public MenuControl
|
|
{
|
|
public:
|
|
Menu();
|
|
~Menu() override;
|
|
|
|
/**
|
|
* @brief Add a MenuAction to the menu
|
|
*
|
|
* Every MenuAction is an Entry in the Menu
|
|
*
|
|
* @param entry
|
|
*/
|
|
void addEntry(MenuAction *entry);
|
|
|
|
/**
|
|
* @brief get information about the active menu
|
|
*
|
|
* If this is not the active menu, will be passed to
|
|
* active menu.
|
|
*
|
|
* @return true an other menu is active
|
|
* @return false this menu is active
|
|
*/
|
|
bool isInSubmenu();
|
|
|
|
/**
|
|
* @brief Print the actual screen
|
|
*/
|
|
void printMenu() override;
|
|
|
|
/**
|
|
* @brief Print the screen from the active menu
|
|
*/
|
|
void update() override;
|
|
|
|
// User Inputs
|
|
void down() override;
|
|
void up() override;
|
|
void right() override;
|
|
void left() override;
|
|
void yes() override;
|
|
void no() override;
|
|
|
|
private:
|
|
bool inSubmenu = false;
|
|
|
|
std::list<MenuAction *> entries;
|
|
std::list<MenuAction *>::iterator selectedEntry;
|
|
};
|
|
|
|
#endif // MENU_H
|