#pragma once
#include "pch.h"
/// Represents one menu item in a menu.
struct MenuItem {
char* text;
char key;
void* (*action)(void);
};
/// Represents a border in which a menu is displayed.
struct MenuBorder {
char line_vertical;
char line_horizontal;
char corner_upper_left;
char corner_upper_right;
char corner_lower_left;
char corner_lower_right;
char title_left;
char title_right;
};
const extern struct MenuBorder DEFAULT, MODERN, NO_BORDER, SOLID;
/// Represents a page in the menu.
struct MenuPage {
const struct MenuItem* items;
const size_t item_count;
char* title;
bool loopback, pause;
const struct MenuBorder* border;
};
/// Constructs a menu with a specific amount of pages
/// An array of all pages to display.
/// The length of the array pages.
/// Always display the first page after a loopback=false item finished executing.
void show_menu(const struct MenuPage* pages, const size_t page_count, const bool infinite_loop);
/// Displaces a CUI menu to the user
/// The length of the array itemv of menu items.
/// An array of all menu items to display in the menu.
/// The title of the menu.
/// Specifies the border in which the menu is displayed.
void show_menu(const struct MenuPage* pages, const size_t page_count, const bool infinite_loop);