summaryrefslogtreecommitdiff
path: root/apps/gui/list.h
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-10-20 12:32:55 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-10-20 12:32:55 +0000
commit5f893be2a354bd569f5fcdf9dda12d9333de16ea (patch)
treef505fd680a03b425b597b389aa778ea37a86d9b7 /apps/gui/list.h
parentf4d39b32892945c18e76378293f20f8296e10599 (diff)
downloadrockbox-5f893be2a354bd569f5fcdf9dda12d9333de16ea.tar.gz
rockbox-5f893be2a354bd569f5fcdf9dda12d9333de16ea.zip
add a list API for simple lists which dont need lots of code to run.
Example uses in debug_menu.c This API works best if most of the text is static, or not many actions need to acted on. (of course, any list could use this) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15221 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/list.h')
-rw-r--r--apps/gui/list.h42
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,
223extern bool gui_synclist_do_button(struct gui_synclist * lists, 223extern 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
232struct 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 */
256void simplelist_set_line_count(int lines);
257/* get the current amount of lines shown */
258int 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)
262void 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 */
267bool simplelist_show_list(struct simplelist_info *info);
226 268
227#endif /* _GUI_LIST_H_ */ 269#endif /* _GUI_LIST_H_ */