iPXE
jumpscroll.h
Go to the documentation of this file.
00001 #ifndef _IPXE_JUMPSCROLL_H
00002 #define _IPXE_JUMPSCROLL_H
00003 
00004 /** @file
00005  *
00006  * Jump scrolling
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 /** A jump scroller */
00013 struct jump_scroller {
00014         /** Maximum number of visible rows */
00015         unsigned int rows;
00016         /** Total number of items */
00017         unsigned int count;
00018         /** Currently selected item */
00019         unsigned int current;
00020         /** First visible item */
00021         unsigned int first;
00022 };
00023 
00024 /**
00025  * Check if jump scroller is currently on first page
00026  *
00027  * @v scroll            Jump scroller
00028  * @ret is_first        Scroller is currently on first page
00029  */
00030 static inline int jump_scroll_is_first ( struct jump_scroller *scroll ) {
00031 
00032         return ( scroll->first == 0 );
00033 }
00034 
00035 /**
00036  * Check if jump scroller is currently on last page
00037  *
00038  * @v scroll            Jump scroller
00039  * @ret is_last         Scroller is currently on last page
00040  */
00041 static inline int jump_scroll_is_last ( struct jump_scroller *scroll ) {
00042 
00043         return ( ( scroll->first + scroll->rows ) >= scroll->count );
00044 }
00045 
00046 extern int jump_scroll_key ( struct jump_scroller *scroll, int key );
00047 extern int jump_scroll_move ( struct jump_scroller *scroll, int move );
00048 extern int jump_scroll ( struct jump_scroller *scroll );
00049 
00050 #endif /* _IPXE_JUMPSCROLL_H */