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.c49
1 files changed, 28 insertions, 21 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index e3b0d6afe5..c93210e0eb 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -92,7 +92,7 @@ static void gui_list_init(struct gui_list * gui_list,
92 gui_list->selected_size=selected_size; 92 gui_list->selected_size=selected_size;
93 gui_list->title = NULL; 93 gui_list->title = NULL;
94 gui_list->title_width = 0; 94 gui_list->title_width = 0;
95 gui_list->title_icon = NOICON; 95 gui_list->title_icon = Icon_NOICON;
96 96
97 gui_list->last_displayed_selected_item = -1 ; 97 gui_list->last_displayed_selected_item = -1 ;
98 gui_list->last_displayed_start_item = -1 ; 98 gui_list->last_displayed_start_item = -1 ;
@@ -230,8 +230,6 @@ static int gui_list_get_item_offset(struct gui_list * gui_list, int item_width,
230static void gui_list_draw_smart(struct gui_list *gui_list) 230static void gui_list_draw_smart(struct gui_list *gui_list)
231{ 231{
232 struct screen * display=gui_list->display; 232 struct screen * display=gui_list->display;
233 int cursor_pos = 0;
234 int icon_pos = 1;
235 int text_pos; 233 int text_pos;
236 bool draw_icons = (gui_list->callback_get_item_icon != NULL && global_settings.show_icons); 234 bool draw_icons = (gui_list->callback_get_item_icon != NULL && global_settings.show_icons);
237 bool draw_cursor; 235 bool draw_cursor;
@@ -288,9 +286,9 @@ static void gui_list_draw_smart(struct gui_list *gui_list)
288 { 286 {
289 if (gui_list->title_icon != NOICON && draw_icons) 287 if (gui_list->title_icon != NOICON && draw_icons)
290 { 288 {
291 screen_put_iconxy(display, 0, 0, gui_list->title_icon); 289 screen_put_icon(display, 0, 0, gui_list->title_icon);
292#ifdef HAVE_LCD_BITMAP 290#ifdef HAVE_LCD_BITMAP
293 text_pos = 8; /* pixels */ 291 text_pos = get_icon_width(display->screen_type)+2; /* pixels */
294#else 292#else
295 text_pos = 1; /* chars */ 293 text_pos = 1; /* chars */
296#endif 294#endif
@@ -327,17 +325,13 @@ static void gui_list_draw_smart(struct gui_list *gui_list)
327 if(draw_scrollbar || SHOW_LIST_TITLE) /* indent if there's 325 if(draw_scrollbar || SHOW_LIST_TITLE) /* indent if there's
328 a title */ 326 a title */
329 { 327 {
330 cursor_pos++;
331 icon_pos++;
332 text_pos += SCROLLBAR_WIDTH; 328 text_pos += SCROLLBAR_WIDTH;
333 } 329 }
334 if(!draw_cursor) 330 if(draw_cursor)
335 icon_pos--; 331 text_pos += get_icon_width(display->screen_type) + 2;
336 else
337 text_pos += CURSOR_WIDTH;
338 332
339 if(draw_icons) 333 if(draw_icons)
340 text_pos += 8; 334 text_pos += get_icon_width(display->screen_type) + 2;
341#else 335#else
342 draw_cursor = true; 336 draw_cursor = true;
343 if(draw_icons) 337 if(draw_icons)
@@ -413,7 +407,12 @@ static void gui_list_draw_smart(struct gui_list *gui_list)
413#endif 407#endif
414 408
415 if (draw_cursor) 409 if (draw_cursor)
416 screen_put_cursorxy(display, cursor_pos, i, true); 410 {
411 screen_put_icon_with_offset(display, 0, i,
412 (draw_scrollbar || SHOW_LIST_TITLE)?
413 SCROLLBAR_WIDTH: 0,
414 0, Icon_Cursor);
415 }
417 } 416 }
418 else 417 else
419 {/* normal item */ 418 {/* normal item */
@@ -437,12 +436,19 @@ static void gui_list_draw_smart(struct gui_list *gui_list)
437 /* Icons display */ 436 /* Icons display */
438 if(draw_icons) 437 if(draw_icons)
439 { 438 {
440 ICON icon; 439 enum themable_icons icon;
441 gui_list->callback_get_item_icon(current_item, 440 icon = gui_list->callback_get_item_icon(current_item, gui_list->data);
442 gui_list->data, 441 if(icon > Icon_NOICON)
443 &icon); 442 {
444 if(icon) 443#ifdef HAVE_LCD_BITMAP
445 screen_put_iconxy(display, icon_pos, i, icon); 444 int x = draw_cursor?1:0;
445 int x_off = (draw_scrollbar || SHOW_LIST_TITLE) ? SCROLLBAR_WIDTH: 0;
446 screen_put_icon_with_offset(display, x, i,
447 x_off, 0, icon);
448#else
449 screen_put_icon(display, 1, i, icon);
450#endif
451 }
446 } 452 }
447 } 453 }
448 454
@@ -737,7 +743,8 @@ void gui_list_screen_scroll_out_of_view(bool enable)
737 * Set the title and title icon of the list. Setting title to NULL disables 743 * Set the title and title icon of the list. Setting title to NULL disables
738 * both the title and icon. Use NOICON if there is no icon. 744 * both the title and icon. Use NOICON if there is no icon.
739 */ 745 */
740static void gui_list_set_title(struct gui_list * gui_list, char * title, ICON icon) 746static void gui_list_set_title(struct gui_list * gui_list,
747 char * title, enum themable_icons icon)
741{ 748{
742 gui_list->title = title; 749 gui_list->title = title;
743 gui_list->title_icon = icon; 750 gui_list->title_icon = icon;
@@ -870,7 +877,7 @@ void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll)
870} 877}
871 878
872void gui_synclist_set_title(struct gui_synclist * lists, 879void gui_synclist_set_title(struct gui_synclist * lists,
873 char * title, ICON icon) 880 char * title, enum themable_icons icon)
874{ 881{
875 int i; 882 int i;
876 FOR_NB_SCREENS(i) 883 FOR_NB_SCREENS(i)