summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2010-09-17 15:45:54 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2010-09-20 08:58:53 +0200
commita47575911dfc360a95ae41585694c27aeb082f0a (patch)
treed23e59bc2ff53a3ff6a39964777ae75927fbb98c /include
parent7923392c561136bd7ac3d9e28cc61c18be3a8b3f (diff)
downloadbarebox-a47575911dfc360a95ae41585694c27aeb082f0a.tar.gz
barebox-a47575911dfc360a95ae41585694c27aeb082f0a.tar.xz
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 <menu> -c <command> [-R] [-b 0|1] -d <description> menu -e -a -m <menu> -u submenu -d [-b 0|1] <description> -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 <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/menu.h14
1 files changed, 13 insertions, 1 deletions
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);