fix(grid) rename column/row_template to column/row_dsc_array to add more meaning for binding generators
This commit is contained in:
@@ -11,8 +11,8 @@ void lv_example_grid_1(void)
|
||||
|
||||
/*Create a container with grid*/
|
||||
lv_obj_t * cont = lv_obj_create(lv_scr_act());
|
||||
lv_obj_set_style_grid_column_template(cont, col_dsc, 0);
|
||||
lv_obj_set_style_grid_row_template(cont, row_dsc, 0);
|
||||
lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0);
|
||||
lv_obj_set_style_grid_row_dsc_array(cont, row_dsc, 0);
|
||||
lv_obj_set_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
lv_obj_set_layout(cont, LV_LAYOUT_GRID);
|
||||
|
||||
@@ -12,7 +12,7 @@ void lv_example_grid_2(void)
|
||||
|
||||
/*Create a container with grid*/
|
||||
lv_obj_t * cont = lv_obj_create(lv_scr_act());
|
||||
lv_obj_set_grid_template(cont, col_dsc, row_dsc);
|
||||
lv_obj_set_grid_dsc_array(cont, col_dsc, row_dsc);
|
||||
lv_obj_set_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ void lv_example_grid_3(void)
|
||||
lv_obj_t * cont = lv_obj_create(lv_scr_act());
|
||||
lv_obj_set_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
lv_obj_set_grid_template(cont, col_dsc, row_dsc);
|
||||
lv_obj_set_grid_dsc_array(cont, col_dsc, row_dsc);
|
||||
|
||||
lv_obj_t * label;
|
||||
lv_obj_t * obj;
|
||||
|
||||
@@ -15,7 +15,7 @@ void lv_example_grid_4(void)
|
||||
/*Create a container with grid*/
|
||||
lv_obj_t * cont = lv_obj_create(lv_scr_act());
|
||||
lv_obj_set_grid_place(cont, LV_GRID_SPACE_BETWEEN, LV_GRID_END);
|
||||
lv_obj_set_grid_template(cont, col_dsc, row_dsc);
|
||||
lv_obj_set_grid_dsc_array(cont, col_dsc, row_dsc);
|
||||
lv_obj_set_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ void lv_example_grid_5(void)
|
||||
lv_obj_t * cont = lv_obj_create(lv_scr_act());
|
||||
lv_obj_set_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
lv_obj_set_grid_template(cont, col_dsc, row_dsc);
|
||||
lv_obj_set_grid_dsc_array(cont, col_dsc, row_dsc);
|
||||
|
||||
lv_obj_t * label;
|
||||
lv_obj_t * obj;
|
||||
|
||||
@@ -15,7 +15,7 @@ void lv_example_grid_6(void)
|
||||
lv_obj_set_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
lv_obj_set_base_dir(cont, LV_BIDI_DIR_RTL);
|
||||
lv_obj_set_grid_template(cont, col_dsc, row_dsc);
|
||||
lv_obj_set_grid_dsc_array(cont, col_dsc, row_dsc);
|
||||
|
||||
lv_obj_t * label;
|
||||
lv_obj_t * obj;
|
||||
|
||||
@@ -57,24 +57,24 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t *
|
||||
static lv_coord_t grid_place(lv_coord_t cont_size, bool auto_size, uint8_t place, lv_coord_t gap, uint32_t track_num, lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse);
|
||||
static uint32_t count_tracks(const lv_coord_t * templ);
|
||||
|
||||
static inline const lv_coord_t * get_col_templ(lv_obj_t * obj) {return lv_obj_get_style_grid_column_template(obj, LV_PART_MAIN); }
|
||||
static inline const lv_coord_t * get_row_templ(lv_obj_t * obj) {return lv_obj_get_style_grid_row_template(obj, LV_PART_MAIN); }
|
||||
static inline uint8_t get_col_pos(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_column_pos(obj, LV_PART_MAIN); }
|
||||
static inline uint8_t get_row_pos(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_row_pos(obj, LV_PART_MAIN); }
|
||||
static inline uint8_t get_col_span(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_column_span(obj, LV_PART_MAIN); }
|
||||
static inline uint8_t get_row_span(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_row_span(obj, LV_PART_MAIN); }
|
||||
static inline uint8_t get_cell_col_place(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_x_place(obj, LV_PART_MAIN); }
|
||||
static inline uint8_t get_cell_row_place(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_y_place(obj, LV_PART_MAIN); }
|
||||
static inline uint8_t get_grid_col_place(lv_obj_t * obj) {return lv_obj_get_style_grid_column_place(obj, LV_PART_MAIN); }
|
||||
static inline uint8_t get_grid_row_place(lv_obj_t * obj) {return lv_obj_get_style_grid_row_place(obj, LV_PART_MAIN); }
|
||||
static inline const lv_coord_t * get_col_dsc(lv_obj_t * obj) {return lv_obj_get_style_grid_column_dsc_array(obj, 0); }
|
||||
static inline const lv_coord_t * get_row_dsc(lv_obj_t * obj) {return lv_obj_get_style_grid_row_dsc_array(obj, 0); }
|
||||
static inline uint8_t get_col_pos(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_column_pos(obj, 0); }
|
||||
static inline uint8_t get_row_pos(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_row_pos(obj, 0); }
|
||||
static inline uint8_t get_col_span(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_column_span(obj, 0); }
|
||||
static inline uint8_t get_row_span(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_row_span(obj, 0); }
|
||||
static inline uint8_t get_cell_col_place(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_x_place(obj, 0); }
|
||||
static inline uint8_t get_cell_row_place(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_y_place(obj, 0); }
|
||||
static inline uint8_t get_grid_col_place(lv_obj_t * obj) {return lv_obj_get_style_grid_column_place(obj, 0); }
|
||||
static inline uint8_t get_grid_row_place(lv_obj_t * obj) {return lv_obj_get_style_grid_row_place(obj, 0); }
|
||||
|
||||
/**********************
|
||||
* GLOBAL VARIABLES
|
||||
**********************/
|
||||
uint32_t LV_LAYOUT_GRID;
|
||||
lv_style_prop_t LV_STYLE_GRID_COL_TEMPLATE;
|
||||
lv_style_prop_t LV_STYLE_GRID_COL_PLACE;
|
||||
lv_style_prop_t LV_STYLE_GRID_ROW_TEMPLATE;
|
||||
lv_style_prop_t LV_STYLE_GRID_COLUMN_DSC_ARRAY;
|
||||
lv_style_prop_t LV_STYLE_GRID_COLUMN_PLACE;
|
||||
lv_style_prop_t LV_STYLE_GRID_ROW_DSC_ARRAY;
|
||||
lv_style_prop_t LV_STYLE_GRID_ROW_PLACE;
|
||||
lv_style_prop_t LV_STYLE_GRID_CELL_COL_POS;
|
||||
lv_style_prop_t LV_STYLE_GRID_CELL_COL_SPAN;
|
||||
@@ -100,9 +100,9 @@ void lv_grid_init(void)
|
||||
{
|
||||
LV_LAYOUT_GRID = lv_layout_register(grid_update);
|
||||
|
||||
LV_STYLE_GRID_COL_TEMPLATE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
LV_STYLE_GRID_ROW_TEMPLATE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
LV_STYLE_GRID_COL_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
LV_STYLE_GRID_COLUMN_DSC_ARRAY = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
LV_STYLE_GRID_ROW_DSC_ARRAY = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
LV_STYLE_GRID_COLUMN_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
LV_STYLE_GRID_ROW_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
|
||||
LV_STYLE_GRID_CELL_ROW_SPAN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
@@ -113,10 +113,10 @@ void lv_grid_init(void)
|
||||
LV_STYLE_GRID_CELL_ROW_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
|
||||
}
|
||||
|
||||
void lv_obj_set_grid_template(lv_obj_t * obj, const lv_coord_t * col_templ, const lv_coord_t * row_templ)
|
||||
void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const lv_coord_t col_dsc[], const lv_coord_t row_dsc[])
|
||||
{
|
||||
lv_obj_set_style_grid_column_template(obj, col_templ, 0);
|
||||
lv_obj_set_style_grid_row_template(obj, row_templ, 0);
|
||||
lv_obj_set_style_grid_column_dsc_array(obj, col_dsc, 0);
|
||||
lv_obj_set_style_grid_row_dsc_array(obj, row_dsc, 0);
|
||||
lv_obj_set_style_layout(obj, LV_LAYOUT_GRID, 0);
|
||||
}
|
||||
|
||||
@@ -150,8 +150,8 @@ static void grid_update(lv_obj_t * cont)
|
||||
{
|
||||
LV_LOG_INFO("update %p container", cont);
|
||||
|
||||
const lv_coord_t * col_templ = get_col_templ(cont);
|
||||
const lv_coord_t * row_templ = get_row_templ(cont);
|
||||
const lv_coord_t * col_templ = get_col_dsc(cont);
|
||||
const lv_coord_t * row_templ = get_row_dsc(cont);
|
||||
if(col_templ == NULL || row_templ == NULL) return;
|
||||
|
||||
_lv_grid_calc_t c;
|
||||
@@ -231,7 +231,7 @@ static void calc_free(_lv_grid_calc_t * calc)
|
||||
|
||||
static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c)
|
||||
{
|
||||
const lv_coord_t * col_templ = get_col_templ(cont);
|
||||
const lv_coord_t * col_templ = get_col_dsc(cont);
|
||||
lv_coord_t cont_w = lv_obj_get_width_fit(cont);
|
||||
|
||||
c->col_num = count_tracks(col_templ);
|
||||
@@ -295,7 +295,7 @@ static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c)
|
||||
static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c)
|
||||
{
|
||||
uint32_t i;
|
||||
const lv_coord_t * row_templ = get_row_templ(cont);
|
||||
const lv_coord_t * row_templ = get_row_dsc(cont);
|
||||
c->row_num = count_tracks(row_templ);
|
||||
c->y = lv_mem_buf_get(sizeof(lv_coord_t) * c->row_num);
|
||||
c->h = lv_mem_buf_get(sizeof(lv_coord_t) * c->row_num);
|
||||
|
||||
@@ -50,9 +50,9 @@ typedef enum {
|
||||
**********************/
|
||||
|
||||
extern uint32_t LV_LAYOUT_GRID;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_COL_TEMPLATE;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_COL_PLACE;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_ROW_TEMPLATE;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_COLUMN_DSC_ARRAY;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_COLUMN_PLACE;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_ROW_DSC_ARRAY;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_ROW_PLACE;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_CELL_COL_POS;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_CELL_COL_SPAN;
|
||||
@@ -67,7 +67,7 @@ extern lv_style_prop_t LV_STYLE_GRID_CELL_ROW_PLACE;
|
||||
|
||||
void lv_grid_init(void);
|
||||
|
||||
void lv_obj_set_grid_template(lv_obj_t * obj, const lv_coord_t * col_templ, const lv_coord_t * row_templ);
|
||||
void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const lv_coord_t col_templ[], const lv_coord_t row_templ[]);
|
||||
|
||||
void lv_obj_set_grid_place(lv_obj_t * obj, lv_grid_place_t hor_place, lv_grid_place_t ver_place);
|
||||
|
||||
@@ -92,20 +92,20 @@ static inline lv_coord_t lv_grid_fr(uint8_t x)
|
||||
return LV_GRID_FR(x);
|
||||
}
|
||||
|
||||
static inline void lv_style_set_grid_row_template(lv_style_t * style, const lv_coord_t value[])
|
||||
static inline void lv_style_set_grid_row_dsc_array(lv_style_t * style, const lv_coord_t value[])
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = (const void *)value
|
||||
};
|
||||
lv_style_set_prop(style, LV_STYLE_GRID_ROW_TEMPLATE, v);
|
||||
lv_style_set_prop(style, LV_STYLE_GRID_ROW_DSC_ARRAY, v);
|
||||
}
|
||||
|
||||
static inline void lv_style_set_grid_column_template(lv_style_t * style, const lv_coord_t value[])
|
||||
static inline void lv_style_set_grid_column_dsc_array(lv_style_t * style, const lv_coord_t value[])
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = (const void *)value
|
||||
};
|
||||
lv_style_set_prop(style, LV_STYLE_GRID_COL_TEMPLATE, v);
|
||||
lv_style_set_prop(style, LV_STYLE_GRID_COLUMN_DSC_ARRAY, v);
|
||||
}
|
||||
|
||||
static inline void lv_style_set_grid_row_place(lv_style_t * style, lv_grid_place_t value)
|
||||
@@ -121,7 +121,7 @@ static inline void lv_style_set_grid_col_place(lv_style_t * style, lv_grid_place
|
||||
lv_style_value_t v = {
|
||||
.num = (lv_grid_place_t)value
|
||||
};
|
||||
lv_style_set_prop(style, LV_STYLE_GRID_COL_PLACE, v);
|
||||
lv_style_set_prop(style, LV_STYLE_GRID_COLUMN_PLACE, v);
|
||||
}
|
||||
|
||||
|
||||
@@ -173,20 +173,20 @@ static inline void lv_style_set_grid_cell_y_place(lv_style_t * style, lv_coord_t
|
||||
lv_style_set_prop(style, LV_STYLE_GRID_CELL_ROW_PLACE, v);
|
||||
}
|
||||
|
||||
static inline void lv_obj_set_style_grid_row_template(lv_obj_t * obj, const lv_coord_t value[], lv_style_selector_t selector)
|
||||
static inline void lv_obj_set_style_grid_row_dsc_array(lv_obj_t * obj, const lv_coord_t value[], lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = (const void *)value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj,LV_STYLE_GRID_ROW_TEMPLATE, v, selector);
|
||||
lv_obj_set_local_style_prop(obj,LV_STYLE_GRID_ROW_DSC_ARRAY, v, selector);
|
||||
}
|
||||
|
||||
static inline void lv_obj_set_style_grid_column_template(lv_obj_t * obj, const lv_coord_t value[], lv_style_selector_t selector)
|
||||
static inline void lv_obj_set_style_grid_column_dsc_array(lv_obj_t * obj, const lv_coord_t value[], lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = (const void *)value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_COL_TEMPLATE, v, selector);
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_COLUMN_DSC_ARRAY, v, selector);
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ static inline void lv_obj_set_style_grid_column_place(lv_obj_t * obj, lv_grid_pl
|
||||
lv_style_value_t v = {
|
||||
.num = (int32_t) value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_COL_PLACE, v, selector);
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_COLUMN_PLACE, v, selector);
|
||||
}
|
||||
|
||||
|
||||
@@ -255,18 +255,15 @@ static inline void lv_obj_set_style_grid_cell_y_place(lv_obj_t * obj, lv_coord_t
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_ROW_PLACE, v, selector);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static inline const lv_coord_t * lv_obj_get_style_grid_row_template(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline const lv_coord_t * lv_obj_get_style_grid_row_dsc_array(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_TEMPLATE);
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_DSC_ARRAY);
|
||||
return (const lv_coord_t *)v.ptr;
|
||||
}
|
||||
|
||||
static inline const lv_coord_t * lv_obj_get_style_grid_column_template(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline const lv_coord_t * lv_obj_get_style_grid_column_dsc_array(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COL_TEMPLATE);
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_DSC_ARRAY);
|
||||
return (const lv_coord_t *)v.ptr;
|
||||
}
|
||||
|
||||
@@ -278,7 +275,7 @@ static inline lv_grid_place_t lv_obj_get_style_grid_row_place(const struct _lv_o
|
||||
|
||||
static inline lv_grid_place_t lv_obj_get_style_grid_column_place(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COL_PLACE);
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_PLACE);
|
||||
return (lv_grid_place_t)v.num;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user