aboutsummaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/dynui.h
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2024-06-20 14:16:18 -0700
committerMichael Brown <mcb30@ipxe.org>2024-06-20 14:51:28 -0700
commitc8e50bb0fd3d9d1629e5c78f92bbf7bc9af84f2c (patch)
tree52b1a12a1a3b7af0210f7b84d09bbda4e5114608 /src/include/ipxe/dynui.h
parent5719cde838b6e86a02831373dae81642653b872f (diff)
downloadipxe-c8e50bb0fd3d9d1629e5c78f92bbf7bc9af84f2c.tar.gz
[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 <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/dynui.h')
-rw-r--r--src/include/ipxe/dynui.h8
1 files changed, 8 insertions, 0 deletions
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 );