These changes are the raw update to qemu-2.6.
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / jumpscroll.h
1 #ifndef _IPXE_JUMPSCROLL_H
2 #define _IPXE_JUMPSCROLL_H
3
4 /** @file
5  *
6  * Jump scrolling
7  *
8  */
9
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11
12 /** A jump scroller */
13 struct jump_scroller {
14         /** Maximum number of visible rows */
15         unsigned int rows;
16         /** Total number of items */
17         unsigned int count;
18         /** Currently selected item */
19         unsigned int current;
20         /** First visible item */
21         unsigned int first;
22 };
23
24 /**
25  * Check if jump scroller is currently on first page
26  *
27  * @v scroll            Jump scroller
28  * @ret is_first        Scroller is currently on first page
29  */
30 static inline int jump_scroll_is_first ( struct jump_scroller *scroll ) {
31
32         return ( scroll->first == 0 );
33 }
34
35 /**
36  * Check if jump scroller is currently on last page
37  *
38  * @v scroll            Jump scroller
39  * @ret is_last         Scroller is currently on last page
40  */
41 static inline int jump_scroll_is_last ( struct jump_scroller *scroll ) {
42
43         return ( ( scroll->first + scroll->rows ) >= scroll->count );
44 }
45
46 extern int jump_scroll_key ( struct jump_scroller *scroll, int key );
47 extern int jump_scroll_move ( struct jump_scroller *scroll, int move );
48 extern int jump_scroll ( struct jump_scroller *scroll );
49
50 #endif /* _IPXE_JUMPSCROLL_H */