diff options
Autocommit at 28.05.2022 @ 20:15
2 files changed, 2 insertions, 39 deletions
| -rw-r--r-- | src/Generic/ConsoleInterface/Menu.cpp | 19 | ||||
| -rw-r--r-- | src/Generic/ConsoleInterface/Toolbox.hpp | 22 |
diff --git a/src/Generic/ConsoleInterface/Menu.cpp b/src/Generic/ConsoleInterface/Menu.cpp index 39084a1..71bafaf 100644 --- a/src/Generic/ConsoleInterface/Menu.cpp +++ b/src/Generic/ConsoleInterface/Menu.cpp @@ -22,26 +22,11 @@ void Menu::navigate() const { return; } - unsigned buffer = 1; // We immedeately read the value of buffer, so this is fine + char buffer[MAX_LINE_WIDTH]; while (buffer != 0) { clear(); - print("> "); - readLine(); - - resetOrderedList(0); - if (backExistsApp) - printOrderedListElem("Exit"); - else - printOrderedListElem("Go Back"); - - for (unsigned i = 0; i < menuOptions.get_count(); i++) - printOrderedListElem(menuOptions[i].get_nameInMenu()); - - _printInputBoxLabel("Execute No [0-"); - print(menuOptions.get_count()); - print("]: "); - read(buffer); + inputLineBox("> ", buffer, MAX_LINE_WIDTH); if (buffer > menuOptions.get_count()) registerError("Invalid menu option!"); diff --git a/src/Generic/ConsoleInterface/Toolbox.hpp b/src/Generic/ConsoleInterface/Toolbox.hpp index 91306cb..4c9544e 100644 --- a/src/Generic/ConsoleInterface/Toolbox.hpp +++ b/src/Generic/ConsoleInterface/Toolbox.hpp @@ -20,23 +20,8 @@ void titleBox(const char* title); //! Prints a title sub box void subTitleBox(const char* title); -//! Prints a success box -void successBox(const char* message); -//! Prints a success box as a sub box -void successSubBox(const char* message); -//! Prints a warning box -void warningBox(const char* message); -//! Prints a warning box as a sub box -void warningSubBox(const char* message); -//! Prints an error box -void errorBox(const char* message); -//! Prints an error box as a sub box -void errorSubBox(const char* message); - //! Prints label, gets a whole line of input and stores it to output void inputLineBox(const char* label, char* output, unsigned maxWidth, bool ignore = true); -//! Prints label as a sub box, gets a whole line of input and stores it to output -void inputLineSubBox(const char* label, char* output, unsigned maxWidth, bool ignore = true); //! Waits for user to press enter void pressEnterToContinue(bool ignore = true); @@ -89,13 +74,6 @@ void printLine(const T& item) { std::cout << item << std::endl; } -//! Prints the element as the latest list item -template <typename T> -void printOrderedListElem(const T& elem) { - _printOrderedListBeginning(); - printLine(elem); -} - //! Prints a label and then reads user input and stores it template <typename T> void inputBox(const char* label, T* output) { |
