From c8e50bb0fd3d9d1629e5c78f92bbf7bc9af84f2c Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 20 Jun 2024 14:16:18 -0700 Subject: [dynui] Generalise mechanisms for looking up user interface items Generalise the ability to look up a dynamic user interface item by index or by shortcut key, to allow for reuse of this code for interactive forms. Signed-off-by: Michael Brown --- src/include/ipxe/dynui.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/include') diff --git a/src/include/ipxe/dynui.h b/src/include/ipxe/dynui.h index 25124a3af..f38d44825 100644 --- a/src/include/ipxe/dynui.h +++ b/src/include/ipxe/dynui.h @@ -21,6 +21,8 @@ struct dynamic_ui { const char *title; /** Dynamic user interface items */ struct list_head items; + /** Number of user interface items */ + unsigned int count; }; /** A dynamic user interface item */ @@ -31,6 +33,8 @@ struct dynamic_item { const char *name; /** Text */ const char *text; + /** Index */ + unsigned int index; /** Shortcut key */ int shortcut; /** Is default item */ @@ -44,6 +48,10 @@ extern struct dynamic_item * add_dynui_item ( struct dynamic_ui *dynui, int is_default ); extern void destroy_dynui ( struct dynamic_ui *dynui ); extern struct dynamic_ui * find_dynui ( const char *name ); +extern struct dynamic_item * dynui_item ( struct dynamic_ui *dynui, + unsigned int index ); +extern struct dynamic_item * dynui_shortcut ( struct dynamic_ui *dynui, + int key ); extern int show_menu ( struct dynamic_ui *dynui, unsigned long timeout, const char *select, struct dynamic_item **selected ); -- cgit v1.2.3-55-g7522