add dropdown

This commit is contained in:
Gabor Kiss-Vamosi
2020-12-30 14:18:25 +01:00
parent f0999ccbd4
commit a7f9508ec4
19 changed files with 735 additions and 6329 deletions
+1 -1
View File
@@ -203,7 +203,7 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
lv_disp_load_scr(d->scr_to_load);
lv_anim_del(d->scr_to_load, NULL);
lv_obj_set_pos(d->scr_to_load, 0, 0);
lv_style_remove_prop(lv_obj_get_local_style(d->scr_to_load, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
lv_style_remove_prop(lv_obj_get_local_style(d->scr_to_load, LV_PART_MAIN, LV_STATE_DEFAULT), LV_STYLE_OPA);
act_scr = d->scr_to_load;
}
+10 -2
View File
@@ -454,8 +454,8 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent)
else old_pos.x = old_parent->coords.x2 - obj->coords.x2;
/*Remove the object from the old parent's child list*/
uint32_t i;
for(i = lv_obj_get_child_id(obj); i < lv_obj_get_child_cnt(old_parent) - 2; i++) {
int32_t i;
for(i = lv_obj_get_child_id(obj); i <= (int32_t)lv_obj_get_child_cnt(old_parent) - 2; i++) {
old_parent->spec_attr->children[i] = old_parent->spec_attr->children[i+1];
}
old_parent->spec_attr->child_cnt--;
@@ -624,7 +624,12 @@ void lv_obj_add_flag(lv_obj_t * obj, lv_obj_flag_t f)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
if(f & LV_OBJ_FLAG_HIDDEN) {
lv_obj_invalidate(obj);
}
obj->flags |= f;
}
@@ -634,6 +639,9 @@ void lv_obj_clear_flag(lv_obj_t * obj, lv_obj_flag_t f)
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
obj->flags &= (~f);
if(f & LV_OBJ_FLAG_HIDDEN) {
lv_obj_invalidate(obj);
}
}
+64 -66
View File
@@ -278,8 +278,6 @@ static lv_style_value_t apply_color_filter(const lv_obj_t * obj, uint32_t part,
}
return v;
}
extern int16_t buf_num[];
extern lv_color_t buf_color[];
static bool get_prop_core(const lv_obj_t * obj, uint8_t part, lv_style_prop_t prop, lv_style_value_t * v)
{
cache_t cache_res = read_cache(obj, part, prop);
@@ -288,10 +286,10 @@ static bool get_prop_core(const lv_obj_t * obj, uint8_t part, lv_style_prop_t pr
v->_ptr = 0;
return true;
case CACHE_TRUE:
v->_int = 1;
v->num = 1;
return true;
case CACHE_255:
v->_int = 255;
v->num = 255;
return true;
case CACHE_UNSET:
return false;
@@ -302,9 +300,9 @@ static bool get_prop_core(const lv_obj_t * obj, uint8_t part, lv_style_prop_t pr
cache_res -= CACHE_INDEX;
if(cache_res) {
if(prop == LV_STYLE_BG_COLOR_FILTERED || prop == LV_STYLE_TEXT_COLOR_FILTERED) {
v->_color = buf_color[cache_res];
v->_color = lv_style_get_indexed_color(cache_res);
} else {
v->_int = buf_num[cache_res];
v->num = lv_style_get_indexed_num(cache_res);
}
return true;
}
@@ -541,18 +539,18 @@ void _lv_obj_create_style_transition(lv_obj_t * obj, lv_style_prop_t prop, uint8
lv_style_value_t v2 = lv_obj_get_style_prop(obj, part, prop);
obj->style_list.skip_trans = 0;
if(v1._ptr == v2._ptr && v1._int == v2._int && v1._color.full == v2._color.full) return;
if(v1._ptr == v2._ptr && v1.num == v2.num && v1._color.full == v2._color.full) return;
obj->state = prev_state;
v1 = lv_obj_get_style_prop(obj, part, prop);
obj->state = new_state;
lv_style_set_prop(style_trans->style, prop, v1); /*Be sure `trans_style` has a valid value */
if(prop == LV_STYLE_RADIUS) {
if(v1._int == LV_RADIUS_CIRCLE || v2._int == LV_RADIUS_CIRCLE) {
if(v1.num == LV_RADIUS_CIRCLE || v2.num == LV_RADIUS_CIRCLE) {
lv_coord_t whalf = lv_obj_get_width(obj) / 2;
lv_coord_t hhalf = lv_obj_get_width(obj) / 2;
if(v1._int == LV_RADIUS_CIRCLE) v1._int = LV_MATH_MIN(whalf + 1, hhalf + 1);
if(v2._int == LV_RADIUS_CIRCLE) v2._int = LV_MATH_MIN(whalf + 1, hhalf + 1);
if(v1.num == LV_RADIUS_CIRCLE) v1.num = LV_MATH_MIN(whalf + 1, hhalf + 1);
if(v2.num == LV_RADIUS_CIRCLE) v2.num = LV_MATH_MIN(whalf + 1, hhalf + 1);
}
}
@@ -691,18 +689,18 @@ static void update_cache(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop)
/*Indexed*/
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_RADIUS) {
if(get_prop_core(obj, part, LV_STYLE_RADIUS, &v) == 0) v._int = 0;
uint32_t id = find_index_num(v);
if(get_prop_core(obj, part, LV_STYLE_RADIUS, &v) == 0) v.num = 0;
uint32_t id = lv_style_find_index_num(v);
list->cache_radius = id;
}
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_PAD_LEFT || prop == LV_STYLE_PAD_RIGHT) {
lv_style_value_t vl;
lv_style_value_t vr;
if(get_prop_core(obj, part, LV_STYLE_PAD_LEFT, &vl) == 0) vl._int = 0;
if(get_prop_core(obj, part, LV_STYLE_PAD_RIGHT, &vr) == 0) vr._int = 0;
if(get_prop_core(obj, part, LV_STYLE_PAD_LEFT, &vl) == 0) vl.num = 0;
if(get_prop_core(obj, part, LV_STYLE_PAD_RIGHT, &vr) == 0) vr.num = 0;
if(vl._int == vr._int) {
uint32_t id = find_index_num(vl);
if(vl.num == vr.num) {
uint32_t id = lv_style_find_index_num(vl);
list->cache_pad_hor = id;
} else {
list->cache_pad_hor = 0;
@@ -711,26 +709,26 @@ static void update_cache(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop)
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_PAD_TOP || prop == LV_STYLE_PAD_BOTTOM) {
lv_style_value_t vt;
lv_style_value_t vb;
if(get_prop_core(obj, part, LV_STYLE_PAD_TOP, &vt) == 0) vt._int = 0;
if(get_prop_core(obj, part, LV_STYLE_PAD_BOTTOM, &vb) == 0) vb._int = 0;
if(get_prop_core(obj, part, LV_STYLE_PAD_TOP, &vt) == 0) vt.num = 0;
if(get_prop_core(obj, part, LV_STYLE_PAD_BOTTOM, &vb) == 0) vb.num = 0;
if(vt._int == vb._int) {
uint32_t id = find_index_num(vt);
if(vt.num == vb.num) {
uint32_t id = lv_style_find_index_num(vt);
list->cache_pad_ver = id;
} else {
list->cache_pad_ver = 0;
}
}
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_BORDER_WIDTH) {
if(get_prop_core(obj, part, LV_STYLE_BORDER_WIDTH, &v) == 0) v._int = 0;
uint32_t id = find_index_num(v);
if(get_prop_core(obj, part, LV_STYLE_BORDER_WIDTH, &v) == 0) v.num = 0;
uint32_t id = lv_style_find_index_num(v);
list->cache_border_width = id;
}
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_BG_COLOR_FILTERED) {
if(get_prop_core(obj, part, LV_STYLE_BG_COLOR_FILTERED, &v) == 0) {
list->cache_bg_color_filtered = 0;
} else {
uint32_t id = find_index_color(v);
uint32_t id = lv_style_find_index_color(v);
list->cache_bg_color_filtered = id;
}
}
@@ -738,7 +736,7 @@ static void update_cache(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop)
if(get_prop_core(obj, part, LV_STYLE_TEXT_COLOR_FILTERED, &v) == 0) {
list->cache_text_color_filtered = 0;
} else {
uint32_t id = find_index_color(v);
uint32_t id = lv_style_find_index_color(v);
list->cache_text_color_filtered = id;
}
}
@@ -747,12 +745,12 @@ static void update_cache(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop)
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_TRANSFORM_ANGLE || prop == LV_STYLE_TRANSFORM_ZOOM ||
prop == LV_STYLE_TRANSFORM_HEIGHT || prop == LV_STYLE_TRANSFORM_WIDTH) {
lv_style_value_t vt[4];
if(get_prop_core(obj, part, LV_STYLE_TRANSFORM_ANGLE, &vt[0]) == false) vt[0]._int = 0;
if(get_prop_core(obj, part, LV_STYLE_TRANSFORM_ZOOM, &vt[1]) == false) vt[1]._int = 0;
if(get_prop_core(obj, part, LV_STYLE_TRANSFORM_WIDTH, &vt[2]) == false) vt[2]._int = 0;
if(get_prop_core(obj, part, LV_STYLE_TRANSFORM_HEIGHT, &vt[3]) == false) vt[3]._int = 0;
if(get_prop_core(obj, part, LV_STYLE_TRANSFORM_ANGLE, &vt[0]) == false) vt[0].num = 0;
if(get_prop_core(obj, part, LV_STYLE_TRANSFORM_ZOOM, &vt[1]) == false) vt[1].num = 0;
if(get_prop_core(obj, part, LV_STYLE_TRANSFORM_WIDTH, &vt[2]) == false) vt[2].num = 0;
if(get_prop_core(obj, part, LV_STYLE_TRANSFORM_HEIGHT, &vt[3]) == false) vt[3].num = 0;
if(vt[0]._int == 0 && vt[1]._int == 0 && vt[2]._int == 0 && vt[3]._int == 0) {
if(vt[0].num == 0 && vt[1].num == 0 && vt[2].num == 0 && vt[3].num == 0) {
list->cache_transform_zero = 1;
} else {
list->cache_transform_zero = 0;
@@ -760,86 +758,86 @@ static void update_cache(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop)
} 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]._int = 0;
if(get_prop_core(obj, part, LV_STYLE_MARGIN_BOTTOM, &vt[1]) == false) vt[1]._int = 0;
if(get_prop_core(obj, part, LV_STYLE_MARGIN_LEFT, &vt[2]) == false) vt[2]._int = 0;
if(get_prop_core(obj, part, LV_STYLE_MARGIN_RIGHT, &vt[3]) == false) vt[3]._int = 0;
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]._int == 0 && vt[1]._int == 0 && vt[2]._int == 0 && vt[3]._int == 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._int = 0;
if(v._int == 0) list->cache_bg_blend_mode_zero = 1;
if(get_prop_core(obj, part, LV_STYLE_BG_BLEND_MODE, &v) == false) v.num = 0;
if(v.num == 0) list->cache_bg_blend_mode_zero = 1;
else list->cache_bg_blend_mode_zero = 0;
}
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_BG_GRAD_DIR) {
if(get_prop_core(obj, part, LV_STYLE_BG_GRAD_DIR, &v) == false) v._int = 0;
if(v._int == 0) list->cache_bg_grad_dir_zero = 1;
if(get_prop_core(obj, part, LV_STYLE_BG_GRAD_DIR, &v) == false) v.num = 0;
if(v.num == 0) list->cache_bg_grad_dir_zero = 1;
else list->cache_bg_grad_dir_zero = 0;
}
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_BORDER_BLEND_MODE) {
if(get_prop_core(obj, part, LV_STYLE_BORDER_BLEND_MODE, &v) == false) v._int = 0;
if(v._int == 0) list->cache_border_blend_mode_zero = 1;
if(get_prop_core(obj, part, LV_STYLE_BORDER_BLEND_MODE, &v) == false) v.num = 0;
if(v.num == 0) list->cache_border_blend_mode_zero = 1;
else list->cache_border_blend_mode_zero = 0;
}
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_OUTLINE_WIDTH) {
if(get_prop_core(obj, part, LV_STYLE_OUTLINE_WIDTH, &v) == false) v._int = 0;
if(v._int == 0) list->cache_outline_width_zero = 1;
if(get_prop_core(obj, part, LV_STYLE_OUTLINE_WIDTH, &v) == false) v.num = 0;
if(v.num == 0) list->cache_outline_width_zero = 1;
else list->cache_outline_width_zero = 0;
}
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_SHADOW_WIDTH) {
if(get_prop_core(obj, part, LV_STYLE_OUTLINE_WIDTH, &v) == false) v._int = 0;
if(v._int == 0) list->cache_shadow_width_zero = 1;
if(get_prop_core(obj, part, LV_STYLE_OUTLINE_WIDTH, &v) == false) v.num = 0;
if(v.num == 0) list->cache_shadow_width_zero = 1;
else list->cache_shadow_width_zero = 0;
}
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_IMG_RECOLOR_OPA) {
if(get_prop_core(obj, part, LV_STYLE_IMG_RECOLOR_OPA, &v) == false) v._int = 0;
if(v._int == 0) list->cache_img_recolor_opa_zero = 1;
if(get_prop_core(obj, part, LV_STYLE_IMG_RECOLOR_OPA, &v) == false) v.num = 0;
if(v.num == 0) list->cache_img_recolor_opa_zero = 1;
else list->cache_img_recolor_opa_zero = 0;
}
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_CONTENT_SRC) {
if(get_prop_core(obj, part, LV_STYLE_CONTENT_SRC, &v) == false) v._int = 0;
if(v._int == 0) list->cache_content_src_zero = 1;
if(get_prop_core(obj, part, LV_STYLE_CONTENT_SRC, &v) == false) v.num = 0;
if(v.num == 0) list->cache_content_src_zero = 1;
else list->cache_content_src_zero = 0;
}
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_COLOR_FILTER_CB || prop == LV_STYLE_COLOR_FILTER_OPA) {
lv_style_value_t vf[2];
if(get_prop_core(obj, part, LV_STYLE_COLOR_FILTER_CB, &vf[0]) == false) vf[0]._func = 0;
if(get_prop_core(obj, part, LV_STYLE_COLOR_FILTER_OPA, &vf[1]) == false) vf[1]._int = 0;
if(vf[0]._func == NULL || vf[1]._int == 0) list->cache_filter_zero = 1;
if(get_prop_core(obj, part, LV_STYLE_COLOR_FILTER_OPA, &vf[1]) == false) vf[1].num = 0;
if(vf[0]._func == NULL || vf[1].num == 0) list->cache_filter_zero = 1;
else list->cache_filter_zero = 0;
}
/*1 or 0*/
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_BORDER_POST) {
if(get_prop_core(obj, part, LV_STYLE_BORDER_POST, &v) == false) v._int = 0;
if(v._int) list->cache_border_post_enable = 1;
if(get_prop_core(obj, part, LV_STYLE_BORDER_POST, &v) == false) v.num = 0;
if(v.num) list->cache_border_post_enable = 1;
else list->cache_border_post_enable = 0;
}
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_CLIP_CORNER) {
if(get_prop_core(obj, part, LV_STYLE_CLIP_CORNER, &v) == false) v._int = 0;
if(v._int) list->cache_clip_corner_enable = 1;
if(get_prop_core(obj, part, LV_STYLE_CLIP_CORNER, &v) == false) v.num = 0;
if(v.num) list->cache_clip_corner_enable = 1;
else list->cache_clip_corner_enable = 0;
}
/*255 or Needs check*/
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_BG_OPA) {
if(get_prop_core(obj, part, LV_STYLE_BG_OPA, &v) == false) v._int = LV_OPA_TRANSP;
if(v._int == LV_OPA_COVER) list->cache_bg_opa_cover = 1;
if(get_prop_core(obj, part, LV_STYLE_BG_OPA, &v) == false) v.num = LV_OPA_TRANSP;
if(v.num == LV_OPA_COVER) list->cache_bg_opa_cover = 1;
else list->cache_bg_opa_cover = 0;
}
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_BORDER_OPA) {
if(get_prop_core(obj, part, LV_STYLE_BORDER_OPA, &v) == false) v._int = LV_OPA_COVER;
if(v._int == LV_OPA_COVER) list->cache_border_opa_cover = 1;
if(get_prop_core(obj, part, LV_STYLE_BORDER_OPA, &v) == false) v.num = LV_OPA_COVER;
if(v.num == LV_OPA_COVER) list->cache_border_opa_cover = 1;
else list->cache_border_opa_cover = 0;
}
if(prop == LV_STYLE_PROP_ALL || prop == LV_STYLE_IMG_OPA) {
if(get_prop_core(obj, part, LV_STYLE_IMG_OPA, &v) == false) v._int = LV_OPA_COVER;
if(v._int == LV_OPA_COVER) list->cache_img_opa_cover = 1;
if(get_prop_core(obj, part, LV_STYLE_IMG_OPA, &v) == false) v.num = LV_OPA_COVER;
if(v.num == LV_OPA_COVER) list->cache_img_opa_cover = 1;
else list->cache_img_opa_cover = 0;
}
@@ -1078,8 +1076,8 @@ static void trans_anim_cb(lv_style_trans_t * tr, lv_anim_value_t v)
case LV_STYLE_SHADOW_BLEND_MODE:
case LV_STYLE_TEXT_BLEND_MODE:
case LV_STYLE_LINE_BLEND_MODE:
if(v < 255) value_final._int = tr->start_value._int;
else value_final._int = tr->end_value._int;
if(v < 255) value_final.num = tr->start_value.num;
else value_final.num = tr->end_value.num;
break;
case LV_STYLE_TRANSITION:
case LV_STYLE_TEXT_FONT:
@@ -1104,16 +1102,16 @@ static void trans_anim_cb(lv_style_trans_t * tr, lv_anim_value_t v)
break;
default:
if(v == 0) value_final._int = tr->start_value._int;
else if(v == 255) value_final._int = tr->end_value._int;
else value_final._int = tr->start_value._int + ((int32_t)((int32_t)(tr->end_value._int - tr->start_value._int) * v) >> 8);
if(v == 0) value_final.num = tr->start_value.num;
else if(v == 255) value_final.num = tr->end_value.num;
else value_final.num = tr->start_value.num + ((int32_t)((int32_t)(tr->end_value.num - tr->start_value.num) * v) >> 8);
break;
}
lv_style_value_t old_value;
bool refr = true;
if(lv_style_get_prop(list->styles[i].style, tr->prop, &old_value)) {
if(value_final._ptr == old_value._ptr && value_final._func == old_value._ptr && value_final._color.full == old_value._color.full && value_final._int == old_value._int) {
if(value_final._ptr == old_value._ptr && value_final._func == old_value._ptr && value_final._color.full == old_value._color.full && value_final.num == old_value.num) {
refr = false;
}
}
+53 -53
View File
@@ -206,55 +206,55 @@ _lv_style_state_cmp_t _lv_obj_style_state_compare(struct _lv_obj_t * obj, lv_sta
*********************/
static inline lv_coord_t lv_obj_get_style_radius(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_RADIUS); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_RADIUS); return v.num; }
static inline bool lv_obj_get_style_clip_corner(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CLIP_CORNER); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CLIP_CORNER); return v.num; }
static inline lv_coord_t lv_obj_get_style_transform_width(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_WIDTH); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_WIDTH); return v.num; }
static inline lv_coord_t lv_obj_get_style_transform_height(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_HEIGHT); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_HEIGHT); return v.num; }
static inline lv_coord_t lv_obj_get_style_transform_zoom(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ZOOM); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ZOOM); return v.num; }
static inline lv_coord_t lv_obj_get_style_transform_angle(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ANGLE); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ANGLE); return v.num; }
static inline lv_opa_t lv_obj_get_style_opa(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OPA); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OPA); return v.num; }
static inline lv_color_filter_cb_t lv_obj_get_style_color_filter_cb(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_CB); return (lv_color_filter_cb_t)v._func; }
static inline lv_opa_t lv_obj_get_style_color_filter_opa(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_OPA); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_OPA); return v.num; }
static inline lv_coord_t lv_obj_get_style_pad_top(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_TOP); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_TOP); return v.num; }
static inline lv_coord_t lv_obj_get_style_pad_bottom(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_BOTTOM); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_BOTTOM); return v.num; }
static inline lv_coord_t lv_obj_get_style_pad_left(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_LEFT); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_LEFT); return v.num; }
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._int; }
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._int; }
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._int; }
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._int; }
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._int; }
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; }
@@ -263,7 +263,7 @@ static inline lv_color_t lv_obj_get_style_bg_color_filtered(const struct _lv_obj
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR_FILTERED); return v._color; }
static inline lv_opa_t lv_obj_get_style_bg_opa(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_OPA); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_OPA); return v.num; }
static inline lv_color_t lv_obj_get_style_bg_grad_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_GRAD_COLOR); return v._color; }
@@ -272,16 +272,16 @@ static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const struct _l
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR_FILTERED); return v._color; }
static inline lv_grad_dir_t lv_obj_get_style_bg_grad_dir(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_DIR); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_DIR); return v.num; }
static inline lv_blend_mode_t lv_obj_get_style_bg_blend_mode(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_BLEND_MODE); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_BLEND_MODE); return v.num; }
static inline lv_coord_t lv_obj_get_style_bg_main_stop(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_MAIN_STOP); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_MAIN_STOP); return v.num; }
static inline lv_coord_t lv_obj_get_style_bg_grad_stop(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_STOP); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_STOP); return v.num; }
static inline lv_color_t lv_obj_get_style_border_color(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR); return v._color; }
@@ -290,19 +290,19 @@ static inline lv_color_t lv_obj_get_style_border_color_filtered(const struct _lv
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR_FILTERED); return v._color; }
static inline lv_opa_t lv_obj_get_style_border_opa(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_OPA); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_OPA); return v.num; }
static inline lv_coord_t lv_obj_get_style_border_width(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_WIDTH); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_WIDTH); return v.num; }
static inline lv_border_side_t lv_obj_get_style_border_side(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_SIDE); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_SIDE); return v.num; }
static inline bool lv_obj_get_style_border_post(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_POST); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_POST); return v.num; }
static inline lv_blend_mode_t lv_obj_get_style_border_blend_mode(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_BLEND_MODE); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_BLEND_MODE); return v.num; }
static inline lv_color_t lv_obj_get_style_text_color(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR); return v._color; }
@@ -311,28 +311,28 @@ static inline lv_color_t lv_obj_get_style_text_color_filtered(const struct _lv_o
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR_FILTERED); return v._color; }
static inline lv_opa_t lv_obj_get_style_text_opa(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_OPA); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_OPA); return v.num; }
static inline const lv_font_t * lv_obj_get_style_text_font(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_FONT); return v._ptr; }
static inline lv_coord_t lv_obj_get_style_text_letter_space(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LETTER_SPACE); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LETTER_SPACE); return v.num; }
static inline lv_coord_t lv_obj_get_style_text_line_space(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LINE_SPACE); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LINE_SPACE); return v.num; }
static inline lv_text_decor_t lv_obj_get_style_text_decor(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_DECOR); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_DECOR); return v.num; }
static inline lv_blend_mode_t lv_obj_get_style_text_blend_mode(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_BLEND_MODE); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_BLEND_MODE); return v.num; }
static inline lv_opa_t lv_obj_get_style_img_opa(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_OPA); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_OPA); return v.num; }
static inline lv_blend_mode_t lv_obj_get_style_img_blend_mode(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_BLEND_MODE); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_BLEND_MODE); return v.num; }
static inline lv_color_t lv_obj_get_style_img_recolor(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_RECOLOR); return v._color; }
@@ -341,10 +341,10 @@ static inline lv_color_t lv_obj_get_style_img_recolor_filtered(const struct _lv_
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_RECOLOR_FILTERED); return v._color; }
static inline lv_opa_t lv_obj_get_style_img_recolor_opa(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_RECOLOR_OPA); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_RECOLOR_OPA); return v.num; }
static inline lv_coord_t lv_obj_get_style_outline_width(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_WIDTH); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_WIDTH); return v.num; }
static inline lv_color_t lv_obj_get_style_outline_color(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR); return v._color; }
@@ -353,28 +353,28 @@ static inline lv_color_t lv_obj_get_style_outline_color_filtered(const struct _l
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR_FILTERED); return v._color; }
static inline lv_opa_t lv_obj_get_style_outline_opa(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_OPA); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_OPA); return v.num; }
static inline lv_coord_t lv_obj_get_style_outline_pad(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_PAD); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_PAD); return v.num; }
static inline lv_blend_mode_t lv_obj_get_style_outline_blend_mode(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_BLEND_MODE); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_BLEND_MODE); return v.num; }
static inline lv_coord_t lv_obj_get_style_shadow_width(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_WIDTH); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_WIDTH); return v.num; }
static inline lv_coord_t lv_obj_get_style_shadow_ofs_x(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFS_X); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFS_X); return v.num; }
static inline lv_coord_t lv_obj_get_style_shadow_ofs_y(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFS_Y); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFS_Y); return v.num; }
static inline lv_coord_t lv_obj_get_style_shadow_spread(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_SPREAD); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_SPREAD); return v.num; }
static inline lv_blend_mode_t lv_obj_get_style_shadow_blend_mode(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_BLEND_MODE); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_BLEND_MODE); return v.num; }
static inline lv_color_t lv_obj_get_style_shadow_color(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR); return v._color; }
@@ -383,22 +383,22 @@ static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const struct _lv
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR_FILTERED); return v._color; }
static inline lv_opa_t lv_obj_get_style_shadow_opa(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OPA); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OPA); return v.num; }
static inline lv_coord_t lv_obj_get_style_line_width(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_WIDTH); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_WIDTH); return v.num; }
static inline lv_blend_mode_t lv_obj_get_style_line_blend_mode(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_BLEND_MODE); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_BLEND_MODE); return v.num; }
static inline lv_coord_t lv_obj_get_style_line_dash_width(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_WIDTH); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_WIDTH); return v.num; }
static inline lv_coord_t lv_obj_get_style_line_dash_gap(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_GAP); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_GAP); return v.num; }
static inline lv_coord_t lv_obj_get_style_line_rounded(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_ROUNDED); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_ROUNDED); return v.num; }
static inline lv_color_t lv_obj_get_style_line_color(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR); return v._color; }
@@ -407,19 +407,19 @@ static inline lv_color_t lv_obj_get_style_line_color_filtered(const struct _lv_o
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR_FILTERED); return v._color; }
static inline lv_opa_t lv_obj_get_style_line_opa(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_OPA); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_OPA); return v.num; }
static inline const char * lv_obj_get_style_content_src(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CONTENT_SRC); return v._ptr; }
static inline lv_align_t lv_obj_get_style_content_align(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CONTENT_ALIGN); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CONTENT_ALIGN); return v.num; }
static inline lv_coord_t lv_obj_get_style_content_ofs_x(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CONTENT_OFS_X); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CONTENT_OFS_X); return v.num; }
static inline lv_coord_t lv_obj_get_style_content_ofs_y(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CONTENT_OFS_Y); return v._int; }
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CONTENT_OFS_Y); return v.num; }
static inline const lv_style_transiton_t * lv_obj_get_style_transition(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION); return v._ptr; }
+246 -207
View File
File diff suppressed because it is too large Load Diff
+63 -57
View File
@@ -75,7 +75,7 @@ typedef uint8_t lv_text_decor_t;
typedef union {
int32_t _int;
int32_t num;
const void * _ptr;
void (* _func)(void);
lv_color_t _color;
@@ -418,8 +418,8 @@ bool lv_style_get_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_
void lv_style_transition_init(lv_style_transiton_t * tr, const lv_style_prop_t * props, const lv_anim_path_t * path, uint32_t time, uint32_t delay);
uint32_t find_index_num(lv_style_value_t v);
uint32_t find_index_color(lv_style_value_t v);
uint32_t lv_style_find_index_num(lv_style_value_t v);
uint32_t lv_style_find_index_color(lv_style_value_t v);
/**
* Remove a property from a style
@@ -431,55 +431,55 @@ uint32_t find_index_color(lv_style_value_t v);
bool lv_style_remove_prop(lv_style_t * style, lv_style_prop_t prop);
static inline void lv_style_set_radius(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_RADIUS, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_RADIUS, v); }
static inline void lv_style_set_clip_corner(lv_style_t * style, bool value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_CLIP_CORNER, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_CLIP_CORNER, v); }
static inline void lv_style_set_transform_width(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_TRANSFORM_WIDTH, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_TRANSFORM_WIDTH, v); }
static inline void lv_style_set_transform_height(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_TRANSFORM_HEIGHT, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_TRANSFORM_HEIGHT, v); }
static inline void lv_style_set_transform_zoom(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_TRANSFORM_ZOOM, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_TRANSFORM_ZOOM, v); }
static inline void lv_style_set_transform_angle(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_TRANSFORM_ANGLE, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_TRANSFORM_ANGLE, v); }
static inline void lv_style_set_opa(lv_style_t * style, lv_opa_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_OPA, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_OPA, v); }
static inline void lv_style_set_color_filter_cb(lv_style_t * style, lv_color_filter_cb_t value) {
lv_style_value_t v = {._func = (void(*)(void))value}; lv_style_set_prop(style, LV_STYLE_COLOR_FILTER_CB, v); }
static inline void lv_style_set_color_filter_opa(lv_style_t * style, lv_opa_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_COLOR_FILTER_OPA, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_COLOR_FILTER_OPA, v); }
static inline void lv_style_set_pad_top(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_PAD_TOP, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_PAD_TOP, v); }
static inline void lv_style_set_pad_bottom(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_PAD_BOTTOM, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_PAD_BOTTOM, v); }
static inline void lv_style_set_pad_left(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_PAD_LEFT, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_PAD_LEFT, v); }
static inline void lv_style_set_pad_right(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_PAD_RIGHT, v); }
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 = {._int = value}; lv_style_set_prop(style, LV_STYLE_MARGIN_TOP, v); }
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 = {._int = value}; lv_style_set_prop(style, LV_STYLE_MARGIN_BOTTOM, v); }
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 = {._int = value}; lv_style_set_prop(style, LV_STYLE_MARGIN_LEFT, v); }
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 = {._int = value}; lv_style_set_prop(style, LV_STYLE_MARGIN_RIGHT, v); }
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); }
@@ -488,7 +488,7 @@ static inline void lv_style_set_bg_color_filtered(lv_style_t * style, lv_color_t
lv_style_value_t v = {._color = value}; lv_style_set_prop(style, LV_STYLE_BG_COLOR_FILTERED, v); }
static inline void lv_style_set_bg_opa(lv_style_t * style, lv_opa_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_BG_OPA, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_BG_OPA, v); }
static inline void lv_style_set_bg_grad_color(lv_style_t * style, lv_color_t value) {
lv_style_value_t v = {._color = value}; lv_style_set_prop(style, LV_STYLE_BG_GRAD_COLOR, v); }
@@ -497,16 +497,16 @@ static inline void lv_style_set_bg_grad_color_filtered(lv_style_t * style, lv_co
lv_style_value_t v = {._color = value}; lv_style_set_prop(style, LV_STYLE_BG_GRAD_COLOR_FILTERED, v); }
static inline void lv_style_set_bg_grad_dir(lv_style_t * style, lv_grad_dir_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_BG_GRAD_DIR, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_BG_GRAD_DIR, v); }
static inline void lv_style_set_bg_blend_mode(lv_style_t * style, lv_blend_mode_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_BG_BLEND_MODE, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_BG_BLEND_MODE, v); }
static inline void lv_style_set_bg_main_stop(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_BG_MAIN_STOP, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_BG_MAIN_STOP, v); }
static inline void lv_style_set_bg_grad_stop(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_BG_GRAD_STOP, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_BG_GRAD_STOP, v); }
static inline void lv_style_set_border_color(lv_style_t * style, lv_color_t value) {
lv_style_value_t v = {._color = value}; lv_style_set_prop(style, LV_STYLE_BORDER_COLOR, v); }
@@ -515,19 +515,19 @@ static inline void lv_style_set_border_color_filtered(lv_style_t * style, lv_col
lv_style_value_t v = {._color = value}; lv_style_set_prop(style, LV_STYLE_BORDER_COLOR_FILTERED, v); }
static inline void lv_style_set_border_opa(lv_style_t * style, lv_opa_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_BORDER_OPA, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_BORDER_OPA, v); }
static inline void lv_style_set_border_width(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_BORDER_WIDTH, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_BORDER_WIDTH, v); }
static inline void lv_style_set_border_side(lv_style_t * style, lv_border_side_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_BORDER_SIDE, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_BORDER_SIDE, v); }
static inline void lv_style_set_border_post(lv_style_t * style, bool value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_BORDER_POST, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_BORDER_POST, v); }
static inline void lv_style_set_border_blend_mode(lv_style_t * style, lv_blend_mode_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_BORDER_BLEND_MODE, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_BORDER_BLEND_MODE, v); }
static inline void lv_style_set_text_color(lv_style_t * style, lv_color_t value) {
lv_style_value_t v = {._color = value}; lv_style_set_prop(style, LV_STYLE_TEXT_COLOR, v); }
@@ -536,28 +536,28 @@ static inline void lv_style_set_text_color_filtered(lv_style_t * style, lv_color
lv_style_value_t v = {._color = value}; lv_style_set_prop(style, LV_STYLE_TEXT_COLOR_FILTERED, v); }
static inline void lv_style_set_text_opa(lv_style_t * style, lv_opa_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_TEXT_OPA, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_TEXT_OPA, v); }
static inline void lv_style_set_text_font(lv_style_t * style, const lv_font_t * value) {
lv_style_value_t v = {._ptr = value}; lv_style_set_prop(style, LV_STYLE_TEXT_FONT, v); }
static inline void lv_style_set_text_letter_space(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_TEXT_LETTER_SPACE, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_TEXT_LETTER_SPACE, v); }
static inline void lv_style_set_text_line_space(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_TEXT_LINE_SPACE, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_TEXT_LINE_SPACE, v); }
static inline void lv_style_set_text_decor(lv_style_t * style, lv_text_decor_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_TEXT_DECOR, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_TEXT_DECOR, v); }
static inline void lv_style_set_text_blend_mode(lv_style_t * style, lv_blend_mode_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_TEXT_BLEND_MODE, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_TEXT_BLEND_MODE, v); }
static inline void lv_style_set_img_opa(lv_style_t * style, lv_opa_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_IMG_OPA, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_IMG_OPA, v); }
static inline void lv_style_set_img_blend_mode(lv_style_t * style, lv_blend_mode_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_IMG_BLEND_MODE, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_IMG_BLEND_MODE, v); }
static inline void lv_style_set_img_recolor(lv_style_t * style, lv_color_t value) {
lv_style_value_t v = {._color = value}; lv_style_set_prop(style, LV_STYLE_IMG_RECOLOR, v); }
@@ -566,37 +566,37 @@ static inline void lv_style_set_img_recolor_filtered(lv_style_t * style, lv_colo
lv_style_value_t v = {._color = value}; lv_style_set_prop(style, LV_STYLE_IMG_RECOLOR_FILTERED, v); }
static inline void lv_style_set_img_recolor_opa(lv_style_t * style, lv_opa_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_IMG_RECOLOR_OPA, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_IMG_RECOLOR_OPA, v); }
static inline void lv_style_set_outline_width(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_OUTLINE_WIDTH, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_OUTLINE_WIDTH, v); }
static inline void lv_style_set_outline_color(lv_style_t * style, lv_color_t value) {
lv_style_value_t v = {._color = value}; lv_style_set_prop(style, LV_STYLE_OUTLINE_COLOR, v); }
static inline void lv_style_set_outline_opa(lv_style_t * style, lv_opa_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_OUTLINE_OPA, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_OUTLINE_OPA, v); }
static inline void lv_style_set_outline_pad(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_OUTLINE_PAD, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_OUTLINE_PAD, v); }
static inline void lv_style_set_outline_blend_mode(lv_style_t * style, lv_blend_mode_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_OUTLINE_BLEND_MODE, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_OUTLINE_BLEND_MODE, v); }
static inline void lv_style_set_shadow_width(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_SHADOW_WIDTH, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_SHADOW_WIDTH, v); }
static inline void lv_style_set_shadow_ofs_x(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_SHADOW_OFS_X, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_SHADOW_OFS_X, v); }
static inline void lv_style_set_shadow_ofs_y(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_SHADOW_OFS_Y, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_SHADOW_OFS_Y, v); }
static inline void lv_style_set_shadow_spread(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_SHADOW_SPREAD, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_SHADOW_SPREAD, v); }
static inline void lv_style_set_shadow_blend_mode(lv_style_t * style, lv_blend_mode_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_SHADOW_BLEND_MODE, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_SHADOW_BLEND_MODE, v); }
static inline void lv_style_set_shadow_color(lv_style_t * style, lv_color_t value) {
lv_style_value_t v = {._color = value}; lv_style_set_prop(style, LV_STYLE_SHADOW_COLOR, v); }
@@ -605,22 +605,22 @@ static inline void lv_style_set_shadow_color_filtered(lv_style_t * style, lv_col
lv_style_value_t v = {._color = value}; lv_style_set_prop(style, LV_STYLE_SHADOW_COLOR_FILTERED, v); }
static inline void lv_style_set_shadow_opa(lv_style_t * style, lv_opa_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_SHADOW_OPA, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_SHADOW_OPA, v); }
static inline void lv_style_set_line_width(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_LINE_WIDTH, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_LINE_WIDTH, v); }
static inline void lv_style_set_line_blend_mode(lv_style_t * style, lv_blend_mode_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_LINE_BLEND_MODE, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_LINE_BLEND_MODE, v); }
static inline void lv_style_set_line_dash_width(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_LINE_DASH_WIDTH, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_LINE_DASH_WIDTH, v); }
static inline void lv_style_set_line_dash_gap(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_LINE_DASH_GAP, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_LINE_DASH_GAP, v); }
static inline void lv_style_set_line_rounded(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_LINE_ROUNDED, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_LINE_ROUNDED, v); }
static inline void lv_style_set_line_color(lv_style_t * style, lv_color_t value) {
lv_style_value_t v = {._color = value}; lv_style_set_prop(style, LV_STYLE_LINE_COLOR, v); }
@@ -629,19 +629,19 @@ static inline void lv_style_set_line_color_filtered(lv_style_t * style, lv_color
lv_style_value_t v = {._color = value}; lv_style_set_prop(style, LV_STYLE_LINE_COLOR_FILTERED, v); }
static inline void lv_style_set_line_opa(lv_style_t * style, lv_opa_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_LINE_OPA, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_LINE_OPA, v); }
static inline void lv_style_set_content_src(lv_style_t * style, const char * value) {
lv_style_value_t v = {._ptr = value}; lv_style_set_prop(style, LV_STYLE_CONTENT_SRC, v); }
static inline void lv_style_set_content_align(lv_style_t * style, lv_align_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_CONTENT_ALIGN, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_CONTENT_ALIGN, v); }
static inline void lv_style_set_content_ofs_x(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_CONTENT_OFS_X, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_CONTENT_OFS_X, v); }
static inline void lv_style_set_content_ofs_y(lv_style_t * style, lv_coord_t value) {
lv_style_value_t v = {._int = value}; lv_style_set_prop(style, LV_STYLE_CONTENT_OFS_Y, v); }
lv_style_value_t v = {.num = value}; lv_style_set_prop(style, LV_STYLE_CONTENT_OFS_Y, v); }
static inline void lv_style_set_transition(lv_style_t * style, const lv_style_transiton_t * value) {
lv_style_value_t v = {._ptr = value}; lv_style_set_prop(style, LV_STYLE_TRANSITION, v); }
@@ -726,7 +726,13 @@ static inline void lv_style_set_pad_all(lv_style_t * style, lv_coord_t value)
lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop);
bool lv_style_prop_is_inherited(lv_style_prop_t prop);
uint32_t lv_style_find_index_num(lv_style_value_t v);
int32_t lv_style_get_indexed_num(uint32_t id);
uint32_t lv_style_find_index_color(lv_style_value_t v);
lv_color_t lv_style_get_indexed_color(uint32_t id);
uint32_t lv_style_find_index_ptr(lv_style_value_t v);
int32_t lv_style_get_indexed_ptr(uint32_t id);
/**
* Check whether a style is valid (initialized correctly)
-1
View File
@@ -139,7 +139,6 @@ uint32_t lv_theme_get_flags(void);
/**********************
* POST INCLUDE
*********************/
#include "lv_theme_empty.h"
#include "lv_theme_default.h"
#include "lv_theme_mono.h"
+46 -37
View File
@@ -298,6 +298,7 @@ static void basic_init(void)
style_init_reset(&styles->bg_color_gray);
lv_style_set_bg_color(&styles->bg_color_gray, COLOR_GRAY);
lv_style_set_bg_opa(&styles->bg_color_gray, LV_OPA_COVER);
lv_style_set_text_color(&styles->bg_color_gray, CARD_TEXT_COLOR);
style_init_reset(&styles->bg_color_white);
lv_style_set_bg_color(&styles->bg_color_white, LV_COLOR_WHITE);
@@ -468,23 +469,23 @@ static void textarea_init(void)
IS_LIGHT ? COLOR_BG_TEXT_DIS : lv_color_hex(0xa1adbd));
#endif
}
static void ddlist_init(void)
{
#if LV_USE_DROPDOWN != 0
style_init_reset(&styles->ddlist_page);
lv_style_set_text_line_space(&styles->ddlist_page, LV_STATE_DEFAULT, LV_DPX(20));
lv_style_set_clip_corner(&styles->ddlist_page, LV_STATE_DEFAULT, true);
style_init_reset(&styles->ddlist_sel);
lv_style_set_bg_opa(&styles->ddlist_sel, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_style_set_bg_color(&styles->ddlist_sel, LV_STATE_DEFAULT, theme.color_primary);
lv_style_set_text_color(&styles->ddlist_sel, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex3(0xfff) : lv_color_hex3(0xfff));
lv_style_set_bg_color(&styles->ddlist_sel, LV_STATE_PRESSED, CARD_PR_COLOR);
lv_style_set_text_color(&styles->ddlist_sel, LV_STATE_PRESSED, CARD_TEXT_PR_COLOR);
#endif
}
//
//static void ddlist_init(void)
//{
//#if LV_USE_DROPDOWN != 0
//
// style_init_reset(&styles->ddlist_page);
// lv_style_set_text_line_space(&styles->ddlist_page, LV_STATE_DEFAULT, LV_DPX(20));
// lv_style_set_clip_corner(&styles->ddlist_page, LV_STATE_DEFAULT, true);
//
// style_init_reset(&styles->ddlist_sel);
// lv_style_set_bg_opa(&styles->ddlist_sel, LV_STATE_DEFAULT, LV_OPA_COVER);
// lv_style_set_bg_color(&styles->ddlist_sel, LV_STATE_DEFAULT, theme.color_primary);
// lv_style_set_text_color(&styles->ddlist_sel, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex3(0xfff) : lv_color_hex3(0xfff));
// lv_style_set_bg_color(&styles->ddlist_sel, LV_STATE_PRESSED, CARD_PR_COLOR);
// lv_style_set_text_color(&styles->ddlist_sel, LV_STATE_PRESSED, CARD_TEXT_PR_COLOR);
//#endif
//}
//static void roller_init(void)
//{
@@ -577,11 +578,7 @@ lv_theme_t * lv_theme_default_init(lv_color_t color_primary, lv_color_t color_se
spinner_init();
chart_init();
textarea_init();
ddlist_init();
tabview_init();
tileview_init();
table_init();
win_init();
theme.apply_cb = theme_apply;
@@ -689,6 +686,18 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
// lv_obj_add_style(obj, LV_PART_SERIES, LV_STATE_DEFAULT, &styles->chart_series);
}
#endif
#if LV_USE_DROPDOWN
else if(lv_obj_check_type(obj, &lv_dropdown)) {
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->card);
}
else if(lv_obj_check_type(obj, &lv_dropdown_list)) {
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->card);
lv_obj_add_style(obj, LV_PART_HIGHLIGHT, LV_STATE_DEFAULT, &styles->bg_color_primary);
lv_obj_add_style(obj, LV_PART_HIGHLIGHT, LV_STATE_PRESSED, &styles->bg_color_gray);
}
#endif
#if LV_USE_BTNMATRIX
case LV_THEME_BTNMATRIX:
list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_MAIN);
@@ -745,22 +754,22 @@ case LV_THEME_OBJMASK:
break;
#endif
#if LV_USE_DROPDOWN
case LV_THEME_DROPDOWN:
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
_lv_style_list_add_style(list, &styles->card);
_lv_style_list_add_style(list, &styles->bg_click);
_lv_style_list_add_style(list, &styles->pad_small);
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
_lv_style_list_add_style(list, &styles->card);
_lv_style_list_add_style(list, &styles->ddlist_page);
_lv_style_list_add_style(list, &styles->sb);
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
_lv_style_list_add_style(list, &styles->ddlist_sel);
break;
#endif
//#if LV_USE_DROPDOWN
//case LV_THEME_DROPDOWN:
// list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
// _lv_style_list_add_style(list, &styles->card);
// _lv_style_list_add_style(list, &styles->bg_click);
// _lv_style_list_add_style(list, &styles->pad_small);
//
// list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
// _lv_style_list_add_style(list, &styles->card);
// _lv_style_list_add_style(list, &styles->ddlist_page);
// _lv_style_list_add_style(list, &styles->sb);
//
// list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
// _lv_style_list_add_style(list, &styles->ddlist_sel);
// break;
//#endif
//#if LV_USE_CHART
//case LV_THEME_CHART:
-115
View File
@@ -1,115 +0,0 @@
/**
* @file lv_theme_empty.c
*
*/
/*********************
* INCLUDES
*********************/
#include <stdint.h>
#include "../../lvgl.h" /*To see all the widgets*/
#if LV_USE_THEME_EMPTY
#include "../lv_misc/lv_gc.h"
#if defined(LV_GC_INCLUDE)
#include LV_GC_INCLUDE
#endif /* LV_ENABLE_GC */
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
lv_style_t opa_cover;
} theme_styles_t;
/**********************
* STATIC PROTOTYPES
**********************/
static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name);
static void style_init_reset(lv_style_t * style);
/**********************
* STATIC VARIABLES
**********************/
static lv_theme_t theme;
static theme_styles_t * styles;
static bool inited;
/**********************
* MACROS
**********************/
/**********************
* STATIC FUNCTIONS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Initialize the default
* @param color_primary the primary color of the theme
* @param color_secondary the secondary color for the theme
* @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...`
* @param font_small pointer to a small font
* @param font_normal pointer to a normal font
* @param font_subtitle pointer to a large font
* @param font_title pointer to a extra large font
* @return a pointer to reference this theme later
*/
lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
const lv_font_t * font_title)
{
/* This trick is required only to avoid the garbage collection of
* styles' data if LVGL is used in a binding (e.g. Micropython)
* In a general case styles could be simple `static lv_style_t my style` variables*/
if(!inited) {
LV_GC_ROOT(_lv_theme_empty_styles) = lv_mem_alloc(sizeof(theme_styles_t));
styles = (theme_styles_t *)LV_GC_ROOT(_lv_theme_empty_styles);
}
theme.color_primary = color_primary;
theme.color_secondary = color_secondary;
theme.font_small = font_small;
theme.font_normal = font_normal;
theme.font_subtitle = font_subtitle;
theme.font_title = font_title;
theme.flags = flags;
style_init_reset(&styles->opa_cover);
lv_style_set_bg_opa(&styles->opa_cover, LV_OPA_COVER);
theme.apply_cb = theme_apply;
return &theme;
}
static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
{
LV_UNUSED(th);
if(name == LV_THEME_SCR) {
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->opa_cover);
}
}
/**********************
* STATIC FUNCTIONS
**********************/
static void style_init_reset(lv_style_t * style)
{
if(inited) lv_style_reset(style);
else lv_style_init(style);
}
#endif
-57
View File
@@ -1,57 +0,0 @@
/**
* @file lv_theme_material.h
*
*/
#ifndef LV_THEME_EMPTY_H
#define LV_THEME_EMPTY_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_THEME_EMPTY
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize the default
* @param color_primary the primary color of the theme
* @param color_secondary the secondary color for the theme
* @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...`
* @param font_small pointer to a small font
* @param font_normal pointer to a normal font
* @param font_subtitle pointer to a large font
* @param font_title pointer to a extra large font
* @return a pointer to reference this theme later
*/
lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
const lv_font_t * font_title);
/**********************
* MACROS
**********************/
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_THEME_ALIEN_H*/
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-208
View File
@@ -1,208 +0,0 @@
/**
* @file lv_calendar.h
*
*/
#ifndef LV_CALENDAR_H
#define LV_CALENDAR_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_CALENDAR != 0
#include "../lv_core/lv_obj.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**
* Represents a date on the calendar object (platform-agnostic).
*/
typedef struct {
uint16_t year;
int8_t month;
int8_t day;
} lv_calendar_date_t;
/*Data of calendar*/
typedef struct {
/*None*/ /*Ext. of ancestor*/
/*New data for this type */
lv_calendar_date_t today; /*Date of today*/
lv_calendar_date_t showed_date; /*Currently visible month (day is ignored)*/
lv_calendar_date_t * highlighted_dates; /*Apply different style on these days (pointer to an
array defined by the user)*/
int8_t btn_pressing; /*-1: prev month pressing, +1 next month pressing on the header*/
uint16_t highlighted_dates_num; /*Number of elements in `highlighted_days`*/
lv_calendar_date_t pressed_date;
const char ** day_names; /*Pointer to an array with the name of the days (NULL: use default names)*/
const char ** month_names; /*Pointer to an array with the name of the month (NULL. use default names)*/
/*Styles*/
lv_style_list_t style_header;
lv_style_list_t style_day_names;
lv_style_list_t style_date_nums;
} lv_calendar_ext_t;
/** Calendar parts*/
enum {
LV_CALENDAR_PART_BG, /**< Background and "normal" date numbers style */
LV_CALENDAR_PART_HEADER, /** Calendar header style */
LV_CALENDAR_PART_DAY_NAMES, /** Day name style */
LV_CALENDAR_PART_DATE, /** Day name style */
};
typedef uint8_t lv_calendar_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a calendar objects
* @param par pointer to an object, it will be the parent of the new calendar
* @param copy pointer to a calendar object, if not NULL then the new object will be copied from it
* @return pointer to the created calendar
*/
lv_obj_t * lv_calendar_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
*=====================*/
/*=====================
* Setter functions
*====================*/
/**
* Set the today's date
* @param calendar pointer to a calendar object
* @param today pointer to an `lv_calendar_date_t` variable containing the date of today. The value
* will be saved it can be local variable too.
*/
void lv_calendar_set_today_date(lv_obj_t * calendar, lv_calendar_date_t * today);
/**
* Set the currently showed
* @param calendar pointer to a calendar object
* @param showed pointer to an `lv_calendar_date_t` variable containing the date to show. The value
* will be saved it can be local variable too.
*/
void lv_calendar_set_showed_date(lv_obj_t * calendar, lv_calendar_date_t * showed);
/**
* Set the the highlighted dates
* @param calendar pointer to a calendar object
* @param highlighted pointer to an `lv_calendar_date_t` array containing the dates. ONLY A POINTER
* WILL BE SAVED! CAN'T BE LOCAL ARRAY.
* @param date_num number of dates in the array
*/
void lv_calendar_set_highlighted_dates(lv_obj_t * calendar, lv_calendar_date_t highlighted[], uint16_t date_num);
/**
* Set the name of the days
* @param calendar pointer to a calendar object
* @param day_names pointer to an array with the names. E.g. `const char * days[7] = {"Sun", "Mon",
* ...}` Only the pointer will be saved so this variable can't be local which will be destroyed
* later.
*/
void lv_calendar_set_day_names(lv_obj_t * calendar, const char ** day_names);
/**
* Set the name of the month
* @param calendar pointer to a calendar object
* @param month_names pointer to an array with the names. E.g. `const char * days[12] = {"Jan", "Feb",
* ...}` Only the pointer will be saved so this variable can't be local which will be destroyed
* later.
*/
void lv_calendar_set_month_names(lv_obj_t * calendar, const char ** month_names);
/*=====================
* Getter functions
*====================*/
/**
* Get the today's date
* @param calendar pointer to a calendar object
* @return return pointer to an `lv_calendar_date_t` variable containing the date of today.
*/
lv_calendar_date_t * lv_calendar_get_today_date(const lv_obj_t * calendar);
/**
* Get the currently showed
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` variable containing the date is being shown.
*/
lv_calendar_date_t * lv_calendar_get_showed_date(const lv_obj_t * calendar);
/**
* Get the the pressed date.
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` variable containing the pressed date.
* `NULL` if not date pressed (e.g. the header)
*/
lv_calendar_date_t * lv_calendar_get_pressed_date(const lv_obj_t * calendar);
/**
* Get the the highlighted dates
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` array containing the dates.
*/
lv_calendar_date_t * lv_calendar_get_highlighted_dates(const lv_obj_t * calendar);
/**
* Get the number of the highlighted dates
* @param calendar pointer to a calendar object
* @return number of highlighted days
*/
uint16_t lv_calendar_get_highlighted_dates_num(const lv_obj_t * calendar);
/**
* Get the name of the days
* @param calendar pointer to a calendar object
* @return pointer to the array of day names
*/
const char ** lv_calendar_get_day_names(const lv_obj_t * calendar);
/**
* Get the name of the month
* @param calendar pointer to a calendar object
* @return pointer to the array of month names
*/
const char ** lv_calendar_get_month_names(const lv_obj_t * calendar);
/**
* Get the day of the week
* @param year a year
* @param month a month (1..12)
* @param day a day (1..31)
* @return [0..6] which means [Sun..Sat] or [Mon..Sun] depending on LV_CALENDAR_WEEK_STARTS_MONDAY
*/
uint8_t lv_calendar_get_day_of_week(uint32_t year, uint32_t month, uint32_t day);
/*=====================
* Other functions
*====================*/
/**********************
* MACROS
**********************/
#endif /*LV_USE_CALENDAR*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_CALENDAR_H*/
File diff suppressed because it is too large Load Diff
-311
View File
@@ -1,311 +0,0 @@
/**
* @file lv_list.h
*
*/
#ifndef LV_LIST_H
#define LV_LIST_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_LIST != 0
/*Testing of dependencies*/
#if LV_USE_PAGE == 0
#error "lv_list: lv_page is required. Enable it in lv_conf.h (LV_USE_PAGE 1) "
#endif
#if LV_USE_BTN == 0
#error "lv_list: lv_btn is required. Enable it in lv_conf.h (LV_USE_BTN 1) "
#endif
#if LV_USE_LABEL == 0
#error "lv_list: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "lv_page.h"
#include "lv_btn.h"
#include "lv_label.h"
#include "lv_img.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of list*/
typedef struct {
lv_page_ext_t page; /*Ext. of ancestor*/
/*New data for this type */
#if LV_USE_GROUP
lv_obj_t * last_sel_btn; /* The last selected button. It will be reverted when the list is focused again */
#endif
lv_obj_t * act_sel_btn; /* The button is currently being selected*/
} lv_list_ext_t;
/** List styles. */
enum {
LV_LIST_PART_BG = LV_PAGE_PART_BG, /**< List background style */
LV_LIST_PART_SCROLLBAR = LV_PAGE_PART_SCROLLBAR, /**< List scrollbar style. */
LV_LIST_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH, /**< List edge flash style. */
_LV_LIST_PART_VIRTUAL_LAST = _LV_PAGE_PART_VIRTUAL_LAST,
LV_LIST_PART_SCROLLABLE = LV_PAGE_PART_SCROLLABLE, /**< List scrollable area style. */
_LV_LIST_PART_REAL_LAST = _LV_PAGE_PART_REAL_LAST,
};
typedef uint8_t lv_list_style_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a list objects
* @param par pointer to an object, it will be the parent of the new list
* @param copy pointer to a list object, if not NULL then the new object will be copied from it
* @return pointer to the created list
*/
lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy);
/**
* Delete all children of the scrl object, without deleting scrl child.
* @param list pointer to an object
*/
void lv_list_clean(lv_obj_t * list);
/*======================
* Add/remove functions
*=====================*/
/**
* Add a list element to the list
* @param list pointer to list object
* @param img_fn file name of an image before the text (NULL if unused)
* @param txt text of the list element (NULL if unused)
* @return pointer to the new list element which can be customized (a button)
*/
lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * txt);
/**
* Remove the index of the button in the list
* @param list pointer to a list object
* @param index pointer to a the button's index in the list, index must be 0 <= index <
* lv_list_ext_t.size
* @return true: successfully deleted
*/
bool lv_list_remove(const lv_obj_t * list, uint16_t index);
/*=====================
* Setter functions
*====================*/
/**
* Make a button selected
* @param list pointer to a list object
* @param btn pointer to a button to select
* NULL to not select any buttons
*/
void lv_list_focus_btn(lv_obj_t * list, lv_obj_t * btn);
/**
* Set the scroll bar mode of a list
* @param list pointer to a list object
* @param sb_mode the new mode from 'lv_page_sb_mode_t' enum
*/
static inline void lv_list_set_scrollbar_mode(lv_obj_t * list, lv_scrollbar_mode_t mode)
{
lv_page_set_scrollbar_mode(list, mode);
}
/**
* Enable the scroll propagation feature. If enabled then the List will move its parent if there is
* no more space to scroll.
* @param list pointer to a List
* @param en true or false to enable/disable scroll propagation
*/
static inline void lv_list_set_scroll_propagation(lv_obj_t * list, bool en)
{
lv_page_set_scroll_propagation(list, en);
}
/**
* Enable the edge flash effect. (Show an arc when the an edge is reached)
* @param list pointer to a List
* @param en true or false to enable/disable end flash
*/
static inline void lv_list_set_edge_flash(lv_obj_t * list, bool en)
{
lv_page_set_edge_flash(list, en);
}
/**
* Set scroll animation duration on 'list_up()' 'list_down()' 'list_focus()'
* @param list pointer to a list object
* @param anim_time duration of animation [ms]
*/
static inline void lv_list_set_anim_time(lv_obj_t * list, uint16_t anim_time)
{
lv_page_set_anim_time(list, anim_time);
}
/**
* Set layout of a list
* @param list pointer to a list object
* @param layout which layout should be used
*/
void lv_list_set_layout(lv_obj_t * list, lv_layout_t layout);
/*=====================
* Getter functions
*====================*/
/**
* Get the text of a list element
* @param btn pointer to list element
* @return pointer to the text
*/
const char * lv_list_get_btn_text(const lv_obj_t * btn);
/**
* Get the label object from a list element
* @param btn pointer to a list element (button)
* @return pointer to the label from the list element or NULL if not found
*/
lv_obj_t * lv_list_get_btn_label(const lv_obj_t * btn);
/**
* Get the image object from a list element
* @param btn pointer to a list element (button)
* @return pointer to the image from the list element or NULL if not found
*/
lv_obj_t * lv_list_get_btn_img(const lv_obj_t * btn);
/**
* Get the next button from list. (Starts from the bottom button)
* @param list pointer to a list object
* @param prev_btn pointer to button. Search the next after it.
* @return pointer to the next button or NULL when no more buttons
*/
lv_obj_t * lv_list_get_prev_btn(const lv_obj_t * list, lv_obj_t * prev_btn);
/**
* Get the previous button from list. (Starts from the top button)
* @param list pointer to a list object
* @param prev_btn pointer to button. Search the previous before it.
* @return pointer to the previous button or NULL when no more buttons
*/
lv_obj_t * lv_list_get_next_btn(const lv_obj_t * list, lv_obj_t * prev_btn);
/**
* Get the index of the button in the list
* @param list pointer to a list object. If NULL, assumes btn is part of a list.
* @param btn pointer to a list element (button)
* @return the index of the button in the list, or -1 of the button not in this list
*/
int32_t lv_list_get_btn_index(const lv_obj_t * list, const lv_obj_t * btn);
/**
* Get the number of buttons in the list
* @param list pointer to a list object
* @return the number of buttons in the list
*/
uint16_t lv_list_get_size(const lv_obj_t * list);
#if LV_USE_GROUP
/**
* Get the currently selected button. Can be used while navigating in the list with a keypad.
* @param list pointer to a list object
* @return pointer to the selected button
*/
lv_obj_t * lv_list_get_btn_selected(const lv_obj_t * list);
#endif
/**
* Get layout of a list
* @param list pointer to a list object
* @return layout of the list object
*/
lv_layout_t lv_list_get_layout(lv_obj_t * list);
/**
* Get the scroll bar mode of a list
* @param list pointer to a list object
* @return scrollbar mode from 'lv_scrollbar_mode_t' enum
*/
static inline lv_scrollbar_mode_t lv_list_get_scrollbar_mode(const lv_obj_t * list)
{
return lv_page_get_scrollbar_mode(list);
}
/**
* Get the scroll propagation property
* @param list pointer to a List
* @return true or false
*/
static inline bool lv_list_get_scroll_propagation(lv_obj_t * list)
{
return lv_page_get_scroll_propagation(list);
}
/**
* Get the scroll propagation property
* @param list pointer to a List
* @return true or false
*/
static inline bool lv_list_get_edge_flash(lv_obj_t * list)
{
return lv_page_get_edge_flash(list);
}
/**
* Get scroll animation duration
* @param list pointer to a list object
* @return duration of animation [ms]
*/
static inline uint16_t lv_list_get_anim_time(const lv_obj_t * list)
{
return lv_page_get_anim_time(list);
}
/*=====================
* Other functions
*====================*/
/**
* Move the list elements up by one
* @param list pointer a to list object
*/
void lv_list_up(const lv_obj_t * list);
/**
* Move the list elements down by one
* @param list pointer to a list object
*/
void lv_list_down(const lv_obj_t * list);
/**
* Focus on a list button. It ensures that the button will be visible on the list.
* @param btn pointer to a list button to focus
* @param anim LV_ANIM_ON: scroll with animation, LV_ANIM_OFF: without animation
*/
void lv_list_focus(const lv_obj_t * btn, lv_anim_enable_t anim);
/**********************
* MACROS
**********************/
#endif /*LV_USE_LIST*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_LIST_H*/
File diff suppressed because it is too large Load Diff
-192
View File
@@ -1,192 +0,0 @@
/**
* @file lv_tabview.h
*
*/
#ifndef LV_TABVIEW_H
#define LV_TABVIEW_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_TABVIEW != 0
/*Testing of dependencies*/
#if LV_USE_BTNMATRIX == 0
#error "lv_tabview: lv_btnm is required. Enable it in lv_conf.h (LV_USE_BTNMATRIX 1) "
#endif
#if LV_USE_PAGE == 0
#error "lv_tabview: lv_page is required. Enable it in lv_conf.h (LV_USE_PAGE 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "../lv_widgets/lv_win.h"
#include "../lv_widgets/lv_page.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Position of tabview buttons. */
enum {
LV_TABVIEW_TAB_POS_NONE,
LV_TABVIEW_TAB_POS_TOP,
LV_TABVIEW_TAB_POS_BOTTOM,
LV_TABVIEW_TAB_POS_LEFT,
LV_TABVIEW_TAB_POS_RIGHT
};
typedef uint8_t lv_tabview_btns_pos_t;
/*Data of tab*/
typedef struct {
/*Ext. of ancestor*/
/*New data for this type */
lv_obj_t * btns;
lv_obj_t * indic;
lv_obj_t * content; /*A background page which holds tab's pages*/
const char ** tab_name_ptr;
lv_point_t point_last;
uint16_t tab_cur;
uint16_t tab_cnt;
#if LV_USE_ANIMATION
uint16_t anim_time;
#endif
lv_tabview_btns_pos_t btns_pos : 3;
} lv_tabview_ext_t;
enum {
LV_TABVIEW_PART_BG = LV_OBJ_PART_MAIN,
_LV_TABVIEW_PART_VIRTUAL_LAST = _LV_OBJ_PART_VIRTUAL_LAST,
LV_TABVIEW_PART_BG_SCROLLABLE = _LV_OBJ_PART_REAL_LAST,
LV_TABVIEW_PART_TAB_BG,
LV_TABVIEW_PART_TAB_BTN,
LV_TABVIEW_PART_INDIC,
_LV_TABVIEW_PART_REAL_LAST,
};
typedef uint8_t lv_tabview_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a Tab view object
* @param par pointer to an object, it will be the parent of the new tab
* @param copy pointer to a tab object, if not NULL then the new object will be copied from it
* @return pointer to the created tab
*/
lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
*=====================*/
/**
* Add a new tab with the given name
* @param tabview pointer to Tab view object where to ass the new tab
* @param name the text on the tab button
* @return pointer to the created page object (lv_page). You can create your content here
*/
lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name);
/**
* Delete all children of a tab created by `lv_tabview_add_tab`.
* @param tab pointer to a tab
*/
void lv_tabview_clean_tab(lv_obj_t * tab);
/*=====================
* Setter functions
*====================*/
/**
* Set a new tab
* @param tabview pointer to Tab view object
* @param id index of a tab to load
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t anim);
/**
* Set the name of a tab.
* @param tabview pointer to Tab view object
* @param id index of the tab the name should be set
* @param name new tab name
*/
void lv_tabview_set_tab_name(lv_obj_t * tabview, uint16_t id, char * name);
/**
* Set the animation time of tab view when a new tab is loaded
* @param tabview pointer to Tab view object
* @param anim_time time of animation in milliseconds
*/
void lv_tabview_set_anim_time(lv_obj_t * tabview, uint16_t anim_time);
/**
* Set the position of tab select buttons
* @param tabview pointer to a tab view object
* @param btns_pos which button position
*/
void lv_tabview_set_btns_pos(lv_obj_t * tabview, lv_tabview_btns_pos_t btns_pos);
/*=====================
* Getter functions
*====================*/
/**
* Get the index of the currently active tab
* @param tabview pointer to Tab view object
* @return the active tab index
*/
uint16_t lv_tabview_get_tab_act(const lv_obj_t * tabview);
/**
* Get the number of tabs
* @param tabview pointer to Tab view object
* @return tab count
*/
uint16_t lv_tabview_get_tab_count(const lv_obj_t * tabview);
/**
* Get the page (content area) of a tab
* @param tabview pointer to Tab view object
* @param id index of the tab (>= 0)
* @return pointer to page (lv_page) object
*/
lv_obj_t * lv_tabview_get_tab(const lv_obj_t * tabview, uint16_t id);
/**
* Get the animation time of tab view when a new tab is loaded
* @param tabview pointer to Tab view object
* @return time of animation in milliseconds
*/
uint16_t lv_tabview_get_anim_time(const lv_obj_t * tabview);
/**
* Get position of tab select buttons
* @param tabview pointer to a ab view object
*/
lv_tabview_btns_pos_t lv_tabview_get_btns_pos(const lv_obj_t * tabview);
/**********************
* MACROS
**********************/
#endif /*LV_USE_TABVIEW*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_TABVIEW_H*/
File diff suppressed because it is too large Load Diff
-314
View File
@@ -1,314 +0,0 @@
/**
* @file lv_win.h
*
*/
#ifndef LV_WIN_H
#define LV_WIN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_WIN != 0
/*Testing of dependencies*/
#if LV_USE_BTN == 0
#error "lv_win: lv_btn is required. Enable it in lv_conf.h (LV_USE_BTN 1) "
#endif
#if LV_USE_LABEL == 0
#error "lv_win: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
#endif
#if LV_USE_IMG == 0
#error "lv_win: lv_img is required. Enable it in lv_conf.h (LV_USE_IMG 1) "
#endif
#if LV_USE_PAGE == 0
#error "lv_win: lv_page is required. Enable it in lv_conf.h (LV_USE_PAGE 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "lv_cont.h"
#include "lv_btn.h"
#include "lv_label.h"
#include "lv_img.h"
#include "lv_page.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of window*/
typedef struct {
/*Ext. of ancestor*/
/*New data for this type */
lv_obj_t * page; /*Pointer to a page which holds the content*/
lv_obj_t * header; /*Pointer to the header container of the window*/
char * title_txt; /*Pointer to the title label of the window*/
lv_coord_t btn_w; /*Width of the control buttons*/
uint8_t title_txt_align; /*Control the alignment of the header text*/
} lv_win_ext_t;
/** Window parts. */
enum {
LV_WIN_PART_BG = LV_OBJ_PART_MAIN, /**< Window object background style. */
_LV_WIN_PART_VIRTUAL_LAST,
LV_WIN_PART_HEADER = _LV_OBJ_PART_REAL_LAST, /**< Window titlebar background style. */
LV_WIN_PART_CONTENT_SCROLLABLE, /**< Window content style. */
LV_WIN_PART_SCROLLBAR, /**< Window scrollbar style. */
_LV_WIN_PART_REAL_LAST
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a window objects
* @param par pointer to an object, it will be the parent of the new window
* @param copy pointer to a window object, if not NULL then the new object will be copied from it
* @return pointer to the created window
*/
lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy);
/**
* Delete all children of the scrl object, without deleting scrl child.
* @param win pointer to an object
*/
void lv_win_clean(lv_obj_t * win);
/*======================
* Add/remove functions
*=====================*/
/**
* Add control button on the right side of the window header
* @param win pointer to a window object
* @param img_src an image source ('lv_img_t' variable, path to file or a symbol)
* @return pointer to the created button object
*/
lv_obj_t * lv_win_add_btn_right(lv_obj_t * win, const void * img_src);
/**
* Add control button on the left side of the window header
* @param win pointer to a window object
* @param img_src an image source ('lv_img_t' variable, path to file or a symbol)
* @return pointer to the created button object
*/
lv_obj_t * lv_win_add_btn_left(lv_obj_t * win, const void * img_src);
/*=====================
* Setter functions
*====================*/
/**
* Can be assigned to a window control button to close the window
* @param btn pointer to the control button on the widows header
* @param event the event type
*/
void lv_win_close_event_cb(lv_obj_t * btn, lv_event_t event);
/**
* Set the title of a window
* @param win pointer to a window object
* @param title string of the new title
*/
void lv_win_set_title(lv_obj_t * win, const char * title);
/**
* Set the control button size of a window
* @param win pointer to a window object
* @return control button size
*/
void lv_win_set_header_height(lv_obj_t * win, lv_coord_t size);
/**
* Set the width of the control buttons on the header
* @param win pointer to a window object
* @param width width of the control button. 0: to make them square automatically.
*/
void lv_win_set_btn_width(lv_obj_t * win, lv_coord_t width);
/**
* Set the size of the content area.
* @param win pointer to a window object
* @param w width
* @param h height (the window will be higher with the height of the header)
*/
void lv_win_set_content_size(lv_obj_t * win, lv_coord_t w, lv_coord_t h);
/**
* Set the layout of the window
* @param win pointer to a window object
* @param layout the layout from 'lv_layout_t'
*/
void lv_win_set_layout(lv_obj_t * win, lv_layout_t layout);
/**
* Set the scroll bar mode of a window
* @param win pointer to a window object
* @param sb_mode the new scroll bar mode from 'lv_scrollbar_mode_t'
*/
void lv_win_set_scrollbar_mode(lv_obj_t * win, lv_scrollbar_mode_t sb_mode);
/**
* Set focus animation duration on `lv_win_focus()`
* @param win pointer to a window object
* @param anim_time duration of animation [ms]
*/
void lv_win_set_anim_time(lv_obj_t * win, uint16_t anim_time);
/**
* Set drag status of a window. If set to 'true' window can be dragged like on a PC.
* @param win pointer to a window object
* @param en whether dragging is enabled
*/
void lv_win_set_drag(lv_obj_t * win, bool en);
/**
* Set alignment of title text in window header.
* @param win pointer to a window object
* @param alignment set the type of alignment with LV_TXT_FLAGS
*/
void lv_win_title_set_alignment(lv_obj_t * win, uint8_t alignment);
/*=====================
* Getter functions
*====================*/
/**
* Get the title of a window
* @param win pointer to a window object
* @return title string of the window
*/
const char * lv_win_get_title(const lv_obj_t * win);
/**
* Get the content holder object of window (`lv_page`) to allow additional customization
* @param win pointer to a window object
* @return the Page object where the window's content is
*/
lv_obj_t * lv_win_get_content(const lv_obj_t * win);
/**
* Get the header height
* @param win pointer to a window object
* @return header height
*/
lv_coord_t lv_win_get_header_height(const lv_obj_t * win);
/**
* Get the width of the control buttons on the header
* @param win pointer to a window object
* @return width of the control button. 0: square.
*/
lv_coord_t lv_win_get_btn_width(lv_obj_t * win);
/**
* Get the pointer of a widow from one of its control button.
* It is useful in the action of the control buttons where only button is known.
* @param ctrl_btn pointer to a control button of a window
* @return pointer to the window of 'ctrl_btn'
*/
lv_obj_t * lv_win_get_from_btn(const lv_obj_t * ctrl_btn);
/**
* Get the layout of a window
* @param win pointer to a window object
* @return the layout of the window (from 'lv_layout_t')
*/
lv_layout_t lv_win_get_layout(lv_obj_t * win);
/**
* Get the scroll bar mode of a window
* @param win pointer to a window object
* @return the scroll bar mode of the window (from 'lv_sb_mode_t')
*/
lv_scrollbar_mode_t lv_win_get_sb_mode(lv_obj_t * win);
/**
* Get focus animation duration
* @param win pointer to a window object
* @return duration of animation [ms]
*/
uint16_t lv_win_get_anim_time(const lv_obj_t * win);
/**
* Get width of the content area (page scrollable) of the window
* @param win pointer to a window object
* @return the width of the content area
*/
lv_coord_t lv_win_get_width(lv_obj_t * win);
/**
* Get drag status of a window. If set to 'true' window can be dragged like on a PC.
* @param win pointer to a window object
* @return whether window is draggable
*/
static inline bool lv_win_get_drag(const lv_obj_t * win)
{
return lv_obj_get_drag(win);
}
/**
* Get the current alignment of title text in window header.
* @param win pointer to a window object
*/
uint8_t lv_win_title_get_alignment(lv_obj_t * win);
/*=====================
* Other functions
*====================*/
/**
* Focus on an object. It ensures that the object will be visible in the window.
* @param win pointer to a window object
* @param obj pointer to an object to focus (must be in the window)
* @param anim_en LV_ANIM_ON focus with an animation; LV_ANIM_OFF focus without animation
*/
void lv_win_focus(lv_obj_t * win, lv_obj_t * obj, lv_anim_enable_t anim_en);
/**
* Scroll the window horizontally
* @param win pointer to a window object
* @param dist the distance to scroll (< 0: scroll right; > 0 scroll left)
*/
static inline void lv_win_scroll_hor(lv_obj_t * win, lv_coord_t dist)
{
lv_win_ext_t * ext = (lv_win_ext_t *)lv_obj_get_ext_attr(win);
lv_page_scroll_hor(ext->page, dist);
}
/**
* Scroll the window vertically
* @param win pointer to a window object
* @param dist the distance to scroll (< 0: scroll down; > 0 scroll up)
*/
static inline void lv_win_scroll_ver(lv_obj_t * win, lv_coord_t dist)
{
lv_win_ext_t * ext = (lv_win_ext_t *)lv_obj_get_ext_attr(win);
lv_page_scroll_ver(ext->page, dist);
}
/**********************
* MACROS
**********************/
#endif /*LV_USE_WIN*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_WIN_H*/