diff options
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/list.c | 24 | ||||
-rw-r--r-- | apps/gui/list.h | 11 |
2 files changed, 28 insertions, 7 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index 0653343604..1f23ca5e68 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -720,18 +720,32 @@ void gui_synclist_scroll_left(struct gui_synclist * lists) | |||
720 | } | 720 | } |
721 | #endif /* HAVE_LCD_BITMAP */ | 721 | #endif /* HAVE_LCD_BITMAP */ |
722 | 722 | ||
723 | unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button) | 723 | unsigned gui_synclist_do_button(struct gui_synclist * lists, |
724 | unsigned button,enum list_wrap wrap) | ||
724 | { | 725 | { |
725 | #ifdef HAVE_LCD_BITMAP | 726 | #ifdef HAVE_LCD_BITMAP |
726 | static bool scrolling_left = false; | 727 | static bool scrolling_left = false; |
727 | #endif | 728 | #endif |
728 | 729 | ||
729 | gui_synclist_limit_scroll(lists, true); | 730 | switch (wrap) |
731 | { | ||
732 | case LIST_WRAP_ON: | ||
733 | gui_synclist_limit_scroll(lists, false); | ||
734 | break; | ||
735 | case LIST_WRAP_OFF: | ||
736 | gui_synclist_limit_scroll(lists, true); | ||
737 | break; | ||
738 | case LIST_WRAP_UNLESS_HELD: | ||
739 | if (button == ACTION_STD_PREVREPEAT || | ||
740 | button == ACTION_STD_NEXTREPEAT) | ||
741 | gui_synclist_limit_scroll(lists, true); | ||
742 | else gui_synclist_limit_scroll(lists, false); | ||
743 | break; | ||
744 | }; | ||
745 | |||
730 | switch(button) | 746 | switch(button) |
731 | { | 747 | { |
732 | case ACTION_STD_PREV: | 748 | case ACTION_STD_PREV: |
733 | gui_synclist_limit_scroll(lists, false); | ||
734 | |||
735 | case ACTION_STD_PREVREPEAT: | 749 | case ACTION_STD_PREVREPEAT: |
736 | gui_synclist_select_previous(lists); | 750 | gui_synclist_select_previous(lists); |
737 | gui_synclist_draw(lists); | 751 | gui_synclist_draw(lists); |
@@ -739,8 +753,6 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button) | |||
739 | return ACTION_STD_PREV; | 753 | return ACTION_STD_PREV; |
740 | 754 | ||
741 | case ACTION_STD_NEXT: | 755 | case ACTION_STD_NEXT: |
742 | gui_synclist_limit_scroll(lists, false); | ||
743 | |||
744 | case ACTION_STD_NEXTREPEAT: | 756 | case ACTION_STD_NEXTREPEAT: |
745 | gui_synclist_select_next(lists); | 757 | gui_synclist_select_next(lists); |
746 | gui_synclist_draw(lists); | 758 | gui_synclist_draw(lists); |
diff --git a/apps/gui/list.h b/apps/gui/list.h index 914563a597..e61780ffe3 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h | |||
@@ -26,6 +26,12 @@ | |||
26 | 26 | ||
27 | #define SCROLLBAR_WIDTH 6 | 27 | #define SCROLLBAR_WIDTH 6 |
28 | 28 | ||
29 | enum list_wrap { | ||
30 | LIST_WRAP_ON = 0, | ||
31 | LIST_WRAP_OFF, | ||
32 | LIST_WRAP_UNLESS_HELD, | ||
33 | }; | ||
34 | |||
29 | /* | 35 | /* |
30 | * The gui_list is based on callback functions, if you want the list | 36 | * The gui_list is based on callback functions, if you want the list |
31 | * to display something you have to provide it a function that | 37 | * to display something you have to provide it a function that |
@@ -312,10 +318,13 @@ void gui_synclist_scroll_left(struct gui_synclist * lists); | |||
312 | * returns the action taken if any, 0 else | 318 | * returns the action taken if any, 0 else |
313 | * - lists : the synchronized lists | 319 | * - lists : the synchronized lists |
314 | * - button : the keycode of a pressed button | 320 | * - button : the keycode of a pressed button |
321 | * - specifies weather to allow the list to wrap or not, values at top of page | ||
315 | * returned value : | 322 | * returned value : |
316 | * - ACTION_STD_NEXT when moving forward (next item or pgup) | 323 | * - ACTION_STD_NEXT when moving forward (next item or pgup) |
317 | * - ACTION_STD_PREV when moving backward (previous item or pgdown) | 324 | * - ACTION_STD_PREV when moving backward (previous item or pgdown) |
318 | */ | 325 | */ |
319 | extern unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button); | 326 | extern unsigned gui_synclist_do_button(struct gui_synclist * lists, |
327 | unsigned button, | ||
328 | enum list_wrap); | ||
320 | 329 | ||
321 | #endif /* _GUI_LIST_H_ */ | 330 | #endif /* _GUI_LIST_H_ */ |