mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
remove margin
This commit is contained in:
parent
d027a4f00f
commit
68b27f6077
@ -200,8 +200,8 @@ static int32_t find_track_end(lv_obj_t * cont, int32_t item_start_id, lv_coord_t
|
||||
const lv_flex_t * f = cont->spec_attr->layout_dsc;
|
||||
|
||||
bool row = f->dir == LV_FLEX_FLOW_ROW ? true : false;
|
||||
lv_coord_t(*get_main_size)(const lv_obj_t *) = (row ? lv_obj_get_width_margin : lv_obj_get_height_margin);
|
||||
lv_coord_t(*get_cross_size)(const lv_obj_t *) = (!row ? lv_obj_get_width_margin : lv_obj_get_height_margin);
|
||||
lv_coord_t(*get_main_size)(const lv_obj_t *) = (row ? lv_obj_get_width : lv_obj_get_height);
|
||||
lv_coord_t(*get_cross_size)(const lv_obj_t *) = (!row ? lv_obj_get_width : lv_obj_get_height);
|
||||
|
||||
lv_coord_t grow_sum = 0;
|
||||
t->track_main_size = 0;
|
||||
@ -261,12 +261,9 @@ static void children_repos(lv_obj_t * cont, int32_t item_first_id, int32_t item_
|
||||
const lv_flex_t * f = cont->spec_attr->layout_dsc;
|
||||
bool row = f->dir == LV_FLEX_FLOW_ROW ? true : false;
|
||||
|
||||
lv_coord_t(*obj_get_main_size)(const lv_obj_t *) = (row ? lv_obj_get_width_margin : lv_obj_get_height_margin);
|
||||
lv_coord_t(*obj_get_cross_size)(const lv_obj_t *) = (!row ? lv_obj_get_width_margin : lv_obj_get_height_margin);
|
||||
void (*area_set_main_size)(lv_area_t *, lv_coord_t) = (row ? lv_area_set_width : lv_area_set_height);
|
||||
lv_coord_t (*area_get_main_size)(const lv_area_t *) = (!row ? lv_area_get_width : lv_area_get_height);
|
||||
lv_coord_t (*get_margin_start)(const lv_obj_t *, uint32_t part) = (row ? lv_obj_get_style_margin_left : lv_obj_get_style_margin_top);
|
||||
lv_coord_t (*get_margin_end)(const lv_obj_t *, uint32_t part) = (row ? lv_obj_get_style_margin_right : lv_obj_get_style_margin_bottom);
|
||||
lv_coord_t (*area_get_main_size)(const lv_area_t *) = (row ? lv_area_get_width : lv_area_get_height);
|
||||
lv_coord_t (*area_get_cross_size)(const lv_area_t *) = (!row ? lv_area_get_width : lv_area_get_height);
|
||||
|
||||
bool rtl = lv_obj_get_base_dir(cont) == LV_BIDI_DIR_RTL ? true : false;
|
||||
|
||||
@ -286,7 +283,6 @@ static void children_repos(lv_obj_t * cont, int32_t item_first_id, int32_t item_
|
||||
lv_area_copy(&old_coords, &item->coords);
|
||||
|
||||
lv_coord_t s = _LV_FLEX_GET_GROW(main_size) * t->grow_unit;
|
||||
s -= get_margin_start(item, LV_PART_MAIN) + get_margin_end(item, LV_PART_MAIN);
|
||||
area_set_main_size(&item->coords, s);
|
||||
|
||||
if(lv_area_get_height(&old_coords) != area_get_main_size(&item->coords)) {
|
||||
@ -299,17 +295,17 @@ static void children_repos(lv_obj_t * cont, int32_t item_first_id, int32_t item_
|
||||
lv_coord_t cross_pos = 0;
|
||||
switch(f->item_cross_place) {
|
||||
case LV_FLEX_PLACE_CENTER:
|
||||
cross_pos = (t->track_cross_size - obj_get_cross_size(item)) / 2;
|
||||
cross_pos = (t->track_cross_size - area_get_cross_size(&item->coords)) / 2;
|
||||
break;
|
||||
case LV_FLEX_PLACE_END:
|
||||
cross_pos = t->track_cross_size - obj_get_cross_size(item);
|
||||
cross_pos = t->track_cross_size - area_get_cross_size(&item->coords);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
lv_coord_t diff_x = abs_x - item->coords.x1 + lv_obj_get_style_margin_left(item, LV_PART_MAIN);
|
||||
lv_coord_t diff_y = abs_y - item->coords.y1 + lv_obj_get_style_margin_top(item, LV_PART_MAIN);
|
||||
lv_coord_t diff_x = abs_x - item->coords.x1;
|
||||
lv_coord_t diff_y = abs_y - item->coords.y1;
|
||||
diff_x += row ? main_pos : cross_pos;
|
||||
diff_y += row ? cross_pos : main_pos;
|
||||
|
||||
@ -322,7 +318,7 @@ static void children_repos(lv_obj_t * cont, int32_t item_first_id, int32_t item_
|
||||
}
|
||||
|
||||
if(!(row && rtl)) {
|
||||
main_pos += obj_get_main_size(item) + f->item_gap + place_gap;
|
||||
main_pos += area_get_main_size(&item->coords) + f->item_gap + place_gap;
|
||||
}
|
||||
item = get_next_item(cont, f->rev, &item_first_id);
|
||||
}
|
||||
|
@ -312,47 +312,42 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t *
|
||||
lv_coord_t item_w = lv_area_get_width(&item->coords);
|
||||
lv_coord_t item_h = lv_area_get_height(&item->coords);
|
||||
|
||||
lv_coord_t margin_top = lv_obj_get_style_margin_top(item, LV_PART_MAIN);
|
||||
lv_coord_t margin_bottom = lv_obj_get_style_margin_bottom(item, LV_PART_MAIN);
|
||||
lv_coord_t margin_left = lv_obj_get_style_margin_left(item, LV_PART_MAIN);
|
||||
lv_coord_t margin_right = lv_obj_get_style_margin_right(item, LV_PART_MAIN);
|
||||
|
||||
if(item->w_set == LV_SIZE_LAYOUT) item->w_set = item_w;
|
||||
if(item->h_set == LV_SIZE_LAYOUT) item->h_set = item_h;
|
||||
|
||||
switch(x_flag) {
|
||||
default:
|
||||
case LV_GRID_START:
|
||||
x = c->x[col_pos] + margin_left;
|
||||
x = c->x[col_pos];
|
||||
break;
|
||||
case LV_GRID_STRETCH:
|
||||
x = c->x[col_pos] + margin_left;
|
||||
item_w = col_w - margin_left - margin_right;
|
||||
x = c->x[col_pos];
|
||||
item_w = col_w;
|
||||
item->w_set = LV_SIZE_LAYOUT;
|
||||
break;
|
||||
case LV_GRID_CENTER:
|
||||
x = c->x[col_pos] + (col_w - (item_w + margin_left - margin_right)) / 2;
|
||||
x = c->x[col_pos] + (col_w - item_w) / 2;
|
||||
break;
|
||||
case LV_GRID_END:
|
||||
x = c->x[col_pos] + col_w - lv_obj_get_width(item) - margin_right;
|
||||
x = c->x[col_pos] + col_w - lv_obj_get_width(item);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(y_flag) {
|
||||
default:
|
||||
case LV_GRID_START:
|
||||
y = c->y[row_pos] + margin_top;
|
||||
y = c->y[row_pos];
|
||||
break;
|
||||
case LV_GRID_STRETCH:
|
||||
y = c->y[row_pos] + margin_top;
|
||||
item_h = row_h - margin_top - margin_bottom;
|
||||
y = c->y[row_pos];
|
||||
item_h = row_h;
|
||||
item->h_set = LV_SIZE_LAYOUT;
|
||||
break;
|
||||
case LV_GRID_CENTER:
|
||||
y = c->y[row_pos] + (row_h - (item_h + margin_top + margin_bottom)) / 2;
|
||||
y = c->y[row_pos] + (row_h - item_h) / 2;
|
||||
break;
|
||||
case LV_GRID_END:
|
||||
y = c->y[row_pos] + row_h - lv_obj_get_height(item) - margin_bottom;
|
||||
y = c->y[row_pos] + row_h - lv_obj_get_height(item);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -454,8 +454,8 @@ void _lv_obj_draw_scrollbar(lv_obj_t * obj, const lv_area_t * clip_area)
|
||||
|
||||
if(!hor_draw && !ver_draw) return;
|
||||
|
||||
lv_coord_t end_space = lv_obj_get_style_margin_top(obj, LV_PART_SCROLLBAR);
|
||||
lv_coord_t side_space = lv_obj_get_style_margin_right(obj, LV_PART_SCROLLBAR);
|
||||
lv_coord_t end_space = lv_obj_get_style_pad_top(obj, LV_PART_SCROLLBAR);
|
||||
lv_coord_t side_space = lv_obj_get_style_pad_right(obj, LV_PART_SCROLLBAR);
|
||||
lv_coord_t tickness = lv_obj_get_style_pad_left(obj, LV_PART_SCROLLBAR);
|
||||
|
||||
lv_coord_t obj_h = lv_obj_get_height(obj);
|
||||
|
@ -200,34 +200,6 @@ void lv_obj_set_content_height(lv_obj_t * obj, lv_coord_t h)
|
||||
lv_obj_set_height(obj, h + ptop + pbottom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the width of an object by taking the left and right margin into account.
|
||||
* The object width will be `obj_w = w - margin_left - margin_right`
|
||||
* @param obj pointer to an object
|
||||
* @param w new height including margins in pixels
|
||||
*/
|
||||
void lv_obj_set_width_margin(lv_obj_t * obj, lv_coord_t w)
|
||||
{
|
||||
lv_coord_t mleft = lv_obj_get_style_margin_left(obj, LV_PART_MAIN);
|
||||
lv_coord_t mright = lv_obj_get_style_margin_right(obj, LV_PART_MAIN);
|
||||
|
||||
lv_obj_set_width(obj, w - mleft - mright);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the height of an object by taking the top and bottom margin into account.
|
||||
* The object height will be `obj_h = h - margin_top - margin_bottom`
|
||||
* @param obj pointer to an object
|
||||
* @param h new height including margins in pixels
|
||||
*/
|
||||
void lv_obj_set_height_margin(lv_obj_t * obj, lv_coord_t h)
|
||||
{
|
||||
lv_coord_t mtop = lv_obj_get_style_margin_top(obj, LV_PART_MAIN);
|
||||
lv_coord_t mbottom = lv_obj_get_style_margin_bottom(obj, LV_PART_MAIN);
|
||||
|
||||
lv_obj_set_height(obj, h - mtop - mbottom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a layout for an object
|
||||
* @param obj pointer to an object
|
||||
@ -510,35 +482,6 @@ lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj)
|
||||
|
||||
return lv_obj_get_height(obj) - top - bottom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the height of an object by taking the top and bottom margin into account.
|
||||
* The returned height will be `obj_h + margin_top + margin_bottom`
|
||||
* @param obj pointer to an object
|
||||
* @return the height including the margins
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height_margin(const lv_obj_t * obj)
|
||||
{
|
||||
lv_coord_t mtop = lv_obj_get_style_margin_top(obj, LV_PART_MAIN);
|
||||
lv_coord_t mbottom = lv_obj_get_style_margin_bottom(obj, LV_PART_MAIN);
|
||||
|
||||
return lv_obj_get_height(obj) + mtop + mbottom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the width of an object by taking the left and right margin into account.
|
||||
* The returned width will be `obj_w + margin_left + margin_right`
|
||||
* @param obj pointer to an object
|
||||
* @return the height including the margins
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width_margin(const lv_obj_t * obj)
|
||||
{
|
||||
lv_coord_t mleft = lv_obj_get_style_margin_left(obj, LV_PART_MAIN);
|
||||
lv_coord_t mright = lv_obj_get_style_margin_right(obj, LV_PART_MAIN);
|
||||
|
||||
return lv_obj_get_width(obj) + mleft + mright;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the width of the virtual content of an object
|
||||
* @param obj pointer to an objects
|
||||
|
@ -101,22 +101,6 @@ void lv_obj_set_content_width(struct _lv_obj_t * obj, lv_coord_t w);
|
||||
*/
|
||||
void lv_obj_set_content_height(struct _lv_obj_t * obj, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Set the width of an object by taking the left and right margin into account.
|
||||
* The object width will be `obj_w = w - margin_left - margin_right`
|
||||
* @param obj pointer to an object
|
||||
* @param w new height including margins in pixels
|
||||
*/
|
||||
void lv_obj_set_width_margin(struct _lv_obj_t * obj, lv_coord_t w);
|
||||
|
||||
/**
|
||||
* Set the height of an object by taking the top and bottom margin into account.
|
||||
* The object height will be `obj_h = h - margin_top - margin_bottom`
|
||||
* @param obj pointer to an object
|
||||
* @param h new height including margins in pixels
|
||||
*/
|
||||
void lv_obj_set_height_margin(struct _lv_obj_t * obj, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Align an object to an other object.
|
||||
* @param obj pointer to an object to align
|
||||
@ -191,22 +175,6 @@ lv_coord_t lv_obj_get_width_fit(const struct _lv_obj_t * obj);
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height_fit(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the height of an object by taking the top and bottom margin into account.
|
||||
* The returned height will be `obj_h + margin_top + margin_bottom`
|
||||
* @param obj pointer to an object
|
||||
* @return the height including the margins
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height_margin(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the width of an object by taking the left and right margin into account.
|
||||
* The returned width will be `obj_w + margin_left + margin_right`
|
||||
* @param obj pointer to an object
|
||||
* @return the height including the margins
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width_margin(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the width of the virtual content of an object
|
||||
* @param obj pointer to an objects
|
||||
|
@ -130,7 +130,7 @@ lv_coord_t lv_obj_get_scroll_bottom(lv_obj_t * obj)
|
||||
uint32_t i;
|
||||
for(i = 0; i < lv_obj_get_child_cnt(obj); i++) {
|
||||
lv_obj_t * child = lv_obj_get_child(obj, i);
|
||||
child_res = LV_MATH_MAX(child_res, child->coords.y2 + lv_obj_get_style_margin_bottom(child, LV_PART_MAIN));
|
||||
child_res = LV_MATH_MAX(child_res, child->coords.y2);
|
||||
}
|
||||
|
||||
lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN);
|
||||
@ -165,7 +165,7 @@ lv_coord_t lv_obj_get_scroll_left(lv_obj_t * obj)
|
||||
lv_coord_t x1 = LV_COORD_MAX;
|
||||
for(i = 0; i < lv_obj_get_child_cnt(obj); i++) {
|
||||
lv_obj_t * child = lv_obj_get_child(obj, i);
|
||||
x1 = LV_MATH_MIN(x1, child->coords.x1 - lv_obj_get_style_margin_left(child, LV_PART_MAIN));
|
||||
x1 = LV_MATH_MIN(x1, child->coords.x1);
|
||||
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ lv_coord_t lv_obj_get_scroll_right(lv_obj_t * obj)
|
||||
uint32_t i;
|
||||
for(i = 0; i < lv_obj_get_child_cnt(obj); i++) {
|
||||
lv_obj_t * child = lv_obj_get_child(obj, i);
|
||||
child_res = LV_MATH_MAX(child_res, child->coords.x2 + lv_obj_get_style_margin_right(child, LV_PART_MAIN));
|
||||
child_res = LV_MATH_MAX(child_res, child->coords.x2);
|
||||
}
|
||||
|
||||
lv_coord_t pad_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN);
|
||||
|
@ -620,10 +620,6 @@ _lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t sta
|
||||
else if(style->pad_top || (style->ext && style->ext->has.pad_bottom)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(style->pad_left || (style->ext && style->ext->has.pad_bottom)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(style->pad_right || (style->ext && style->ext->has.pad_bottom)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(style->margin_bottom || (style->ext && style->ext->has.margin_bottom)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(style->margin_top || (style->ext && style->ext->has.margin_top)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(style->margin_left || (style->ext && style->ext->has.margin_left)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(style->margin_right || (style->ext && style->ext->has.margin_right)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
|
||||
if(res_tmp == _LV_STYLE_STATE_CMP_DIFF_LAYOUT) {
|
||||
if(list->styles[i].part == LV_PART_MAIN) return _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
@ -642,9 +638,9 @@ _lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t sta
|
||||
else if(style->outline_pad || (style->ext && style->ext->has.outline_pad)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->shadow_width|| (style->ext && style->ext->has.shadow_width)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->shadow_opa|| (style->ext && style->ext->has.shadow_opa)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->shadow_ofs_x|| (style->ext && style->ext->has.shadow_ofs_x)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->shadow_ofs_y|| (style->ext && style->ext->has.shadow_ofs_y)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->shadow_spread|| (style->ext && style->ext->has.shadow_spread)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has.shadow_ofs_x) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has.shadow_ofs_y) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has.shadow_spread) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->line_width || (style->ext && style->ext->has.line_width)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has.content_src) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has.content_ofs_x) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
@ -764,19 +760,6 @@ static void update_cache(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop)
|
||||
} else {
|
||||
list->cache_transform_zero = 0;
|
||||
}
|
||||
} if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_MARGIN_TOP || prop == LV_STYLE_MARGIN_BOTTOM ||
|
||||
prop == LV_STYLE_MARGIN_LEFT || prop == LV_STYLE_MARGIN_RIGHT) {
|
||||
lv_style_value_t vt[4];
|
||||
if(get_prop_core(obj, part, LV_STYLE_MARGIN_TOP, &vt[0]) == false) vt[0].num = 0;
|
||||
if(get_prop_core(obj, part, LV_STYLE_MARGIN_BOTTOM, &vt[1]) == false) vt[1].num = 0;
|
||||
if(get_prop_core(obj, part, LV_STYLE_MARGIN_LEFT, &vt[2]) == false) vt[2].num = 0;
|
||||
if(get_prop_core(obj, part, LV_STYLE_MARGIN_RIGHT, &vt[3]) == false) vt[3].num = 0;
|
||||
|
||||
if(vt[0].num == 0 && vt[1].num == 0 && vt[2].num == 0 && vt[3].num == 0) {
|
||||
list->cache_margin_zero = 1;
|
||||
} else {
|
||||
list->cache_margin_zero = 0;
|
||||
}
|
||||
}
|
||||
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_BG_BLEND_MODE) {
|
||||
if(get_prop_core(obj, part, LV_STYLE_BG_BLEND_MODE, &v) == false) v.num = 0;
|
||||
@ -918,13 +901,6 @@ static cache_t read_cache(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t
|
||||
if(list->cache_transform_zero ) return CACHE_ZERO;
|
||||
else return CACHE_NEED_CHECK;
|
||||
break;
|
||||
case LV_STYLE_MARGIN_TOP:
|
||||
case LV_STYLE_MARGIN_BOTTOM:
|
||||
case LV_STYLE_MARGIN_LEFT:
|
||||
case LV_STYLE_MARGIN_RIGHT:
|
||||
if(list->cache_margin_zero) return CACHE_ZERO;
|
||||
else return CACHE_NEED_CHECK;
|
||||
break;
|
||||
case LV_STYLE_BG_BLEND_MODE:
|
||||
if(list->cache_bg_blend_mode_zero ) return CACHE_ZERO;
|
||||
else return CACHE_NEED_CHECK;
|
||||
|
@ -244,18 +244,6 @@ static inline lv_coord_t lv_obj_get_style_pad_left(const struct _lv_obj_t * obj,
|
||||
static inline lv_coord_t lv_obj_get_style_pad_right(const struct _lv_obj_t * obj, uint32_t part) {
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_RIGHT); return v.num; }
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_margin_top(const struct _lv_obj_t * obj, uint32_t part) {
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_TOP); return v.num; }
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_margin_bottom(const struct _lv_obj_t * obj, uint32_t part) {
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_BOTTOM); return v.num; }
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_margin_left(const struct _lv_obj_t * obj, uint32_t part) {
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_LEFT); return v.num; }
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_margin_right(const struct _lv_obj_t * obj, uint32_t part) {
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_RIGHT); return v.num; }
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_bg_color(const struct _lv_obj_t * obj, uint32_t part) {
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR); return v.color; }
|
||||
|
||||
|
@ -448,50 +448,6 @@ static void set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_t
|
||||
style->pad_right = 0;
|
||||
}
|
||||
break;
|
||||
case LV_STYLE_MARGIN_TOP:
|
||||
id= style->dont_index ? 0 : alloc_index_num(value);
|
||||
if(id > 0) {
|
||||
style->margin_top = id;
|
||||
} else {
|
||||
_alloc_ext(style);
|
||||
style->ext->margin_top = value.num;
|
||||
style->ext->has.margin_top = 1;
|
||||
style->margin_top = 0;
|
||||
}
|
||||
break;
|
||||
case LV_STYLE_MARGIN_BOTTOM:
|
||||
id= style->dont_index ? 0 : alloc_index_num(value);
|
||||
if(id > 0) {
|
||||
style->margin_bottom = id;
|
||||
} else {
|
||||
_alloc_ext(style);
|
||||
style->ext->margin_bottom = value.num;
|
||||
style->ext->has.margin_bottom = 1;
|
||||
style->margin_bottom = 0;
|
||||
}
|
||||
break;
|
||||
case LV_STYLE_MARGIN_LEFT:
|
||||
id= style->dont_index ? 0 : alloc_index_num(value);
|
||||
if(id > 0) {
|
||||
style->margin_left = id;
|
||||
} else {
|
||||
_alloc_ext(style);
|
||||
style->ext->margin_left = value.num;
|
||||
style->ext->has.margin_left = 1;
|
||||
style->margin_left = 0;
|
||||
}
|
||||
break;
|
||||
case LV_STYLE_MARGIN_RIGHT:
|
||||
id= style->dont_index ? 0 : alloc_index_num(value);
|
||||
if(id > 0) {
|
||||
style->margin_right = id;
|
||||
} else {
|
||||
_alloc_ext(style);
|
||||
style->ext->margin_right = value.num;
|
||||
style->ext->has.margin_right = 1;
|
||||
style->margin_right = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case LV_STYLE_BG_COLOR:
|
||||
id= style->dont_index ? 0 : alloc_index_color(value);
|
||||
@ -727,37 +683,19 @@ static void set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_t
|
||||
}
|
||||
break;
|
||||
case LV_STYLE_SHADOW_OFS_X:
|
||||
id= style->dont_index ? 0 : alloc_index_num(value);
|
||||
if(id > 0) {
|
||||
style->shadow_ofs_x = id;
|
||||
} else {
|
||||
_alloc_ext(style);
|
||||
style->ext->shadow_ofs_x = value.num;
|
||||
style->ext->has.shadow_ofs_x = 1;
|
||||
style->shadow_ofs_x = 0;
|
||||
}
|
||||
_alloc_ext(style);
|
||||
style->ext->shadow_ofs_x = value.num;
|
||||
style->ext->has.shadow_ofs_x = 1;
|
||||
break;
|
||||
case LV_STYLE_SHADOW_OFS_Y:
|
||||
id= style->dont_index ? 0 : alloc_index_num(value);
|
||||
if(id > 0) {
|
||||
style->shadow_ofs_y = id;
|
||||
} else {
|
||||
_alloc_ext(style);
|
||||
style->ext->shadow_ofs_y = value.num;
|
||||
style->ext->has.shadow_ofs_y = 1;
|
||||
style->shadow_ofs_y = 0;
|
||||
}
|
||||
_alloc_ext(style);
|
||||
style->ext->shadow_ofs_y = value.num;
|
||||
style->ext->has.shadow_ofs_y = 1;
|
||||
break;
|
||||
case LV_STYLE_SHADOW_SPREAD:
|
||||
id= style->dont_index ? 0 : alloc_index_num(value);
|
||||
if(id > 0) {
|
||||
style->shadow_spread = id;
|
||||
} else {
|
||||
_alloc_ext(style);
|
||||
style->ext->shadow_spread = value.num;
|
||||
style->ext->has.shadow_spread = 1;
|
||||
style->shadow_spread = 0;
|
||||
}
|
||||
_alloc_ext(style);
|
||||
style->ext->shadow_spread = value.num;
|
||||
style->ext->has.shadow_spread = 1;
|
||||
break;
|
||||
case LV_STYLE_SHADOW_BLEND_MODE:
|
||||
_alloc_ext(style);
|
||||
@ -924,22 +862,6 @@ static bool get_prop(const lv_style_t * style, lv_style_prop_t prop, lv_style_va
|
||||
if(style->pad_right) { value->num = buf_num[style->pad_right]; return true; }
|
||||
if(style->ext && style->ext->has.pad_top) { value->num = style->ext->pad_right; return true; }
|
||||
break;
|
||||
case LV_STYLE_MARGIN_TOP:
|
||||
if(style->margin_top) { value->num = buf_num[style->margin_top]; return true; }
|
||||
if(style->ext && style->ext->has.margin_top) { value->num = style->ext->margin_top; return true; }
|
||||
break;
|
||||
case LV_STYLE_MARGIN_BOTTOM:
|
||||
if(style->margin_bottom) { value->num = buf_num[style->margin_bottom]; return true; }
|
||||
if(style->ext && style->ext->has.margin_top) { value->num = style->ext->margin_bottom; return true; }
|
||||
break;
|
||||
case LV_STYLE_MARGIN_LEFT:
|
||||
if(style->margin_left) { value->num = buf_num[style->margin_left]; return true; }
|
||||
if(style->ext && style->ext->has.margin_top) { value->num = style->ext->margin_left; return true; }
|
||||
break;
|
||||
case LV_STYLE_MARGIN_RIGHT:
|
||||
if(style->margin_right) { value->num = buf_num[style->margin_right]; return true; }
|
||||
if(style->ext && style->ext->has.margin_top) { value->num = style->ext->margin_right; return true; }
|
||||
break;
|
||||
|
||||
case LV_STYLE_BG_COLOR:
|
||||
case LV_STYLE_BG_COLOR_FILTERED:
|
||||
@ -1059,15 +981,12 @@ static bool get_prop(const lv_style_t * style, lv_style_prop_t prop, lv_style_va
|
||||
if(style->ext && style->ext->has.shadow_width) { value->num = style->ext->shadow_width; return true; }
|
||||
break;
|
||||
case LV_STYLE_SHADOW_OFS_X:
|
||||
if(style->shadow_ofs_x) { value->num = buf_num[style->shadow_ofs_x]; return true; }
|
||||
if(style->ext && style->ext->has.shadow_ofs_x) { value->num = style->ext->shadow_ofs_x; return true; }
|
||||
break;
|
||||
case LV_STYLE_SHADOW_OFS_Y:
|
||||
if(style->shadow_ofs_y) { value->num = buf_num[style->shadow_ofs_y]; return true; }
|
||||
if(style->ext && style->ext->has.shadow_ofs_y) { value->num = style->ext->shadow_ofs_y; return true; }
|
||||
break;
|
||||
case LV_STYLE_SHADOW_SPREAD:
|
||||
if(style->shadow_spread) { value->num = buf_num[style->shadow_spread]; return true; }
|
||||
if(style->ext && style->ext->has.shadow_spread) { value->num = style->ext->shadow_spread; return true; }
|
||||
break;
|
||||
case LV_STYLE_SHADOW_BLEND_MODE:
|
||||
@ -1190,22 +1109,6 @@ static bool remove_prop(lv_style_t * style, lv_style_prop_t prop)
|
||||
style->pad_right = 0;
|
||||
if(style->ext) style->ext->has.pad_right = 0;
|
||||
break;
|
||||
case LV_STYLE_MARGIN_TOP:
|
||||
style->margin_top = 0;
|
||||
if(style->ext) style->ext->has.margin_top = 0;
|
||||
break;
|
||||
case LV_STYLE_MARGIN_BOTTOM:
|
||||
style->margin_bottom = 0;
|
||||
if(style->ext) style->ext->has.margin_bottom = 0;
|
||||
break;
|
||||
case LV_STYLE_MARGIN_LEFT:
|
||||
style->margin_left = 0;
|
||||
if(style->ext) style->ext->has.margin_left = 0;
|
||||
break;
|
||||
case LV_STYLE_MARGIN_RIGHT:
|
||||
style->margin_right = 0;
|
||||
if(style->ext) style->ext->has.margin_right = 0;
|
||||
break;
|
||||
|
||||
case LV_STYLE_BG_COLOR:
|
||||
style->bg_color = 0;
|
||||
@ -1318,15 +1221,12 @@ static bool remove_prop(lv_style_t * style, lv_style_prop_t prop)
|
||||
if(style->ext) style->ext->has.shadow_width = 0;
|
||||
break;
|
||||
case LV_STYLE_SHADOW_OFS_X:
|
||||
style->shadow_ofs_x = 0;
|
||||
if(style->ext) style->ext->has.shadow_ofs_x = 0;
|
||||
break;
|
||||
case LV_STYLE_SHADOW_OFS_Y:
|
||||
style->shadow_ofs_y = 0;
|
||||
if(style->ext) style->ext->has.shadow_ofs_y = 0;
|
||||
break;
|
||||
case LV_STYLE_SHADOW_SPREAD:
|
||||
style->shadow_spread = 0;
|
||||
if(style->ext) style->ext->has.shadow_spread = 0;
|
||||
break;
|
||||
case LV_STYLE_SHADOW_BLEND_MODE:
|
||||
|
@ -98,10 +98,6 @@ typedef enum {
|
||||
LV_STYLE_PAD_BOTTOM = 21 | LV_STYLE_PROP_LAYOUT_REFR,
|
||||
LV_STYLE_PAD_LEFT = 22 | LV_STYLE_PROP_LAYOUT_REFR,
|
||||
LV_STYLE_PAD_RIGHT = 23 | LV_STYLE_PROP_LAYOUT_REFR,
|
||||
LV_STYLE_MARGIN_TOP = 24 | LV_STYLE_PROP_LAYOUT_REFR,
|
||||
LV_STYLE_MARGIN_BOTTOM = 25 | LV_STYLE_PROP_LAYOUT_REFR,
|
||||
LV_STYLE_MARGIN_LEFT = 26 | LV_STYLE_PROP_LAYOUT_REFR,
|
||||
LV_STYLE_MARGIN_RIGHT = 27 | LV_STYLE_PROP_LAYOUT_REFR,
|
||||
|
||||
LV_STYLE_BG_COLOR = 30,
|
||||
LV_STYLE_BG_COLOR_FILTERED = 30 | LV_STYLE_PROP_FILTER,
|
||||
@ -208,10 +204,6 @@ typedef struct {
|
||||
int8_t pad_bottom;
|
||||
int8_t pad_left;
|
||||
int8_t pad_right;
|
||||
int8_t margin_top;
|
||||
int8_t margin_bottom;
|
||||
int8_t margin_left;
|
||||
int8_t margin_right;
|
||||
int8_t border_width;
|
||||
uint8_t outline_width;
|
||||
uint8_t outline_pad;
|
||||
@ -236,7 +228,6 @@ typedef struct {
|
||||
uint32_t shadow_blend_mode :2;
|
||||
uint32_t text_decor :2;
|
||||
|
||||
|
||||
uint32_t transform_zoom :14;
|
||||
uint32_t transform_angle :14;
|
||||
uint32_t text_blend_mode :2;
|
||||
@ -275,10 +266,6 @@ typedef struct {
|
||||
uint32_t pad_bottom:1;
|
||||
uint32_t pad_left:1;
|
||||
uint32_t pad_right:1;
|
||||
uint32_t margin_top:1;
|
||||
uint32_t margin_bottom:1;
|
||||
uint32_t margin_left:1;
|
||||
uint32_t margin_right:1;
|
||||
uint32_t border_width:1;
|
||||
uint32_t outline_width:1;
|
||||
uint32_t outline_pad:1;
|
||||
@ -343,6 +330,7 @@ typedef struct _lv_style_t{
|
||||
uint32_t transition :4;
|
||||
uint32_t bg_color :4;
|
||||
|
||||
/*32*/
|
||||
uint32_t color_filter_opa :5;
|
||||
uint32_t bg_opa :5;
|
||||
uint32_t border_opa:5;
|
||||
@ -351,6 +339,7 @@ typedef struct _lv_style_t{
|
||||
uint32_t border_color:4;
|
||||
uint32_t border_width:4;
|
||||
|
||||
/*32*/
|
||||
uint32_t pad_top:5;
|
||||
uint32_t pad_bottom:5;
|
||||
uint32_t pad_left:5;
|
||||
@ -359,18 +348,7 @@ typedef struct _lv_style_t{
|
||||
uint32_t text_font :4;
|
||||
uint32_t line_color :4;
|
||||
|
||||
uint32_t margin_top:5;
|
||||
uint32_t margin_bottom:5;
|
||||
uint32_t margin_left:5;
|
||||
uint32_t margin_right:5;
|
||||
uint32_t outline_color:4;
|
||||
uint32_t shadow_color:4;
|
||||
uint32_t line_rounded:1;
|
||||
uint32_t border_post:1;
|
||||
uint32_t clip_corner:1;
|
||||
uint32_t has_line_rounded:1;
|
||||
uint32_t has_clip_corner:1;
|
||||
|
||||
/*32*/
|
||||
uint32_t text_opa:5;
|
||||
uint32_t line_width :5;
|
||||
uint32_t line_opa :5;
|
||||
@ -379,11 +357,16 @@ typedef struct _lv_style_t{
|
||||
uint32_t outline_opa:5;
|
||||
uint32_t bg_grad_dir:2;
|
||||
|
||||
/*25*/
|
||||
uint32_t shadow_width:5;
|
||||
uint32_t shadow_ofs_y:5;
|
||||
uint32_t shadow_ofs_x:5;
|
||||
uint32_t shadow_spread:5;
|
||||
uint32_t shadow_opa:4;
|
||||
uint32_t outline_color:4;
|
||||
uint32_t shadow_color:4;
|
||||
uint32_t line_rounded:1;
|
||||
uint32_t border_post:1;
|
||||
uint32_t clip_corner:1;
|
||||
uint32_t has_line_rounded:1;
|
||||
uint32_t has_clip_corner:1;
|
||||
uint32_t has_bg_grad_dir:1;
|
||||
uint32_t has_border_post:1;
|
||||
uint32_t dont_index:1;
|
||||
@ -466,18 +449,6 @@ static inline void lv_style_set_pad_left(lv_style_t * style, lv_coord_t value) {
|
||||
static inline void lv_style_set_pad_right(lv_style_t * style, lv_coord_t value) {
|
||||
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_PAD_RIGHT, v); }
|
||||
|
||||
static inline void lv_style_set_margin_top(lv_style_t * style, lv_coord_t value) {
|
||||
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_MARGIN_TOP, v); }
|
||||
|
||||
static inline void lv_style_set_margin_bottom(lv_style_t * style, lv_coord_t value) {
|
||||
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_MARGIN_BOTTOM, v); }
|
||||
|
||||
static inline void lv_style_set_margin_left(lv_style_t * style, lv_coord_t value) {
|
||||
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_MARGIN_LEFT, v); }
|
||||
|
||||
static inline void lv_style_set_margin_right(lv_style_t * style, lv_coord_t value) {
|
||||
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_MARGIN_RIGHT, v); }
|
||||
|
||||
static inline void lv_style_set_bg_color(lv_style_t * style, lv_color_t value) {
|
||||
lv_style_value_t v = {.color = value}; lv_style_set_prop(style, LV_STYLE_BG_COLOR, v); }
|
||||
|
||||
|
@ -212,8 +212,8 @@ static void basic_init(void)
|
||||
lv_style_set_bg_color(&styles->scrollbar, (IS_LIGHT ? lv_color_hex(0xcccfd1) : lv_color_hex(0x777f85)));
|
||||
lv_style_set_radius(&styles->scrollbar, LV_RADIUS_CIRCLE);
|
||||
lv_style_set_pad_left(&styles->scrollbar, LV_DPX(7));
|
||||
lv_style_set_margin_right(&styles->scrollbar, LV_DPX(7));
|
||||
lv_style_set_margin_top(&styles->scrollbar, LV_DPX(7));
|
||||
lv_style_set_pad_right(&styles->scrollbar, LV_DPX(7));
|
||||
lv_style_set_pad_top(&styles->scrollbar, LV_DPX(7));
|
||||
lv_style_set_bg_opa(&styles->scrollbar, LV_OPA_50);
|
||||
lv_style_set_transition(&styles->scrollbar, &trans_slow);
|
||||
|
||||
@ -500,17 +500,6 @@ static void textarea_init(void)
|
||||
//#endif
|
||||
//}
|
||||
|
||||
static void tabview_init(void)
|
||||
{
|
||||
#if LV_USE_TABVIEW != 0
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tileview_init(void)
|
||||
{
|
||||
#if LV_USE_TILEVIEW != 0
|
||||
#endif
|
||||
}
|
||||
|
||||
static void table_init(void)
|
||||
{
|
||||
@ -527,11 +516,6 @@ static void table_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void win_init(void)
|
||||
{
|
||||
#if LV_USE_WIN != 0
|
||||
#endif
|
||||
}
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
|
Loading…
x
Reference in New Issue
Block a user