}
size_t badge_menu(char const *const *menu,
- size_t n,
- size_t first_visible,
- size_t selected)
+ size_t n,
+ size_t *first_visible,
+ size_t selected)
{
for(;;) {
- badge_menu_show(menu, n, first_visible, selected);
+ badge_menu_show(menu, n, *first_visible, selected);
badge_event_t ev;
return selected;
} else if((new_buttons & BADGE_EVENT_KEY_UP ) && selected != 0) {
--selected;
- if(first_visible != 0 && selected <= first_visible) {
- first_visible = selected - 1;
+ if(*first_visible != 0 && selected <= *first_visible) {
+ *first_visible = selected - 1;
}
} else if(new_buttons & BADGE_EVENT_KEY_DOWN && selected + 1 < n) {
++selected;
- if(first_visible + (MENU_ENTRIES_VISIBLE - 2 + (selected + 1 == n)) < selected) {
- first_visible = selected - (MENU_ENTRIES_VISIBLE - 2 + (selected + 1 == n));
+ if(*first_visible + (MENU_ENTRIES_VISIBLE - 2 + (selected + 1 == n)) < selected) {
+ *first_visible = selected - (MENU_ENTRIES_VISIBLE - 2 + (selected + 1 == n));
}
}
}