diff options
Diffstat (limited to 'apps/gui/list.h')
-rw-r--r-- | apps/gui/list.h | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/apps/gui/list.h b/apps/gui/list.h index 021f55ef94..d0bc59b7bc 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h | |||
@@ -36,34 +36,43 @@ enum list_wrap { | |||
36 | * The gui_list is based on callback functions, if you want the list | 36 | * The gui_list is based on callback functions, if you want the list |
37 | * to display something you have to provide it a function that | 37 | * to display something you have to provide it a function that |
38 | * tells it what to display. | 38 | * tells it what to display. |
39 | * There are two callback function : | 39 | * There are three callback function : |
40 | * one to get the text and one to get the icon | 40 | * one to get the text, one to get the icon and one to get the color |
41 | */ | 41 | */ |
42 | 42 | ||
43 | /* | 43 | /* |
44 | * Icon callback | 44 | * Icon callback |
45 | * - selected_item : an integer that tells the number of the item to display | 45 | * - selected_item : an integer that tells the number of the item to display |
46 | * - data : a void pointer to the data you gave to the list when | 46 | * - data : a void pointer to the data you gave to the list when you |
47 | * you initialized it | 47 | * initialized it |
48 | * - icon : a pointer to the icon, the value inside it is used to display | 48 | * Returns a pointer to the icon, the value inside it is used to display the |
49 | * the icon after the function returns. | 49 | * icon after the function returns. |
50 | * Note : we use the ICON type because the real type depends of the plateform | 50 | * Note : we use the ICON type because the real type depends of the plateform |
51 | */ | 51 | */ |
52 | typedef enum themable_icons list_get_icon(int selected_item, void * data); | 52 | typedef enum themable_icons list_get_icon(int selected_item, void * data); |
53 | /* | 53 | /* |
54 | * Text callback | 54 | * Text callback |
55 | * - selected_item : an integer that tells the number of the item to display | 55 | * - selected_item : an integer that tells the number of the item to display |
56 | * - data : a void pointer to the data you gave to the list when | 56 | * - data : a void pointer to the data you gave to the list when you |
57 | * you initialized it | 57 | * initialized it |
58 | * - buffer : a buffer to put the resulting text on it | 58 | * - buffer : a buffer to put the resulting text on it |
59 | * (The content of the buffer may not be used by the list, we use | 59 | * (The content of the buffer may not be used by the list, we use |
60 | * the return value of the function in all cases to avoid filling | 60 | * the return value of the function in all cases to avoid filling |
61 | * a buffer when it's not necessary) | 61 | * a buffer when it's not necessary) |
62 | * Returns a pointer to a string that contains the text to display | 62 | * Returns a pointer to a string that contains the text to display |
63 | */ | 63 | */ |
64 | typedef char * list_get_name(int selected_item, | 64 | typedef char * list_get_name(int selected_item, void * data, char * buffer); |
65 | void * data, | 65 | #ifdef HAVE_LCD_COLOR |
66 | char *buffer); | 66 | /* |
67 | * Color callback | ||
68 | * - selected_item : an integer that tells the number of the item to display | ||
69 | * - data : a void pointer to the data you gave to the list when you | ||
70 | * initialized it | ||
71 | * Returns an int with the lower 16 bits representing the color to display the | ||
72 | * selected item, negative value for default coloring. | ||
73 | */ | ||
74 | typedef int list_get_color(int selected_item, void * data); | ||
75 | #endif | ||
67 | 76 | ||
68 | struct gui_list | 77 | struct gui_list |
69 | { | 78 | { |
@@ -101,6 +110,11 @@ struct gui_list | |||
101 | /* Optional title icon */ | 110 | /* Optional title icon */ |
102 | enum themable_icons title_icon; | 111 | enum themable_icons title_icon; |
103 | bool show_selection_marker; /* set to true by default */ | 112 | bool show_selection_marker; /* set to true by default */ |
113 | |||
114 | #ifdef HAVE_LCD_COLOR | ||
115 | int title_color; | ||
116 | list_get_color *callback_get_item_color; | ||
117 | #endif | ||
104 | }; | 118 | }; |
105 | 119 | ||
106 | /* | 120 | /* |
@@ -127,6 +141,16 @@ struct gui_list | |||
127 | #define gui_list_set_icon_callback(gui_list, _callback) \ | 141 | #define gui_list_set_icon_callback(gui_list, _callback) \ |
128 | (gui_list)->callback_get_item_icon=_callback | 142 | (gui_list)->callback_get_item_icon=_callback |
129 | 143 | ||
144 | #ifdef HAVE_LCD_COLOR | ||
145 | /* | ||
146 | * Sets the color callback function | ||
147 | * - gui_list : the list structure | ||
148 | * - _callback : the callback function | ||
149 | */ | ||
150 | #define gui_list_set_color_callback(gui_list, _callback) \ | ||
151 | (gui_list)->callback_get_item_color=_callback | ||
152 | #endif | ||
153 | |||
130 | /* | 154 | /* |
131 | * Gives the position of the selected item | 155 | * Gives the position of the selected item |
132 | * - gui_list : the list structure | 156 | * - gui_list : the list structure |