Website Summary Files Commits Branches @commit @diff @stats
path: root / src / ConsoleInterface / Menu.cpp
diff options
context:
space:
mode:
Commit5eb6112aaabebe5338e65f16cf4f18acc38ddf4d (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-05 21:29:12 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-05 21:29:12 +0300
Files208df29b92d915ecf020fa3c3f06e698069388a0 /src/ConsoleInterface/Menu.cpp
FMI-OOP-P1_TicketSystem-5eb6112aaabebe5338e65f16cf4f18acc38ddf4d.tar
FMI-OOP-P1_TicketSystem-5eb6112aaabebe5338e65f16cf4f18acc38ddf4d.tar.gz
FMI-OOP-P1_TicketSystem-5eb6112aaabebe5338e65f16cf4f18acc38ddf4d.zip
Parent1a24b8b50e1c6956be96cd6f0337c963728ebc9b (diff)
Autocommit at 05.05.2022 @ 21:29
1 files changed, 20 insertions, 8 deletions
-rw-r--r--src/ConsoleInterface/Menu.cpp28
diff --git a/src/ConsoleInterface/Menu.cpp b/src/ConsoleInterface/Menu.cpp
index beb69c2..caba7e8 100644
--- a/src/ConsoleInterface/Menu.cpp
+++ b/src/ConsoleInterface/Menu.cpp
@@ -2,13 +2,17 @@
#include "Toolbox.hpp"
#include <cstring>
-Menu::Menu() : Menu("Menu") {}
+Menu::Menu() : Menu("Menu", false, false) {}
-Menu::Menu(const char* title) : menuOptions() {
+Menu::Menu(const char* title, bool backExistsApp, bool isSubMenu) : menuOptions() {
+ this->backExistsApp = backExistsApp;
+ this->isSubMenu = isSubMenu;
strcpy(this->title, title);
}
-Menu::Menu(const char* title, const Command* commands, unsigned commandCount) {
+Menu::Menu(const char* title, bool backExistsApp, bool isSubMenu, const Command* commands, unsigned commandCount) {
+ this->backExistsApp = backExistsApp;
+ this->isSubMenu = isSubMenu;
menuOptions = List<Command>(commands, commandCount);
strcpy(this->title, title);
}
@@ -51,17 +55,25 @@ void Menu::navigate() const {
while (buffer != 0) {
clear();
- title(title);
+ if (isSubMenu)
+ subTitleBox(title);
+ else
+ titleBox(title);
+
switch(msgType) {
- case Error: error(msg.get_cstr()); msgType = NoPrint; break;
- case Warning: warning(msg.get_cstr()); msgType = NoPrint; break;
- case Success: success(msg.get_cstr()); msgType = NoPrint; break;
+ case Error: errorBox(msg.get_cstr()); msgType = NoPrint; break;
+ case Warning: warningBox(msg.get_cstr()); msgType = NoPrint; break;
+ case Success: successBox(msg.get_cstr()); msgType = NoPrint; break;
case NoPrint: printLine(""); break;
}
printLine("");
resetOrderedList(0);
- printOrderedListElem("Go Back");
+ if (backExistsApp)
+ printOrderedListElem("Exit");
+ else
+ printOrderedListElem("Go Back");
+
for (unsigned i = 0; i < menuOptions.get_count(); i++)
printOrderedListElem(menuOptions[i].get_nameInMenu());