From 0d2fba2887a78b8bc4cd0d7fc6946d001075d92f Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 27 Mar 2012 17:27:27 +0100 Subject: [menu] Add the abstract concept of a menu Inspired-by: Robin Smidsrød Tested-by: Robin Smidsrød Signed-off-by: Michael Brown --- src/include/ipxe/menu.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/include/ipxe/menu.h (limited to 'src/include') diff --git a/src/include/ipxe/menu.h b/src/include/ipxe/menu.h new file mode 100644 index 000000000..943aa57a9 --- /dev/null +++ b/src/include/ipxe/menu.h @@ -0,0 +1,47 @@ +#ifndef _IPXE_MENU_H +#define _IPXE_MENU_H + +/** @file + * + * Menu selection + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include + +/** A menu */ +struct menu { + /** List of menus */ + struct list_head list; + /** Name */ + const char *name; + /** Title */ + const char *title; + /** Menu items */ + struct list_head items; +}; + +/** A menu item */ +struct menu_item { + /** List of menu items */ + struct list_head list; + /** Label */ + const char *label; + /** Text */ + const char *text; + /** Shortcut key */ + int shortcut; + /** Is default item */ + int is_default; +}; + +extern struct menu * create_menu ( const char *name, const char *title ); +extern struct menu_item * add_menu_item ( struct menu *menu, const char *label, + const char *text, int shortcut, + int is_default ); +extern void destroy_menu ( struct menu *menu ); +extern struct menu * find_menu ( const char *name ); + +#endif /* _IPXE_MENU_H */ -- cgit v1.2.3-55-g7522