diff options
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/list.c | 16 | ||||
-rw-r--r-- | apps/gui/list.h | 18 |
2 files changed, 23 insertions, 11 deletions
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 @@ | |||
40 | 40 | ||
41 | 41 | ||
42 | void gui_list_init(struct gui_list * gui_list, | 42 | void gui_list_init(struct gui_list * gui_list, |
43 | list_get_icon callback_get_item_icon, | ||
44 | list_get_name callback_get_item_name, | 43 | list_get_name callback_get_item_name, |
45 | void * data | 44 | void * data |
46 | ) | 45 | ) |
47 | { | 46 | { |
48 | gui_list->callback_get_item_icon = callback_get_item_icon; | 47 | gui_list->callback_get_item_icon = NULL; |
49 | gui_list->callback_get_item_name = callback_get_item_name; | 48 | gui_list->callback_get_item_name = callback_get_item_name; |
50 | gui_list->display = NULL; | 49 | gui_list->display = NULL; |
51 | gui_list_set_nb_items(gui_list, 0); | 50 | gui_list_set_nb_items(gui_list, 0); |
@@ -126,8 +125,7 @@ void gui_list_draw(struct gui_list * gui_list) | |||
126 | int cursor_pos = 0; | 125 | int cursor_pos = 0; |
127 | int icon_pos = 1; | 126 | int icon_pos = 1; |
128 | int text_pos; | 127 | int text_pos; |
129 | bool draw_icons = (gui_list->callback_get_item_icon != NULL && | 128 | bool draw_icons = (gui_list->callback_get_item_icon != NULL ) ; |
130 | global_settings.show_icons) ; | ||
131 | bool draw_cursor; | 129 | bool draw_cursor; |
132 | int i; | 130 | int i; |
133 | 131 | ||
@@ -363,7 +361,6 @@ void gui_list_del_item(struct gui_list * gui_list) | |||
363 | */ | 361 | */ |
364 | void gui_synclist_init( | 362 | void gui_synclist_init( |
365 | struct gui_synclist * lists, | 363 | struct gui_synclist * lists, |
366 | list_get_icon callback_get_item_icon, | ||
367 | list_get_name callback_get_item_name, | 364 | list_get_name callback_get_item_name, |
368 | void * data | 365 | void * data |
369 | ) | 366 | ) |
@@ -372,7 +369,6 @@ void gui_synclist_init( | |||
372 | FOR_NB_SCREENS(i) | 369 | FOR_NB_SCREENS(i) |
373 | { | 370 | { |
374 | gui_list_init(&(lists->gui_list[i]), | 371 | gui_list_init(&(lists->gui_list[i]), |
375 | callback_get_item_icon, | ||
376 | callback_get_item_name, | 372 | callback_get_item_name, |
377 | data); | 373 | data); |
378 | gui_list_set_display(&(lists->gui_list[i]), &(screens[i])); | 374 | 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) | |||
387 | gui_list_set_nb_items(&(lists->gui_list[i]), nb_items); | 383 | gui_list_set_nb_items(&(lists->gui_list[i]), nb_items); |
388 | } | 384 | } |
389 | } | 385 | } |
386 | void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback) | ||
387 | { | ||
388 | int i; | ||
389 | FOR_NB_SCREENS(i) | ||
390 | { | ||
391 | gui_list_set_icon_callback(&(lists->gui_list[i]), icon_callback); | ||
392 | } | ||
393 | } | ||
390 | 394 | ||
391 | void gui_synclist_draw(struct gui_synclist * lists) | 395 | void gui_synclist_draw(struct gui_synclist * lists) |
392 | { | 396 | { |
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 | |||
136 | * to a given item number | 136 | * to a given item number |
137 | * - callback_get_item_name : pointer to a function that associates a label | 137 | * - callback_get_item_name : pointer to a function that associates a label |
138 | * to a given item number | 138 | * to a given item number |
139 | * - data : extra data passed to the list callback | ||
139 | */ | 140 | */ |
140 | extern void gui_list_init(struct gui_list * gui_list, | 141 | extern void gui_list_init(struct gui_list * gui_list, |
141 | list_get_icon callback_get_item_icon, | ||
142 | list_get_name callback_get_item_name, | 142 | list_get_name callback_get_item_name, |
143 | void * data | 143 | void * data |
144 | ); | 144 | ); |
@@ -146,7 +146,7 @@ extern void gui_list_init(struct gui_list * gui_list, | |||
146 | /* | 146 | /* |
147 | * Sets the numbers of items the list can currently display | 147 | * Sets the numbers of items the list can currently display |
148 | * note that the list's context like the currently pointed item is resetted | 148 | * note that the list's context like the currently pointed item is resetted |
149 | * - gui_list : the list structure to initialize | 149 | * - gui_list : the list structure |
150 | * - nb_items : the numbers of items you want | 150 | * - nb_items : the numbers of items you want |
151 | */ | 151 | */ |
152 | #define gui_list_set_nb_items(gui_list, nb) \ | 152 | #define gui_list_set_nb_items(gui_list, nb) \ |
@@ -154,7 +154,7 @@ extern void gui_list_init(struct gui_list * gui_list, | |||
154 | 154 | ||
155 | /* | 155 | /* |
156 | * Returns the numbers of items currently in the list | 156 | * Returns the numbers of items currently in the list |
157 | * - gui_list : the list structure to initialize | 157 | * - gui_list : the list structure |
158 | */ | 158 | */ |
159 | #define gui_list_get_nb_items(gui_list) \ | 159 | #define gui_list_get_nb_items(gui_list) \ |
160 | (gui_list)->nb_items | 160 | (gui_list)->nb_items |
@@ -170,6 +170,14 @@ extern void gui_list_put_selection_in_screen(struct gui_list * gui_list, | |||
170 | bool put_from_end); | 170 | bool put_from_end); |
171 | 171 | ||
172 | /* | 172 | /* |
173 | * Sets the icon callback function | ||
174 | * - gui_list : the list structure | ||
175 | * - _callback : the callback function | ||
176 | */ | ||
177 | #define gui_list_set_icon_callback(gui_list, _callback) \ | ||
178 | (gui_list)->callback_get_item_icon=_callback | ||
179 | |||
180 | /* | ||
173 | * Attach the scrolling list to a screen | 181 | * Attach the scrolling list to a screen |
174 | * (The previous screen attachement is lost) | 182 | * (The previous screen attachement is lost) |
175 | * - gui_list : the list structure | 183 | * - gui_list : the list structure |
@@ -277,14 +285,14 @@ struct gui_synclist | |||
277 | 285 | ||
278 | extern void gui_synclist_init( | 286 | extern void gui_synclist_init( |
279 | struct gui_synclist * lists, | 287 | struct gui_synclist * lists, |
280 | list_get_icon callback_get_item_icon, | ||
281 | list_get_name callback_get_item_name, | 288 | list_get_name callback_get_item_name, |
282 | void * data | 289 | void * data |
283 | ); | 290 | ); |
284 | extern void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items); | 291 | extern void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items); |
285 | 292 | extern void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback); | |
286 | #define gui_synclist_get_nb_items(lists) \ | 293 | #define gui_synclist_get_nb_items(lists) \ |
287 | gui_list_get_nb_items(&((lists)->gui_list[0])) | 294 | gui_list_get_nb_items(&((lists)->gui_list[0])) |
295 | |||
288 | extern int gui_synclist_get_sel_pos(struct gui_synclist * lists); | 296 | extern int gui_synclist_get_sel_pos(struct gui_synclist * lists); |
289 | 297 | ||
290 | #define gui_synclist_get_sel_pos(lists) \ | 298 | #define gui_synclist_get_sel_pos(lists) \ |