mirror of
https://github.com/ipxe/ipxe
synced 2025-12-15 09:04:37 +03:00
[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>
This commit is contained in:
@@ -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 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user