Merge pull request #9 from CyB3RC0nN0R/paging

Now supporting single Arguments
This commit is contained in:
Kai S. K. Engelbart 2020-01-23 13:18:48 +01:00 committed by GitHub
commit ce09ea09e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

2
menu.c
View File

@ -63,7 +63,7 @@ void show_menu(const struct MenuPage* pages, const size_t page_count, const bool
{ {
// Perform action // Perform action
system("cls"); system("cls");
pages[page_index].items[i].action(); pages[page_index].items[i].action(pages[page_index].items[i].param);
action_performed = true; action_performed = true;
// Pause if requested // Pause if requested

3
menu.h
View File

@ -6,7 +6,8 @@
struct MenuItem { struct MenuItem {
char* text; char* text;
char key; char key;
void* (*action)(void); void* (*action)(void* params);
void* param;
}; };
/// <summary>Represents a border in which a menu is displayed.</summary> /// <summary>Represents a border in which a menu is displayed.</summary>