From d22820d4314db798c29e8ac4c06c48440ed46636 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 16 Jan 2020 08:07:43 +0100 Subject: [PATCH 1/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8855408..7bf534d 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ struct MenuPage pages[] = { * 6. Argument: Style des Menüs: Standardmäßig wird DEFAULT, MODERN, SOLID und NO_BORDER unterstützt */ }; -page(pages, sizeof(pages) / sizeof(struct MenuPage), true); +show_menu(pages, sizeof(pages) / sizeof(struct MenuPage), true); /* * 1. Argument: Vorher angelegtes struct; Enthält alle Seiten des Menüs -- 2.45.2 From da73f62ea700bea51ea0f080d9655f3a53cc763f Mon Sep 17 00:00:00 2001 From: Simon <33755707+Crotex@users.noreply.github.com> Date: Thu, 23 Jan 2020 13:01:19 +0100 Subject: [PATCH 2/2] Now supporting single Arguments --- menu.c | 2 +- menu.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/menu.c b/menu.c index 98839cd..48269a8 100644 --- a/menu.c +++ b/menu.c @@ -63,7 +63,7 @@ void show_menu(const struct MenuPage* pages, const size_t page_count, const bool { // Perform action system("cls"); - pages[page_index].items[i].action(); + pages[page_index].items[i].action(pages[page_index].items[i].param); action_performed = true; // Pause if requested diff --git a/menu.h b/menu.h index 496f55f..3776b21 100644 --- a/menu.h +++ b/menu.h @@ -6,7 +6,8 @@ struct MenuItem { char* text; char key; - void* (*action)(void); + void* (*action)(void* params); + void* param; }; /// Represents a border in which a menu is displayed. -- 2.45.2