1 /** 2 * @file lv_templ.c 3 * 4 */ 5 6 /********************* 7 * INCLUDES 8 *********************/ 9 10 /********************* 11 * DEFINES 12 *********************/ 13 14 /********************** 15 * TYPEDEFS 16 **********************/ 17 18 /*This typedef exists purely to keep -Wpedantic happy when the file is empty.*/ 19 /*It can be removed.*/ 20 typedef int _keep_pedantic_happy; 21 22 /********************** 23 * STATIC PROTOTYPES 24 **********************/ 25 26 /********************** 27 * STATIC VARIABLES 28 **********************/ 29 30 /********************** 31 * MACROS 32 **********************/ 33 34 /********************** 35 * GLOBAL FUNCTIONS 36 **********************/ 37 38 /********************** 39 * STATIC FUNCTIONS 40 **********************/ 41 /** 42 * @file lv_gridnav.h 43 * 44 */ 45 46 #ifndef LV_GRIDFOCUS_H 47 #define LV_GRIDFOCUS_H 48 49 #ifdef __cplusplus 50 extern "C" { 51 #endif 52 53 /********************* 54 * INCLUDES 55 *********************/ 56 #include "../../../core/lv_obj.h" 57 58 #if LV_USE_GRIDNAV 59 60 /********************* 61 * DEFINES 62 *********************/ 63 64 /********************** 65 * TYPEDEFS 66 **********************/ 67 typedef enum { 68 LV_GRIDNAV_CTRL_NONE = 0x0, 69 70 /** 71 * If there is no next/previous object in a direction, 72 * the focus goes to the object in the next/previous row (on left/right keys) 73 * or first/last row (on up/down keys) 74 */ 75 LV_GRIDNAV_CTRL_ROLLOVER = 0x1, 76 77 /** 78 * If an arrow is pressed and the focused object can be scrolled in that direction 79 * then it will be scrolled instead of going to the next/previous object. 80 * If there is no more room for scrolling the next/previous object will be focused normally */ 81 LV_GRIDNAV_CTRL_SCROLL_FIRST = 0x2, 82 83 } lv_gridnav_ctrl_t; 84 85 /********************** 86 * GLOBAL PROTOTYPES 87 **********************/ 88 89 /** 90 * Add grid navigation feature to an object. It expects the children to be arranged 91 * into a grid-like layout. Although it's not required to have pixel perfect alignment. 92 * This feature makes possible to use keys to navigate among the children and focus them. 93 * The keys other than arrows and press/release related events 94 * are forwarded to the focused child. 95 * @param obj pointer to an object on which navigation should be applied. 96 * @param ctrl control flags from `lv_gridnav_ctrl_t`. 97 */ 98 void lv_gridnav_add(lv_obj_t * obj, lv_gridnav_ctrl_t ctrl); 99 100 /** 101 * Remove the grid navigation support from an object 102 * @param obj pointer to an object 103 */ 104 void lv_gridnav_remove(lv_obj_t * obj); 105 106 /** 107 * Manually focus an object on gridnav container 108 * @param cont pointer to a gridnav container 109 * @param to_focus pointer to an object to focus 110 * @param anim_en LV_ANIM_ON/OFF 111 */ 112 void lv_gridnav_set_focused(lv_obj_t * cont, lv_obj_t * to_focus, lv_anim_enable_t anim_en); 113 114 /********************** 115 * MACROS 116 **********************/ 117 #endif /*LV_USE_GRIDNAV*/ 118 119 #ifdef __cplusplus 120 } /*extern "C"*/ 121 #endif 122 123 #endif /*LV_GRIDFOCUS_H*/ 124