summaryrefslogtreecommitdiff
path: root/apps/gui/list.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/list.c')
-rw-r--r--apps/gui/list.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 29145eb3ca..36dbe44445 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -178,6 +178,7 @@ void gui_synclist_init(struct gui_synclist * gui_list,
178#ifdef HAVE_LCD_COLOR 178#ifdef HAVE_LCD_COLOR
179 gui_list->title_color = -1; 179 gui_list->title_color = -1;
180 gui_list->callback_get_item_color = NULL; 180 gui_list->callback_get_item_color = NULL;
181 gui_list->selection_color = NULL;
181#endif 182#endif
182} 183}
183 184
@@ -513,6 +514,22 @@ void gui_synclist_set_color_callback(struct gui_synclist * lists,
513{ 514{
514 lists->callback_get_item_color = color_callback; 515 lists->callback_get_item_color = color_callback;
515} 516}
517
518void gui_synclist_set_sel_color(struct gui_synclist * lists,
519 struct list_selection_color *list_sel_color)
520{
521 lists->selection_color = list_sel_color;
522 if(list_sel_color)
523 {
524 FOR_NB_SCREENS(i) /* might need to be only SCREEN_MAIN */
525 {
526 lists->parent[i]->fg_pattern = list_sel_color->fg_color;
527 lists->parent[i]->bg_pattern = list_sel_color->bg_color;
528 }
529 }
530 else
531 list_init_viewports(lists);
532}
516#endif 533#endif
517 534
518static void gui_synclist_select_next_page(struct gui_synclist * lists, 535static void gui_synclist_select_next_page(struct gui_synclist * lists,
@@ -890,7 +907,7 @@ bool simplelist_show_list(struct simplelist_info *info)
890 getname = simplelist_static_getname; 907 getname = simplelist_static_getname;
891 908
892 FOR_NB_SCREENS(i) 909 FOR_NB_SCREENS(i)
893 viewportmanager_theme_enable(i, true, NULL); 910 viewportmanager_theme_enable(i, !info->hide_theme, NULL);
894 911
895 gui_synclist_init(&lists, getname, info->callback_data, 912 gui_synclist_init(&lists, getname, info->callback_data,
896 info->scroll_all, info->selection_size, NULL); 913 info->scroll_all, info->selection_size, NULL);
@@ -904,6 +921,8 @@ bool simplelist_show_list(struct simplelist_info *info)
904#ifdef HAVE_LCD_COLOR 921#ifdef HAVE_LCD_COLOR
905 if (info->get_color) 922 if (info->get_color)
906 gui_synclist_set_color_callback(&lists, info->get_color); 923 gui_synclist_set_color_callback(&lists, info->get_color);
924 if (info->selection_color)
925 gui_synclist_set_sel_color(&lists, info->selection_color);
907#endif 926#endif
908 927
909 if (info->hide_selection) 928 if (info->hide_selection)
@@ -924,7 +943,9 @@ bool simplelist_show_list(struct simplelist_info *info)
924 gui_synclist_select_item(&lists, info->selection); 943 gui_synclist_select_item(&lists, info->selection);
925 944
926 gui_synclist_draw(&lists); 945 gui_synclist_draw(&lists);
927 gui_synclist_speak_item(&lists); 946
947 if (info->speak_onshow)
948 gui_synclist_speak_item(&lists);
928 949
929 while(1) 950 while(1)
930 { 951 {
@@ -955,6 +976,11 @@ bool simplelist_show_list(struct simplelist_info *info)
955 info->selection = -1; 976 info->selection = -1;
956 break; 977 break;
957 } 978 }
979 else if (action == ACTION_STD_OK)
980 {
981 info->selection = gui_synclist_get_sel_pos(&lists);
982 break;
983 }
958 else if ((action == ACTION_REDRAW) || 984 else if ((action == ACTION_REDRAW) ||
959 (list_is_dirty(&lists)) || 985 (list_is_dirty(&lists)) ||
960 (old_line_count != simplelist_line_count)) 986 (old_line_count != simplelist_line_count))
@@ -971,6 +997,12 @@ bool simplelist_show_list(struct simplelist_info *info)
971 return true; 997 return true;
972 } 998 }
973 talk_shutup(); 999 talk_shutup();
1000
1001#ifdef HAVE_LCD_COLOR
1002 if (info->selection_color)
1003 gui_synclist_set_sel_color(&lists, NULL);
1004#endif
1005
974 FOR_NB_SCREENS(i) 1006 FOR_NB_SCREENS(i)
975 viewportmanager_theme_undo(i, false); 1007 viewportmanager_theme_undo(i, false);
976 return false; 1008 return false;
@@ -984,6 +1016,8 @@ void simplelist_info_init(struct simplelist_info *info, char* title,
984 info->selection_size = 1; 1016 info->selection_size = 1;
985 info->hide_selection = false; 1017 info->hide_selection = false;
986 info->scroll_all = false; 1018 info->scroll_all = false;
1019 info->hide_theme = false;
1020 info->speak_onshow = true;
987 info->timeout = HZ/10; 1021 info->timeout = HZ/10;
988 info->selection = 0; 1022 info->selection = 0;
989 info->action_callback = NULL; 1023 info->action_callback = NULL;
@@ -993,6 +1027,7 @@ void simplelist_info_init(struct simplelist_info *info, char* title,
993 info->get_talk = NULL; 1027 info->get_talk = NULL;
994#ifdef HAVE_LCD_COLOR 1028#ifdef HAVE_LCD_COLOR
995 info->get_color = NULL; 1029 info->get_color = NULL;
1030 info->selection_color = NULL;
996#endif 1031#endif
997 info->callback_data = data; 1032 info->callback_data = data;
998 simplelist_line_count = 0; 1033 simplelist_line_count = 0;