Create menu_list_entry_is_currently_selected

This commit is contained in:
twinaphex 2015-05-07 09:56:11 +02:00
parent ed3f7ccf7c
commit f9713ab764
5 changed files with 15 additions and 6 deletions

View File

@ -306,8 +306,7 @@ static void glui_render_menu_list(runloop_t *runloop,
bool selected = false;
menu_list_get_entry(&entry, i, label, NULL);
selected = (i == menu->navigation.selection_ptr);
selected = menu_list_entry_is_currently_selected(&entry);
menu_animation_ticker_line(entry_title_buf, glui->ticker_limit,
runloop->frames.video.count / 100, entry.path, selected);

View File

@ -494,8 +494,7 @@ static void rgui_render(void)
bool selected = false;
menu_list_get_entry(&entry, i, label, NULL);
selected = (i == menu->navigation.selection_ptr);
selected = menu_list_entry_is_currently_selected(&entry);
if (i > (menu->navigation.selection_ptr + 100))
continue;

View File

@ -235,8 +235,7 @@ static void rmenu_render(void)
bool selected = false;
menu_list_get_entry(&entry, i, label, NULL);
selected = (i == menu->navigation.selection_ptr);
selected = menu_list_entry_is_currently_selected(&entry);
menu_animation_ticker_line(entry_title_buf, RMENU_TERM_WIDTH - (entry.spacing + 1 + 2),
runloop->frames.video.count / 15, entry.path, selected);

View File

@ -475,6 +475,16 @@ void menu_list_get_entry(menu_entry_t *entry, size_t i,
entry_label, path,
entry->path, sizeof(entry->path));
entry->id = i;
if (entry_label)
strlcpy(entry->label, entry_label, sizeof(entry->label));
}
bool menu_list_entry_is_currently_selected(menu_entry_t *entry)
{
menu_navigation_t *nav = menu_navigation_get_ptr();
if (!entry || !nav)
return false;
return (entry->id == nav->selection_ptr);
}

View File

@ -110,6 +110,8 @@ int menu_list_populate_generic(file_list_t *list,
void menu_list_get_entry(menu_entry_t *entry, size_t i, const char *label,
void *userdata);
bool menu_list_entry_is_currently_selected(menu_entry_t *entry);
#ifdef __cplusplus
}
#endif