diff options
Diffstat (limited to 'apps/gui/list.c')
-rw-r--r-- | apps/gui/list.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index 98b0148c14..b17e01ed90 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -68,6 +68,7 @@ void gui_list_init(struct gui_list * gui_list, | |||
68 | gui_list->scroll_all=scroll_all; | 68 | gui_list->scroll_all=scroll_all; |
69 | gui_list->selected_size=selected_size; | 69 | gui_list->selected_size=selected_size; |
70 | gui_list->title = NULL; | 70 | gui_list->title = NULL; |
71 | gui_list->title_width = 0; | ||
71 | } | 72 | } |
72 | 73 | ||
73 | void gui_list_set_display(struct gui_list * gui_list, struct screen * display) | 74 | void gui_list_set_display(struct gui_list * gui_list, struct screen * display) |
@@ -305,15 +306,22 @@ void gui_list_draw(struct gui_list * gui_list) | |||
305 | gui_list->start_item, | 306 | gui_list->start_item, |
306 | gui_list->start_item + display->nb_lines, VERTICAL); | 307 | gui_list->start_item + display->nb_lines, VERTICAL); |
307 | } | 308 | } |
309 | #endif | ||
308 | if (gui_list->title) | 310 | if (gui_list->title) |
309 | { | 311 | { |
310 | int start = ((display->width/display->char_width) - strlen(gui_list->title))/2; | 312 | /* Scroll if the title is too large, otherwise center */ |
311 | display->puts(start, 0, gui_list->title); | 313 | if (gui_list->title_width > gui_list->display->width) { |
312 | } | 314 | display->puts_scroll(0, 0, gui_list->title); |
313 | #else /* char cell display */ | 315 | } else { |
314 | if (gui_list->title) | 316 | #ifdef HAVE_LCD_BITMAP |
315 | display->puts(0, 0, gui_list->title); /* dont center title */ | 317 | display->putsxy((display->width - gui_list->title_width) / 2, |
318 | gui_textarea_get_ystart(display), gui_list->title); | ||
319 | #else | ||
320 | display->puts((display->width - gui_list->title_width) / 2, 0, | ||
321 | gui_list->title); | ||
316 | #endif | 322 | #endif |
323 | } | ||
324 | } | ||
317 | gui_textarea_update(display); | 325 | gui_textarea_update(display); |
318 | } | 326 | } |
319 | 327 | ||
@@ -513,10 +521,17 @@ void gui_list_screen_scroll_out_of_view(bool enable) | |||
513 | offset_out_of_view = false; | 521 | offset_out_of_view = false; |
514 | } | 522 | } |
515 | #endif /* HAVE_LCD_BITMAP */ | 523 | #endif /* HAVE_LCD_BITMAP */ |
516 | void gui_list_set_title(struct gui_list *gui_list , char* title) | 524 | |
525 | void gui_list_set_title(struct gui_list * gui_list, char * title) | ||
517 | { | 526 | { |
518 | gui_list->title = title; | 527 | gui_list->title = title; |
528 | #ifdef HAVE_LCD_BITMAP | ||
529 | gui_list->display->getstringsize(title, &gui_list->title_width, NULL); | ||
530 | #else | ||
531 | gui_list->title_width = strlen(title); | ||
532 | #endif | ||
519 | } | 533 | } |
534 | |||
520 | /* | 535 | /* |
521 | * Synchronized lists stuffs | 536 | * Synchronized lists stuffs |
522 | */ | 537 | */ |