allow simplelists to set the timeout and the start selection.
set a slightly saner default timeout talk the selected item when the list is first displayed git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15247 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c1051549b9
commit
0465101f92
3 changed files with 13 additions and 2 deletions
|
@ -1880,6 +1880,7 @@ static bool dbg_tagcache_info(void)
|
|||
simplelist_info_init(&info, "Database Info", 8, NULL);
|
||||
info.action_callback = database_callback;
|
||||
info.hide_selection = true;
|
||||
info.timeout = TIMEOUT_NOBLOCK;
|
||||
tagcache_screensync_enable(true);
|
||||
return simplelist_show_list(&info);
|
||||
}
|
||||
|
|
|
@ -1179,13 +1179,17 @@ bool simplelist_show_list(struct simplelist_info *info)
|
|||
gui_synclist_set_nb_items(&lists, simplelist_line_count*info->selection_size);
|
||||
else
|
||||
gui_synclist_set_nb_items(&lists, info->count*info->selection_size);
|
||||
|
||||
|
||||
gui_synclist_select_item(&lists, info->start_selection);
|
||||
|
||||
if (info->get_talk)
|
||||
info->get_talk(gui_synclist_get_sel_pos(&lists), info->callback_data);
|
||||
gui_synclist_draw(&lists);
|
||||
|
||||
while(1)
|
||||
{
|
||||
gui_syncstatusbar_draw(&statusbars, true);
|
||||
action = get_action(CONTEXT_STD, HZ/100);
|
||||
action = get_action(CONTEXT_STD, info->timeout);
|
||||
if (gui_synclist_do_button(&lists, &action, LIST_WRAP_UNLESS_HELD))
|
||||
continue;
|
||||
if (info->action_callback)
|
||||
|
@ -1218,6 +1222,8 @@ void simplelist_info_init(struct simplelist_info *info, char* title,
|
|||
info->selection_size = 1;
|
||||
info->hide_selection = false;
|
||||
info->scroll_all = false;
|
||||
info->timeout = HZ/10;
|
||||
info->start_selection = 0;
|
||||
info->action_callback = NULL;
|
||||
info->get_icon = NULL;
|
||||
info->get_name = NULL;
|
||||
|
|
|
@ -267,6 +267,8 @@ struct simplelist_info {
|
|||
char selection_size; /* list selection size, usually 1 */
|
||||
bool hide_selection;
|
||||
bool scroll_all;
|
||||
int timeout;
|
||||
int start_selection; /* the item to select when the list is first displayed */
|
||||
int (*action_callback)(int action, struct gui_synclist *lists); /* can be NULL */
|
||||
/* action_callback notes:
|
||||
action == the action pressed by the user
|
||||
|
@ -303,6 +305,8 @@ void simplelist_addline(int line_number, const char *fmt, ...);
|
|||
info.get_icon = NULL;
|
||||
info.get_name = NULL;
|
||||
info.get_voice = NULL;
|
||||
info.timeout = HZ/10;
|
||||
info.start_selection = 0;
|
||||
*/
|
||||
void simplelist_info_init(struct simplelist_info *info, char* title,
|
||||
int count, void* data);
|
||||
|
|
Loading…
Reference in a new issue