diff options
Diffstat (limited to 'apps/gui/list.c')
-rw-r--r-- | apps/gui/list.c | 39 |
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, #ifdef HAVE_LCD_COLOR gui_list->title_color = -1; gui_list->callback_get_item_color = NULL; + gui_list->selection_color = NULL; #endif } @@ -513,6 +514,22 @@ void gui_synclist_set_color_callback(struct gui_synclist * lists, { lists->callback_get_item_color = color_callback; } + +void gui_synclist_set_sel_color(struct gui_synclist * lists, + struct list_selection_color *list_sel_color) +{ + lists->selection_color = list_sel_color; + if(list_sel_color) + { + FOR_NB_SCREENS(i) /* might need to be only SCREEN_MAIN */ + { + lists->parent[i]->fg_pattern = list_sel_color->fg_color; + lists->parent[i]->bg_pattern = list_sel_color->bg_color; + } + } + else + list_init_viewports(lists); +} #endif static void gui_synclist_select_next_page(struct gui_synclist * lists, @@ -890,7 +907,7 @@ bool simplelist_show_list(struct simplelist_info *info) getname = simplelist_static_getname; FOR_NB_SCREENS(i) - viewportmanager_theme_enable(i, true, NULL); + viewportmanager_theme_enable(i, !info->hide_theme, NULL); gui_synclist_init(&lists, getname, info->callback_data, info->scroll_all, info->selection_size, NULL); @@ -904,6 +921,8 @@ bool simplelist_show_list(struct simplelist_info *info) #ifdef HAVE_LCD_COLOR if (info->get_color) gui_synclist_set_color_callback(&lists, info->get_color); + if (info->selection_color) + gui_synclist_set_sel_color(&lists, info->selection_color); #endif if (info->hide_selection) @@ -924,7 +943,9 @@ bool simplelist_show_list(struct simplelist_info *info) gui_synclist_select_item(&lists, info->selection); gui_synclist_draw(&lists); - gui_synclist_speak_item(&lists); + + if (info->speak_onshow) + gui_synclist_speak_item(&lists); while(1) { @@ -955,6 +976,11 @@ bool simplelist_show_list(struct simplelist_info *info) info->selection = -1; break; } + else if (action == ACTION_STD_OK) + { + info->selection = gui_synclist_get_sel_pos(&lists); + break; + } else if ((action == ACTION_REDRAW) || (list_is_dirty(&lists)) || (old_line_count != simplelist_line_count)) @@ -971,6 +997,12 @@ bool simplelist_show_list(struct simplelist_info *info) return true; } talk_shutup(); + +#ifdef HAVE_LCD_COLOR + if (info->selection_color) + gui_synclist_set_sel_color(&lists, NULL); +#endif + FOR_NB_SCREENS(i) viewportmanager_theme_undo(i, false); return false; @@ -984,6 +1016,8 @@ void simplelist_info_init(struct simplelist_info *info, char* title, info->selection_size = 1; info->hide_selection = false; info->scroll_all = false; + info->hide_theme = false; + info->speak_onshow = true; info->timeout = HZ/10; info->selection = 0; info->action_callback = NULL; @@ -993,6 +1027,7 @@ void simplelist_info_init(struct simplelist_info *info, char* title, info->get_talk = NULL; #ifdef HAVE_LCD_COLOR info->get_color = NULL; + info->selection_color = NULL; #endif info->callback_data = data; simplelist_line_count = 0; |