/** * @file menuEntry.cpp * @author Alexander Klein (alex@kleiax.de) * @brief * @version 0.1 * @date 2022-01-12 * * @copyright Copyright (c) 2022 * */ #include "menuAction.h" MenuAction::MenuAction(const char* name, void (*function) (), void (*callback) ()) { this->name = name; this->function = function; this->callback = callback; } MenuAction::MenuAction(const char* name, void (*function) ()) { this->name = name; this->function = function; this->callback = nullptr; } MenuAction::MenuAction(const char* name, MenuControl* menu) { this->name = name; this->menu = menu; this->isMenu = true; this->callback = nullptr; } void MenuAction::runAction() { if (isMenu) this->menu->printMenu(); else this->function(); if (this->callback) this->callback(); } const char* MenuAction::getName() { return this->name; } bool MenuAction::getIsMenu() { return this->isMenu; } MenuControl* MenuAction::getMenu() { if (isMenu) return this->menu; else return nullptr; }