iPXE
jumpscroll.h
Go to the documentation of this file.
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 */
int jump_scroll_move(struct jump_scroller *scroll, int move)
Move scroller.
Definition: jumpscroll.c:78
A jump scroller.
Definition: jumpscroll.h:13
int jump_scroll(struct jump_scroller *scroll)
Jump scroll to new page (if applicable)
Definition: jumpscroll.c:119
unsigned int first
First visible item.
Definition: jumpscroll.h:21
unsigned int count
Total number of items.
Definition: jumpscroll.h:17
int jump_scroll_key(struct jump_scroller *scroll, int key)
Jump scrolling.
Definition: jumpscroll.c:42
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static int jump_scroll_is_last(struct jump_scroller *scroll)
Check if jump scroller is currently on last page.
Definition: jumpscroll.h:41
static int jump_scroll_is_first(struct jump_scroller *scroll)
Check if jump scroller is currently on first page.
Definition: jumpscroll.h:30
static int move(int y, int x)
Definition: curses.h:593
unsigned int rows
Maximum number of visible rows.
Definition: jumpscroll.h:15
unsigned int current
Currently selected item.
Definition: jumpscroll.h:19
union @375 key
Sense key.
Definition: scsi.h:18