diff options
Diffstat (limited to 'apps/gui/list.h')
-rw-r--r-- | apps/gui/list.h | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/apps/gui/list.h b/apps/gui/list.h index e587942c94..42a8677637 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h | |||
@@ -33,24 +33,33 @@ | |||
33 | #define LIST_PREV BUTTON_UP | 33 | #define LIST_PREV BUTTON_UP |
34 | #define LIST_PGUP (BUTTON_ON | BUTTON_UP) | 34 | #define LIST_PGUP (BUTTON_ON | BUTTON_UP) |
35 | #define LIST_PGDN (BUTTON_ON | BUTTON_DOWN) | 35 | #define LIST_PGDN (BUTTON_ON | BUTTON_DOWN) |
36 | |||
37 | #ifdef CONFIG_REMOTE_KEYPAD | ||
36 | #define LIST_RC_NEXT BUTTON_RC_FF | 38 | #define LIST_RC_NEXT BUTTON_RC_FF |
37 | #define LIST_RC_PREV BUTTON_RC_REW | 39 | #define LIST_RC_PREV BUTTON_RC_REW |
38 | #define LIST_RC_PGUP BUTTON_RC_SOURCE | 40 | #define LIST_RC_PGUP BUTTON_RC_SOURCE |
39 | #define LIST_RC_PGDN BUTTON_RC_BITRATE | 41 | #define LIST_RC_PGDN BUTTON_RC_BITRATE |
42 | #endif /* CONFIG_REMOTE_KEYPAD */ | ||
40 | 43 | ||
41 | #elif CONFIG_KEYPAD == RECORDER_PAD | 44 | #elif CONFIG_KEYPAD == RECORDER_PAD |
42 | #define LIST_NEXT BUTTON_DOWN | 45 | #define LIST_NEXT BUTTON_DOWN |
43 | #define LIST_PREV BUTTON_UP | 46 | #define LIST_PREV BUTTON_UP |
44 | #define LIST_PGUP (BUTTON_ON | BUTTON_UP) | 47 | #define LIST_PGUP (BUTTON_ON | BUTTON_UP) |
45 | #define LIST_PGDN (BUTTON_ON | BUTTON_DOWN) | 48 | #define LIST_PGDN (BUTTON_ON | BUTTON_DOWN) |
49 | |||
50 | #ifdef CONFIG_REMOTE_KEYPAD | ||
46 | #define LIST_RC_NEXT BUTTON_RC_RIGHT | 51 | #define LIST_RC_NEXT BUTTON_RC_RIGHT |
47 | #define LIST_RC_PREV BUTTON_RC_LEFT | 52 | #define LIST_RC_PREV BUTTON_RC_LEFT |
53 | #endif /* CONFIG_REMOTE_KEYPAD */ | ||
48 | 54 | ||
49 | #elif CONFIG_KEYPAD == PLAYER_PAD | 55 | #elif CONFIG_KEYPAD == PLAYER_PAD |
50 | #define LIST_NEXT BUTTON_RIGHT | 56 | #define LIST_NEXT BUTTON_RIGHT |
51 | #define LIST_PREV BUTTON_LEFT | 57 | #define LIST_PREV BUTTON_LEFT |
58 | |||
59 | #ifdef CONFIG_REMOTE_KEYPAD | ||
52 | #define LIST_RC_NEXT BUTTON_RC_RIGHT | 60 | #define LIST_RC_NEXT BUTTON_RC_RIGHT |
53 | #define LIST_RC_PREV BUTTON_RC_LEFT | 61 | #define LIST_RC_PREV BUTTON_RC_LEFT |
62 | #endif /* CONFIG_REMOTE_KEYPAD */ | ||
54 | 63 | ||
55 | #elif CONFIG_KEYPAD == ONDIO_PAD | 64 | #elif CONFIG_KEYPAD == ONDIO_PAD |
56 | #define LIST_NEXT BUTTON_DOWN | 65 | #define LIST_NEXT BUTTON_DOWN |
@@ -73,8 +82,21 @@ | |||
73 | * tells it what to display. | 82 | * tells it what to display. |
74 | * There are two callback function : | 83 | * There are two callback function : |
75 | * one to get the text and one to get the icon | 84 | * one to get the text and one to get the icon |
76 | * Callback interface : | 85 | */ |
77 | * | 86 | |
87 | /* | ||
88 | * Icon callback | ||
89 | * - selected_item : an integer that tells the number of the item to display | ||
90 | * - data : a void pointer to the data you gave to the list when | ||
91 | * you initialized it | ||
92 | * - icon : a pointer to the icon, the value inside it is used to display | ||
93 | * the icon after the function returns. | ||
94 | * Note : we use the ICON type because the real type depends of the plateform | ||
95 | */ | ||
96 | typedef void list_get_icon(int selected_item, | ||
97 | void * data, | ||
98 | ICON * icon); | ||
99 | /* | ||
78 | * Text callback | 100 | * Text callback |
79 | * - selected_item : an integer that tells the number of the item to display | 101 | * - selected_item : an integer that tells the number of the item to display |
80 | * - data : a void pointer to the data you gave to the list when | 102 | * - data : a void pointer to the data you gave to the list when |
@@ -84,15 +106,11 @@ | |||
84 | * the return value of the function in all cases to avoid filling | 106 | * the return value of the function in all cases to avoid filling |
85 | * a buffer when it's not necessary) | 107 | * a buffer when it's not necessary) |
86 | * Returns a pointer to a string that contains the text to display | 108 | * Returns a pointer to a string that contains the text to display |
87 | * | ||
88 | * Icon callback | ||
89 | * - selected_item : an integer that tells the number of the item to display | ||
90 | * - data : a void pointer to the data you gave to the list when | ||
91 | * you initialized it | ||
92 | * - icon : a pointer to the icon, the value inside it is used to display | ||
93 | * the icon after the function returns. | ||
94 | * Note : we use the ICON type because the real type depends of the plateform | ||
95 | */ | 109 | */ |
110 | typedef char * list_get_name(int selected_item, | ||
111 | void * data, | ||
112 | char *buffer); | ||
113 | |||
96 | struct gui_list | 114 | struct gui_list |
97 | { | 115 | { |
98 | int nb_items; | 116 | int nb_items; |
@@ -100,13 +118,10 @@ struct gui_list | |||
100 | bool cursor_flash_state; | 118 | bool cursor_flash_state; |
101 | int start_item; /* the item that is displayed at the top of the screen */ | 119 | int start_item; /* the item that is displayed at the top of the screen */ |
102 | 120 | ||
103 | void (*callback_get_item_icon) | 121 | list_get_icon *callback_get_item_icon; |
104 | (int selected_item, void * data, ICON * icon); | 122 | list_get_name *callback_get_item_name; |
105 | char * (*callback_get_item_name) | ||
106 | (int selected_item, void * data, char *buffer); | ||
107 | 123 | ||
108 | struct screen * display; | 124 | struct screen * display; |
109 | int line_scroll_limit; | ||
110 | /* defines wether the list should stop when reaching the top/bottom | 125 | /* defines wether the list should stop when reaching the top/bottom |
111 | * or should continue (by going to bottom/top) */ | 126 | * or should continue (by going to bottom/top) */ |
112 | bool limit_scroll; | 127 | bool limit_scroll; |
@@ -123,10 +138,8 @@ struct gui_list | |||
123 | * to a given item number | 138 | * to a given item number |
124 | */ | 139 | */ |
125 | extern void gui_list_init(struct gui_list * gui_list, | 140 | extern void gui_list_init(struct gui_list * gui_list, |
126 | void (*callback_get_item_icon) | 141 | list_get_icon callback_get_item_icon, |
127 | (int selected_item, void * data, ICON * icon), | 142 | list_get_name callback_get_item_name, |
128 | char * (*callback_get_item_name) | ||
129 | (int selected_item, void * data, char *buffer), | ||
130 | void * data | 143 | void * data |
131 | ); | 144 | ); |
132 | 145 | ||
@@ -264,10 +277,8 @@ struct gui_synclist | |||
264 | 277 | ||
265 | extern void gui_synclist_init( | 278 | extern void gui_synclist_init( |
266 | struct gui_synclist * lists, | 279 | struct gui_synclist * lists, |
267 | void (*callback_get_item_icon) | 280 | list_get_icon callback_get_item_icon, |
268 | (int selected_item, void * data, ICON * icon), | 281 | list_get_name callback_get_item_name, |
269 | char * (*callback_get_item_name) | ||
270 | (int selected_item, void * data, char *buffer), | ||
271 | void * data | 282 | void * data |
272 | ); | 283 | ); |
273 | extern void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items); | 284 | extern void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items); |
@@ -295,10 +306,13 @@ extern void gui_synclist_flash(struct gui_synclist * lists); | |||
295 | 306 | ||
296 | /* | 307 | /* |
297 | * Do the action implied by the given button, | 308 | * Do the action implied by the given button, |
298 | * returns true if something has been done, false otherwise | 309 | * returns the action taken if any, 0 else |
299 | * - lists : the synchronized lists | 310 | * - lists : the synchronized lists |
300 | * - button : the keycode of a pressed button | 311 | * - button : the keycode of a pressed button |
312 | * returned value : | ||
313 | * - LIST_NEXT when moving forward (next item or pgup) | ||
314 | * - LIST_PREV when moving backward (previous item or pgdown) | ||
301 | */ | 315 | */ |
302 | extern bool gui_synclist_do_button(struct gui_synclist * lists, unsigned button); | 316 | extern unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button); |
303 | 317 | ||
304 | #endif /* _GUI_LIST_H_ */ | 318 | #endif /* _GUI_LIST_H_ */ |