diff options
Diffstat (limited to 'apps/menu.c')
-rw-r--r-- | apps/menu.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/apps/menu.c b/apps/menu.c index b1ba9ea0e0..34a6d0e8b9 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -61,6 +61,7 @@ | |||
61 | /* needed for the old menu system */ | 61 | /* needed for the old menu system */ |
62 | struct menu { | 62 | struct menu { |
63 | struct menu_item* items; | 63 | struct menu_item* items; |
64 | char *title; | ||
64 | int count; | 65 | int count; |
65 | int (*callback)(int, int); | 66 | int (*callback)(int, int); |
66 | int current_selection; | 67 | int current_selection; |
@@ -659,9 +660,6 @@ static int menu_find_free(void) | |||
659 | int menu_init(const struct menu_item* mitems, int count, int (*callback)(int, int), | 660 | int menu_init(const struct menu_item* mitems, int count, int (*callback)(int, int), |
660 | const char *button1, const char *button2, const char *button3) | 661 | const char *button1, const char *button2, const char *button3) |
661 | { | 662 | { |
662 | (void)button1; | ||
663 | (void)button2; | ||
664 | (void)button3; | ||
665 | int menu=menu_find_free(); | 663 | int menu=menu_find_free(); |
666 | if(menu==-1)/* Out of menus */ | 664 | if(menu==-1)/* Out of menus */ |
667 | return -1; | 665 | return -1; |
@@ -669,6 +667,9 @@ int menu_init(const struct menu_item* mitems, int count, int (*callback)(int, in | |||
669 | menus[menu].count = count; | 667 | menus[menu].count = count; |
670 | menus[menu].callback = callback; | 668 | menus[menu].callback = callback; |
671 | menus[menu].current_selection = 0; | 669 | menus[menu].current_selection = 0; |
670 | if ((button2 == NULL) && (button3 == NULL)) | ||
671 | menus[menu].title = button1; | ||
672 | else menus[menu].title = NULL; | ||
672 | return menu; | 673 | return menu; |
673 | } | 674 | } |
674 | 675 | ||
@@ -702,6 +703,14 @@ static char* oldmenuwrapper_getname(int selected_item, | |||
702 | unsigned char* desc = menus[(intptr_t)data].items[selected_item].desc; | 703 | unsigned char* desc = menus[(intptr_t)data].items[selected_item].desc; |
703 | return P2STR(desc); | 704 | return P2STR(desc); |
704 | } | 705 | } |
706 | |||
707 | #ifdef HAVE_LCD_BITMAP | ||
708 | static void oldmenu_get_icon(int selected_item, void * data, ICON * icon) | ||
709 | { | ||
710 | *icon = bitmap_icons_6x8[Icon_Menu_functioncall]; | ||
711 | } | ||
712 | #endif | ||
713 | |||
705 | static void init_oldmenu(const struct menu_item_ex *menu, | 714 | static void init_oldmenu(const struct menu_item_ex *menu, |
706 | struct gui_synclist *lists, int selected, bool callback) | 715 | struct gui_synclist *lists, int selected, bool callback) |
707 | { | 716 | { |
@@ -711,6 +720,11 @@ static void init_oldmenu(const struct menu_item_ex *menu, | |||
711 | gui_synclist_set_nb_items(lists, MENU_GET_COUNT(menu->flags)); | 720 | gui_synclist_set_nb_items(lists, MENU_GET_COUNT(menu->flags)); |
712 | gui_synclist_limit_scroll(lists, true); | 721 | gui_synclist_limit_scroll(lists, true); |
713 | gui_synclist_select_item(lists, selected); | 722 | gui_synclist_select_item(lists, selected); |
723 | #ifdef HAVE_LCD_BITMAP | ||
724 | gui_synclist_set_title(lists, menus[menu->value].title, | ||
725 | bitmap_icons_6x8[Icon_Submenu_Entered]); | ||
726 | gui_synclist_set_icon_callback(lists, oldmenu_get_icon); | ||
727 | #endif | ||
714 | } | 728 | } |
715 | 729 | ||
716 | static void menu_talk_selected(int m) | 730 | static void menu_talk_selected(int m) |
@@ -729,7 +743,7 @@ int menu_show(int m) | |||
729 | { | 743 | { |
730 | oldmenuwrapper_callback, | 744 | oldmenuwrapper_callback, |
731 | oldmenuwrapper_getname, | 745 | oldmenuwrapper_getname, |
732 | (void*)(intptr_t)m, Icon_NOICON | 746 | (void*)(intptr_t)m, Icon_Submenu |
733 | }; | 747 | }; |
734 | 748 | ||
735 | menu.flags = (MENU_TYPE_MASK&MT_OLD_MENU) | MENU_DYNAMIC_DESC | | 749 | menu.flags = (MENU_TYPE_MASK&MT_OLD_MENU) | MENU_DYNAMIC_DESC | |