78 lines
1.9 KiB
C++
78 lines
1.9 KiB
C++
/**
|
|
* @file menuControl.h
|
|
* @author Alexander Klein (alex@kleiax.de)
|
|
* @brief Contains a abstract class for Menu
|
|
* @version 0.1
|
|
* @date 2022-01-19
|
|
*
|
|
* @copyright Copyright (c) 2022
|
|
*
|
|
*/
|
|
|
|
#ifndef MENU_CONTROLL_H
|
|
#define MENU_CONTROLL_H
|
|
|
|
#include <iostream>
|
|
#include "displayWrapper.h"
|
|
|
|
/**
|
|
* @brief Baseclass to build Menus
|
|
*
|
|
* This class have to be inherited by other classes which want to be
|
|
* act as a menu, because the menu structure uses polymorphism.
|
|
*
|
|
*/
|
|
class MenuControl {
|
|
public:
|
|
virtual ~MenuControl() {};
|
|
|
|
/** @name UserInputs
|
|
* @brief This functions should be called be user actions.
|
|
*
|
|
* This functions have to be implement in every other menu
|
|
* class.
|
|
*/
|
|
///@{
|
|
virtual void down() = 0;
|
|
virtual void up() = 0;
|
|
virtual void right() = 0;
|
|
virtual void left() = 0;
|
|
virtual void yes() = 0;
|
|
virtual void no() = 0;
|
|
///@}
|
|
|
|
/**
|
|
* @brief can be called to update shown data
|
|
*/
|
|
virtual void update() {}
|
|
|
|
virtual void printMenu() = 0;
|
|
|
|
/**
|
|
* @brief Set the Parent Menu
|
|
*
|
|
* If the parentMenu is set it will be called automaticaly
|
|
* when the user left the child menu.
|
|
*
|
|
* @param menu
|
|
*/
|
|
void setParentMenu(MenuControl* menu) { this->parentMenu = menu; }
|
|
// MenuControl* getParentMenu() { return this->parentMenu; }
|
|
|
|
/**
|
|
* @brief Set the Lcd object
|
|
*
|
|
* If this is set the menu will be print on the display too.
|
|
*
|
|
* @param lcd
|
|
*/
|
|
void setLcd(DisplayWrapper* lcd) { this->lcd = lcd; }
|
|
|
|
protected:
|
|
void print(String lineOne, String lineTwo) const;
|
|
|
|
MenuControl* parentMenu = nullptr;
|
|
DisplayWrapper* lcd = nullptr;
|
|
};
|
|
#endif // MENU_CONTROLL_H
|