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