From 15046f99b3840c07bdd9d52e7014c6e775267c55 Mon Sep 17 00:00:00 2001 From: Kevin Ferrare Date: Wed, 16 Nov 2005 17:23:49 +0000 Subject: show/hide icons now works properly in playlist viewer git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7911 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/list.c | 16 ++++++++++------ apps/gui/list.h | 18 +++++++++++++----- 2 files changed, 23 insertions(+), 11 deletions(-) (limited to 'apps/gui') diff --git a/apps/gui/list.c b/apps/gui/list.c index df398eaa58..ac084984eb 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -40,12 +40,11 @@ void gui_list_init(struct gui_list * gui_list, - list_get_icon callback_get_item_icon, list_get_name callback_get_item_name, void * data ) { - gui_list->callback_get_item_icon = callback_get_item_icon; + gui_list->callback_get_item_icon = NULL; gui_list->callback_get_item_name = callback_get_item_name; gui_list->display = NULL; gui_list_set_nb_items(gui_list, 0); @@ -126,8 +125,7 @@ void gui_list_draw(struct gui_list * gui_list) int cursor_pos = 0; int icon_pos = 1; int text_pos; - bool draw_icons = (gui_list->callback_get_item_icon != NULL && - global_settings.show_icons) ; + bool draw_icons = (gui_list->callback_get_item_icon != NULL ) ; bool draw_cursor; int i; @@ -363,7 +361,6 @@ void gui_list_del_item(struct gui_list * gui_list) */ void gui_synclist_init( struct gui_synclist * lists, - list_get_icon callback_get_item_icon, list_get_name callback_get_item_name, void * data ) @@ -372,7 +369,6 @@ void gui_synclist_init( FOR_NB_SCREENS(i) { gui_list_init(&(lists->gui_list[i]), - callback_get_item_icon, callback_get_item_name, data); gui_list_set_display(&(lists->gui_list[i]), &(screens[i])); @@ -387,6 +383,14 @@ void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items) gui_list_set_nb_items(&(lists->gui_list[i]), nb_items); } } +void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback) +{ + int i; + FOR_NB_SCREENS(i) + { + gui_list_set_icon_callback(&(lists->gui_list[i]), icon_callback); + } +} void gui_synclist_draw(struct gui_synclist * lists) { diff --git a/apps/gui/list.h b/apps/gui/list.h index 42a8677637..3e5b38e5b1 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h @@ -136,9 +136,9 @@ struct gui_list * to a given item number * - callback_get_item_name : pointer to a function that associates a label * to a given item number + * - data : extra data passed to the list callback */ extern void gui_list_init(struct gui_list * gui_list, - list_get_icon callback_get_item_icon, list_get_name callback_get_item_name, void * data ); @@ -146,7 +146,7 @@ extern void gui_list_init(struct gui_list * gui_list, /* * Sets the numbers of items the list can currently display * note that the list's context like the currently pointed item is resetted - * - gui_list : the list structure to initialize + * - gui_list : the list structure * - nb_items : the numbers of items you want */ #define gui_list_set_nb_items(gui_list, nb) \ @@ -154,7 +154,7 @@ extern void gui_list_init(struct gui_list * gui_list, /* * Returns the numbers of items currently in the list - * - gui_list : the list structure to initialize + * - gui_list : the list structure */ #define gui_list_get_nb_items(gui_list) \ (gui_list)->nb_items @@ -169,6 +169,14 @@ extern void gui_list_init(struct gui_list * gui_list, extern void gui_list_put_selection_in_screen(struct gui_list * gui_list, bool put_from_end); +/* + * Sets the icon callback function + * - gui_list : the list structure + * - _callback : the callback function + */ +#define gui_list_set_icon_callback(gui_list, _callback) \ + (gui_list)->callback_get_item_icon=_callback + /* * Attach the scrolling list to a screen * (The previous screen attachement is lost) @@ -277,14 +285,14 @@ struct gui_synclist extern void gui_synclist_init( struct gui_synclist * lists, - list_get_icon callback_get_item_icon, list_get_name callback_get_item_name, void * data ); extern void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items); - +extern void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback); #define gui_synclist_get_nb_items(lists) \ gui_list_get_nb_items(&((lists)->gui_list[0])) + extern int gui_synclist_get_sel_pos(struct gui_synclist * lists); #define gui_synclist_get_sel_pos(lists) \ -- cgit v1.2.3