diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2010-08-20 10:22:48 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-08-30 20:57:20 +0200 |
commit | 6ce1c664deedc932093d2750c37f509b067bf551 (patch) | |
tree | a1dbed529a6f43021d8676b38566086d6b89bf3b /include | |
parent | b712b26632d4af1e1c9454a3b330ed7b401e165b (diff) | |
download | barebox-6ce1c664deedc932093d2750c37f509b067bf551.tar.gz barebox-6ce1c664deedc932093d2750c37f509b067bf551.tar.xz |
Menu/cmd: add sub menu entry command support
this will simplify the creation of navigation link
as this
menu -a -m boot -d "Boot Menu"
menu -a -m network -d "Network settings"
menu -e -a -m network -u boot -d "Back"
menu -e -a -m boot -u network -d "Network settings ->"
menu -e -a -m boot -c reset -R -d "Reset"
menu -e -a -m boot -c clear -d "Exit"
menu -s -m boot
in C
struct menu m_boot = {
.name = "boot",
.display = "Boot Menu",
};
struct menu m_network = {
.name = "network",
.display = "Network settings",
};
struct menu_entry e_to_network = {
.display = "Network settings ->",
.action = menu_action_show,
.priv = &m_network,
};
struct menu_entry e_to_boot = {
.display = "Back",
.action = menu_action_show,
.priv = &m_boot,
};
struct menu_entry e_reset = {
.display = "Reset",
.action = menu_action_run,
.priv = "reset",
};
struct menu_entry e_exit = {
.display = "Exit",
.action = menu_action_run,
.non_re_ent = 1,
.priv = "clear",
};
void menu_test(void)
{
menu_add(&m_boot);
menu_add(&m_network);
menu_add_entry(&m_boot, &e_to_network);
menu_add_entry(&m_boot, &e_reset);
menu_add_entry(&m_boot, &e_exit);
menu_add_entry(&m_network, &e_to_boot);
menu_show(&m_boot);
}
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.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/menu.h b/include/menu.h index 29f18f206a..4405cedfac 100644 --- a/include/menu.h +++ b/include/menu.h @@ -82,6 +82,7 @@ struct menu_entry* menu_entry_get_by_num(struct menu* m, int num); * menu entry action functions */ void menu_action_run(struct menu *m, struct menu_entry *me); +void menu_action_show(struct menu *m, struct menu_entry *me); void menu_action_exit(struct menu *m, struct menu_entry *me); #endif /* __MENU_H__ */ |