diff options
Autocommit at 05.05.2022 @ 15:03
3 files changed, 14 insertions, 9 deletions
| -rw-r--r-- | src/ConsoleInterface/Menu.cpp | 10 | ||||
| -rw-r--r-- | src/ConsoleInterface/Menu.h | 3 | ||||
| -rw-r--r-- | src/ConsoleInterface/Toolbox.cpp | 10 |
diff --git a/src/ConsoleInterface/Menu.cpp b/src/ConsoleInterface/Menu.cpp index 9c24d41..bc1c5f1 100644 --- a/src/ConsoleInterface/Menu.cpp +++ b/src/ConsoleInterface/Menu.cpp @@ -1,10 +1,14 @@ #include "Menu.h" #include "Toolbox.hpp" +#include <cstring> -Menu::Menu() : menuOptions() {} +Menu::Menu() : menuOptions() { + strcpy(title, "Menu"); +} -Menu::Menu(const Command* commands, unsigned commandCount) { +Menu::Menu(const Command* commands, unsigned commandCount, const char* title) { menuOptions = List<Command>(commands, commandCount); + strcpy(this->title, title); } void Menu::addCommand(const Command& command) { @@ -20,6 +24,8 @@ void Menu::navigate() const { unsigned buffer = 1; // We immedeately read the value of buffer, so this is fine while (buffer != 0) { + printTitle(title); + resetOrderedList(0); printOrderedListElem("Go Back"); for (unsigned i = 0; i < menuOptions.get_count(); i++) diff --git a/src/ConsoleInterface/Menu.h b/src/ConsoleInterface/Menu.h index 5298b4b..37bdf48 100644 --- a/src/ConsoleInterface/Menu.h +++ b/src/ConsoleInterface/Menu.h @@ -8,10 +8,9 @@ class Menu { char title[256]; List<Command> menuOptions; - public: Menu(); - Menu(const Command* commands, unsigned commandCount); + Menu(const Command* commands, unsigned commandCount, const char* title); void addCommand(const Command& command); void navigate() const; diff --git a/src/ConsoleInterface/Toolbox.cpp b/src/ConsoleInterface/Toolbox.cpp index 20f07db..d31aa91 100644 --- a/src/ConsoleInterface/Toolbox.cpp +++ b/src/ConsoleInterface/Toolbox.cpp @@ -7,11 +7,11 @@ void resetOrderedList(int starter) { } void _printOrderedListBeginning() { - std::cout << orderedListIndex++ << ". "; + std::cout << "[" << orderedListIndex++ << "] "; } void _printInputBoxLabel(const char* label) { - std::cout << "+ " << label; + std::cout << "<+> " << label; } void inputLineBox(const char* label, char* output, unsigned maxWidth) { @@ -20,14 +20,14 @@ void inputLineBox(const char* label, char* output, unsigned maxWidth) { } void printTitle(const char* title) { - std::cout << "## " << title << " ##" << std::endl; + std::cout << std::endl << "### " << title << " ###" << std::endl<< std::endl; } void printSuccess(const char* message) { - std::cout << ") " << message << std::endl; + std::cout << "... " << message << std::endl; } void printError(const char* message) { - std::cout << "! Err: " << message << std::endl; + std::cout << "!!! Err: " << message << std::endl; } |
