diff options
Diffstat (limited to 'apps/gui/list.h')
-rw-r--r-- | apps/gui/list.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/apps/gui/list.h b/apps/gui/list.h index 9aaa18ed08..2de67f5219 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h | |||
@@ -223,5 +223,47 @@ extern void gui_synclist_hide_selection_marker(struct gui_synclist *lists, | |||
223 | extern bool gui_synclist_do_button(struct gui_synclist * lists, | 223 | extern bool gui_synclist_do_button(struct gui_synclist * lists, |
224 | unsigned *action, | 224 | unsigned *action, |
225 | enum list_wrap); | 225 | enum list_wrap); |
226 | |||
227 | /** Simplelist implementation. | ||
228 | USe this if you dont need to reimplement the list code, | ||
229 | and just need to show a list | ||
230 | **/ | ||
231 | |||
232 | struct simplelist_info { | ||
233 | char *title; /* title to show on the list */ | ||
234 | int count; /* number of items in the list, each item is selection_size high */ | ||
235 | char selection_size; /* list selection size, usually 1 */ | ||
236 | bool hide_selection; | ||
237 | bool scroll_all; | ||
238 | int (*action_callback)(int action, struct gui_synclist *lists); /* can be NULL */ | ||
239 | /* action_callback notes: | ||
240 | action == the action pressed by the user | ||
241 | _after_ gui_synclist_do_button returns. | ||
242 | lists == the lists sturct so the callack can get selection and count etc. */ | ||
243 | list_get_icon *get_icon; /* can be NULL */ | ||
244 | list_get_name *get_name; /* NULL if you're using simplelist_addline() */ | ||
245 | void *callback_data; /* data for callbacks */ | ||
246 | }; | ||
247 | |||
248 | #define SIMPLELIST_MAX_LINES 32 | ||
249 | #define SIMPLELIST_MAX_LINELENGTH 32 | ||
250 | |||
251 | /** The next three functions are used if the text is mostly static. | ||
252 | These should be called in the action callback for the list. | ||
253 | **/ | ||
254 | /* set the amount of lines shown in the list | ||
255 | Only needed if simplelist_info.get_name == NULL */ | ||
256 | void simplelist_set_line_count(int lines); | ||
257 | /* get the current amount of lines shown */ | ||
258 | int simplelist_get_line_count(void); | ||
259 | /* add/edit a line in the list. | ||
260 | if line_number > number of lines shown it adds the line, else it edits the line */ | ||
261 | #define SIMPLELIST_ADD_LINE (SIMPLELIST_MAX_LINES+1) | ||
262 | void simplelist_addline(int line_number, const char *fmt, ...); | ||
263 | |||
264 | /* show a list. | ||
265 | if list->action_callback != NULL it is called with the action ACTION_REDRAW | ||
266 | before the list is dislplayed for the first time */ | ||
267 | bool simplelist_show_list(struct simplelist_info *info); | ||
226 | 268 | ||
227 | #endif /* _GUI_LIST_H_ */ | 269 | #endif /* _GUI_LIST_H_ */ |