Merge pull request #7 from CyB3RC0nN0R/paging

Changed Method Names
This commit is contained in:
Kai S. K. Engelbart 2020-01-16 08:18:40 +01:00 committed by GitHub
commit c7885b81ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

8
menu.c
View File

@ -19,9 +19,9 @@ const struct MenuBorder SOLID = {
186, 205, 201, 187, 200, 188, '[', ']' 186, 205, 201, 187, 200, 188, '[', ']'
}; };
void show_menu(const int itemc, const struct MenuItem itemv[], const char title[], const struct MenuBorder* border); void print_content(const int itemc, const struct MenuItem itemv[], const char title[], const struct MenuBorder* border);
void page(const struct MenuPage* pages, const size_t page_count, const bool infinite_loop) void show_menu(const struct MenuPage* pages, const size_t page_count, const bool infinite_loop)
{ {
unsigned int page_index = 0; unsigned int page_index = 0;
bool action_performed, loop, page_changed = true; bool action_performed, loop, page_changed = true;
@ -30,7 +30,7 @@ void page(const struct MenuPage* pages, const size_t page_count, const bool infi
do { do {
do { do {
show_menu(pages[page_index].item_count, pages[page_index].items, pages[page_index].title, pages[page_index].border); print_content(pages[page_index].item_count, pages[page_index].items, pages[page_index].title, pages[page_index].border);
// Wait for user selection // Wait for user selection
putchar('>'); putchar('>');
@ -102,7 +102,7 @@ void get_console_dimensions(int* width, int* height)
} }
// Draws a menu to the console // Draws a menu to the console
void show_menu(const int itemc, const struct MenuItem itemv[], const char title[], const struct MenuBorder* border) void print_content(const int itemc, const struct MenuItem itemv[], const char title[], const struct MenuBorder* border)
{ {
unsigned width, height, item_index; unsigned width, height, item_index;

2
menu.h
View File

@ -37,4 +37,4 @@ struct MenuPage {
/// <param name="pages">An array of all pages to display.</param> /// <param name="pages">An array of all pages to display.</param>
/// <param name="page_count">The length of the array <c>pages</c>.</param> /// <param name="page_count">The length of the array <c>pages</c>.</param>
/// <param name="infinite_loop">Always display the first page after a loopback=false item finished executing.</param> /// <param name="infinite_loop">Always display the first page after a loopback=false item finished executing.</param>
void page(const struct MenuPage* pages, const size_t page_count, const bool infinite_loop); void show_menu(const struct MenuPage* pages, const size_t page_count, const bool infinite_loop);