From a47575911dfc360a95ae41585694c27aeb082f0a Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Fri, 17 Sep 2010 15:45:54 +0200 Subject: Menu: add box style entry this will allow you to create a box style entry via C API by specifying the type as struct menu_entry me = { .display "test", .type = MENU_ENTRY_BOX, .box_state = 1, .action = action_to_run, } and via shell menu -e -a -m -c [-R] [-b 0|1] -d menu -e -a -m -u submenu -d [-b 0|1] -b with 0 for not selected and 1 for selected and -c for the command to run when changing state Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Sascha Hauer --- include/menu.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/menu.h b/include/menu.h index cc9d0af7fd..6e7b555263 100644 --- a/include/menu.h +++ b/include/menu.h @@ -28,6 +28,11 @@ struct menu; +typedef enum { + MENU_ENTRY_NORMAL = 0, + MENU_ENTRY_BOX, +} menu_entry_type; + struct menu_entry { int num; char *display; @@ -35,6 +40,12 @@ struct menu_entry { void (*free)(struct menu_entry *me); int non_re_ent; + /* MENU_ENTRY_BOX */ + int box_state; + void (*box_action)(struct menu *m, struct menu_entry *me); + + menu_entry_type type; + struct list_head list; }; @@ -69,7 +80,8 @@ static inline struct menu* menu_alloc(void) return m; } struct menu_entry *menu_add_submenu(struct menu *parent, char *submenu, char *display); -struct menu_entry *menu_add_command_entry(struct menu *m, char *display, char *command); +struct menu_entry *menu_add_command_entry(struct menu *m, char *display, + char *command, menu_entry_type type); void menu_free(struct menu *m); int menu_add(struct menu* m); void menu_remove(struct menu *m); -- cgit v1.2.3