1 /** 2 * @file lv_grid.h 3 * 4 */ 5 6 #ifndef LV_GRID_H 7 #define LV_GRID_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 #include "../../lv_conf_internal.h" 17 #include "../../misc/lv_area.h" 18 19 #if LV_USE_GRID 20 21 /********************* 22 * DEFINES 23 *********************/ 24 /** 25 * Can be used track size to make the track fill the free space. 26 * @param x how much space to take proportionally to other FR tracks 27 * @return a special track size 28 */ 29 #define LV_GRID_FR(x) (LV_COORD_MAX - 100 + x) 30 31 #define LV_GRID_CONTENT (LV_COORD_MAX - 101) 32 LV_EXPORT_CONST_INT(LV_GRID_CONTENT); 33 34 #define LV_GRID_TEMPLATE_LAST (LV_COORD_MAX) 35 LV_EXPORT_CONST_INT(LV_GRID_TEMPLATE_LAST); 36 37 /********************** 38 * TYPEDEFS 39 **********************/ 40 41 /*Can't include lv_obj.h because it includes this header file*/ 42 43 typedef enum { 44 LV_GRID_ALIGN_START, 45 LV_GRID_ALIGN_CENTER, 46 LV_GRID_ALIGN_END, 47 LV_GRID_ALIGN_STRETCH, 48 LV_GRID_ALIGN_SPACE_EVENLY, 49 LV_GRID_ALIGN_SPACE_AROUND, 50 LV_GRID_ALIGN_SPACE_BETWEEN, 51 } lv_grid_align_t; 52 53 /********************** 54 * GLOBAL VARIABLES 55 **********************/ 56 57 /********************** 58 * GLOBAL PROTOTYPES 59 **********************/ 60 61 void lv_grid_init(void); 62 63 void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const int32_t col_dsc[], const int32_t row_dsc[]); 64 65 void lv_obj_set_grid_align(lv_obj_t * obj, lv_grid_align_t column_align, lv_grid_align_t row_align); 66 67 /** 68 * Set the cell of an object. The object's parent needs to have grid layout, else nothing will happen 69 * @param obj pointer to an object 70 * @param column_align the vertical alignment in the cell. `LV_GRID_START/END/CENTER/STRETCH` 71 * @param col_pos column ID 72 * @param col_span number of columns to take (>= 1) 73 * @param row_align the horizontal alignment in the cell. `LV_GRID_START/END/CENTER/STRETCH` 74 * @param row_pos row ID 75 * @param row_span number of rows to take (>= 1) 76 */ 77 void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_align_t column_align, int32_t col_pos, int32_t col_span, 78 lv_grid_align_t row_align, int32_t row_pos, int32_t row_span); 79 80 /** 81 * Just a wrapper to `LV_GRID_FR` for bindings. 82 */ 83 int32_t lv_grid_fr(uint8_t x); 84 85 /********************** 86 * GLOBAL VARIABLES 87 **********************/ 88 89 /********************** 90 * MACROS 91 **********************/ 92 93 #endif /*LV_USE_GRID*/ 94 95 #ifdef __cplusplus 96 } /*extern "C"*/ 97 #endif 98 99 #endif /*LV_GRID_H*/ 100