Lines Matching refs:obj

23     lv_obj_t * obj;  member
45 static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selector);
46 static _lv_obj_style_t * get_trans_style(lv_obj_t * obj, uint32_t part);
47 static lv_style_res_t get_prop_core(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, lv_…
48 static void report_style_change_core(void * style, lv_obj_t * obj);
49 static void refresh_children_style(lv_obj_t * obj);
50 static bool trans_del(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, trans_t * tr_limit);
54 static lv_layer_type_t calculate_layer_type(lv_obj_t * obj);
55 static void fade_anim_cb(void * obj, int32_t v);
76 void lv_obj_add_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector) in lv_obj_add_style() argument
78 trans_del(obj, selector, LV_STYLE_PROP_ANY, NULL); in lv_obj_add_style()
82 for(i = 0; i < obj->style_cnt; i++) { in lv_obj_add_style()
83 if(obj->styles[i].is_trans) continue; in lv_obj_add_style()
84 if(obj->styles[i].is_local) continue; in lv_obj_add_style()
91 obj->style_cnt++; in lv_obj_add_style()
92 obj->styles = lv_mem_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t)); in lv_obj_add_style()
95 for(j = obj->style_cnt - 1; j > i ; j--) { in lv_obj_add_style()
96 obj->styles[j] = obj->styles[j - 1]; in lv_obj_add_style()
99 lv_memset_00(&obj->styles[i], sizeof(_lv_obj_style_t)); in lv_obj_add_style()
100 obj->styles[i].style = style; in lv_obj_add_style()
101 obj->styles[i].selector = selector; in lv_obj_add_style()
103 lv_obj_refresh_style(obj, selector, LV_STYLE_PROP_ANY); in lv_obj_add_style()
106 void lv_obj_remove_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector) in lv_obj_remove_style() argument
115 while(i < obj->style_cnt) { in lv_obj_remove_style()
116 lv_state_t state_act = lv_obj_style_get_selector_state(obj->styles[i].selector); in lv_obj_remove_style()
117 lv_part_t part_act = lv_obj_style_get_selector_part(obj->styles[i].selector); in lv_obj_remove_style()
120 (style != NULL && style != obj->styles[i].style)) { in lv_obj_remove_style()
125 if(obj->styles[i].is_trans) { in lv_obj_remove_style()
126 trans_del(obj, part, LV_STYLE_PROP_ANY, NULL); in lv_obj_remove_style()
129 if(obj->styles[i].is_local || obj->styles[i].is_trans) { in lv_obj_remove_style()
130 lv_style_reset(obj->styles[i].style); in lv_obj_remove_style()
131 lv_mem_free(obj->styles[i].style); in lv_obj_remove_style()
132 obj->styles[i].style = NULL; in lv_obj_remove_style()
137 for(j = i; j < (uint32_t)obj->style_cnt - 1 ; j++) { in lv_obj_remove_style()
138 obj->styles[j] = obj->styles[j + 1]; in lv_obj_remove_style()
141 obj->style_cnt--; in lv_obj_remove_style()
142 obj->styles = lv_mem_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t)); in lv_obj_remove_style()
149 lv_obj_refresh_style(obj, part, prop); in lv_obj_remove_style()
167 void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style_prop_t prop) in lv_obj_refresh_style() argument
169 LV_ASSERT_OBJ(obj, MY_CLASS); in lv_obj_refresh_style()
173 lv_obj_invalidate(obj); in lv_obj_refresh_style()
185 lv_obj_get_style_height(obj, 0) == LV_SIZE_CONTENT || in lv_obj_refresh_style()
186 lv_obj_get_style_width(obj, 0) == LV_SIZE_CONTENT) { in lv_obj_refresh_style()
187 lv_event_send(obj, LV_EVENT_STYLE_CHANGED, NULL); in lv_obj_refresh_style()
188 lv_obj_mark_layout_as_dirty(obj); in lv_obj_refresh_style()
192 lv_obj_t * parent = lv_obj_get_parent(obj); in lv_obj_refresh_style()
198 lv_layer_type_t layer_type = calculate_layer_type(obj); in lv_obj_refresh_style()
199 if(obj->spec_attr) obj->spec_attr->layer_type = layer_type; in lv_obj_refresh_style()
201 lv_obj_allocate_spec_attr(obj); in lv_obj_refresh_style()
202 obj->spec_attr->layer_type = layer_type; in lv_obj_refresh_style()
207 lv_obj_refresh_ext_draw_size(obj); in lv_obj_refresh_style()
209 lv_obj_invalidate(obj); in lv_obj_refresh_style()
213 refresh_children_style(obj); in lv_obj_refresh_style()
223 lv_style_value_t lv_obj_get_style_prop(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop) in lv_obj_get_style_prop() argument
228 while(obj) { in lv_obj_get_style_prop()
229 found = get_prop_core(obj, part, prop, &value_act); in lv_obj_get_style_prop()
240 obj = lv_obj_get_parent(obj); in lv_obj_get_style_prop()
245 const lv_obj_class_t * cls = obj->class_p; in lv_obj_get_style_prop()
270 void lv_obj_set_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t value, in lv_obj_set_local_style_prop() argument
273 lv_style_t * style = get_local_style(obj, selector); in lv_obj_set_local_style_prop()
275 lv_obj_refresh_style(obj, selector, prop); in lv_obj_set_local_style_prop()
278 void lv_obj_set_local_style_prop_meta(lv_obj_t * obj, lv_style_prop_t prop, uint16_t meta, in lv_obj_set_local_style_prop_meta() argument
281 lv_style_t * style = get_local_style(obj, selector); in lv_obj_set_local_style_prop_meta()
283 lv_obj_refresh_style(obj, selector, prop); in lv_obj_set_local_style_prop_meta()
286 lv_style_res_t lv_obj_get_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t *… in lv_obj_get_local_style_prop() argument
290 for(i = 0; i < obj->style_cnt; i++) { in lv_obj_get_local_style_prop()
291 if(obj->styles[i].is_local && in lv_obj_get_local_style_prop()
292 obj->styles[i].selector == selector) { in lv_obj_get_local_style_prop()
293 return lv_style_get_prop(obj->styles[i].style, prop, value); in lv_obj_get_local_style_prop()
300 bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selec… in lv_obj_remove_local_style_prop() argument
302 LV_ASSERT_OBJ(obj, MY_CLASS); in lv_obj_remove_local_style_prop()
306 for(i = 0; i < obj->style_cnt; i++) { in lv_obj_remove_local_style_prop()
307 if(obj->styles[i].is_local && in lv_obj_remove_local_style_prop()
308 obj->styles[i].selector == selector) { in lv_obj_remove_local_style_prop()
314 if(i == obj->style_cnt) return false; in lv_obj_remove_local_style_prop()
316 lv_res_t res = lv_style_remove_prop(obj->styles[i].style, prop); in lv_obj_remove_local_style_prop()
318 lv_obj_refresh_style(obj, selector, prop); in lv_obj_remove_local_style_prop()
324 void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t prev_state, lv_stat… in _lv_obj_style_create_transition() argument
330 obj->skip_trans = 1; in _lv_obj_style_create_transition()
331 obj->state = prev_state; in _lv_obj_style_create_transition()
332 lv_style_value_t v1 = lv_obj_get_style_prop(obj, part, tr_dsc->prop); in _lv_obj_style_create_transition()
333 obj->state = new_state; in _lv_obj_style_create_transition()
334 lv_style_value_t v2 = lv_obj_get_style_prop(obj, part, tr_dsc->prop); in _lv_obj_style_create_transition()
335 obj->skip_trans = 0; in _lv_obj_style_create_transition()
338 obj->state = prev_state; in _lv_obj_style_create_transition()
339 v1 = lv_obj_get_style_prop(obj, part, tr_dsc->prop); in _lv_obj_style_create_transition()
340 obj->state = new_state; in _lv_obj_style_create_transition()
342 _lv_obj_style_t * style_trans = get_trans_style(obj, part); in _lv_obj_style_create_transition()
347 lv_coord_t whalf = lv_obj_get_width(obj) / 2; in _lv_obj_style_create_transition()
348 lv_coord_t hhalf = lv_obj_get_height(obj) / 2; in _lv_obj_style_create_transition()
359 tr->obj = obj; in _lv_obj_style_create_transition()
380 lv_style_value_t _lv_obj_style_apply_color_filter(const lv_obj_t * obj, uint32_t part, lv_style_val… in _lv_obj_style_apply_color_filter() argument
382 if(obj == NULL) return v; in _lv_obj_style_apply_color_filter()
383 const lv_color_filter_dsc_t * f = lv_obj_get_style_color_filter_dsc(obj, part); in _lv_obj_style_apply_color_filter()
385 lv_opa_t f_opa = lv_obj_get_style_color_filter_opa(obj, part); in _lv_obj_style_apply_color_filter()
391 _lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t sta… in _lv_obj_style_state_compare() argument
397 for(i = 0; i < obj->style_cnt; i++) { in _lv_obj_style_state_compare()
398 if(obj->styles[i].is_trans) continue; in _lv_obj_style_state_compare()
400 lv_state_t state_act = lv_obj_style_get_selector_state(obj->styles[i].selector); in _lv_obj_style_state_compare()
405 lv_style_t * style = obj->styles[i].style; in _lv_obj_style_state_compare()
453 void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay) in lv_obj_fade_in() argument
457 lv_anim_set_var(&a, obj); in lv_obj_fade_in()
466 void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay) in lv_obj_fade_out() argument
470 lv_anim_set_var(&a, obj); in lv_obj_fade_out()
471 lv_anim_set_values(&a, lv_obj_get_style_opa(obj, 0), LV_OPA_TRANSP); in lv_obj_fade_out()
488 lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj, lv_part_t part, con… in lv_obj_calculate_style_text_align() argument
490 lv_text_align_t align = lv_obj_get_style_text_align(obj, part); in lv_obj_calculate_style_text_align()
491 lv_base_dir_t base_dir = lv_obj_get_style_base_dir(obj, part); in lv_obj_calculate_style_text_align()
496 lv_opa_t lv_obj_get_style_opa_recursive(const lv_obj_t * obj, lv_part_t part) in lv_obj_get_style_opa_recursive() argument
499 lv_opa_t opa_obj = lv_obj_get_style_opa(obj, part); in lv_obj_get_style_opa_recursive()
511 obj = lv_obj_get_parent(obj); in lv_obj_get_style_opa_recursive()
514 while(obj) { in lv_obj_get_style_opa_recursive()
515 opa_obj = lv_obj_get_style_opa(obj, part); in lv_obj_get_style_opa_recursive()
521 obj = lv_obj_get_parent(obj); in lv_obj_get_style_opa_recursive()
540 static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selector) in get_local_style() argument
543 for(i = 0; i < obj->style_cnt; i++) { in get_local_style()
544 if(obj->styles[i].is_local && in get_local_style()
545 obj->styles[i].selector == selector) { in get_local_style()
546 return obj->styles[i].style; in get_local_style()
550 obj->style_cnt++; in get_local_style()
551 obj->styles = lv_mem_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t)); in get_local_style()
552 LV_ASSERT_MALLOC(obj->styles); in get_local_style()
554 for(i = obj->style_cnt - 1; i > 0 ; i--) { in get_local_style()
557 if(obj->styles[i - 1].is_local || obj->styles[i - 1].is_trans) break; in get_local_style()
558 obj->styles[i] = obj->styles[i - 1]; in get_local_style()
561 lv_memset_00(&obj->styles[i], sizeof(_lv_obj_style_t)); in get_local_style()
562 obj->styles[i].style = lv_mem_alloc(sizeof(lv_style_t)); in get_local_style()
563 lv_style_init(obj->styles[i].style); in get_local_style()
564 obj->styles[i].is_local = 1; in get_local_style()
565 obj->styles[i].selector = selector; in get_local_style()
566 return obj->styles[i].style; in get_local_style()
576 static _lv_obj_style_t * get_trans_style(lv_obj_t * obj, lv_style_selector_t selector) in get_trans_style() argument
579 for(i = 0; i < obj->style_cnt; i++) { in get_trans_style()
580 if(obj->styles[i].is_trans && obj->styles[i].selector == selector) break; in get_trans_style()
584 if(i != obj->style_cnt) return &obj->styles[i]; in get_trans_style()
586 obj->style_cnt++; in get_trans_style()
587 obj->styles = lv_mem_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t)); in get_trans_style()
589 for(i = obj->style_cnt - 1; i > 0 ; i--) { in get_trans_style()
590 obj->styles[i] = obj->styles[i - 1]; in get_trans_style()
593 lv_memset_00(&obj->styles[0], sizeof(_lv_obj_style_t)); in get_trans_style()
594 obj->styles[0].style = lv_mem_alloc(sizeof(lv_style_t)); in get_trans_style()
595 lv_style_init(obj->styles[0].style); in get_trans_style()
596 obj->styles[0].is_trans = 1; in get_trans_style()
597 obj->styles[0].selector = selector; in get_trans_style()
598 return &obj->styles[0]; in get_trans_style()
601 static lv_style_res_t get_prop_core(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, lv_… in get_prop_core() argument
605 lv_state_t state = obj->state; in get_prop_core()
608 bool skip_trans = obj->skip_trans; in get_prop_core()
611 for(i = 0; i < obj->style_cnt; i++) { in get_prop_core()
612 _lv_obj_style_t * obj_style = &obj->styles[i]; in get_prop_core()
616 lv_part_t part_act = lv_obj_style_get_selector_part(obj->styles[i].selector); in get_prop_core()
630 for(; i < obj->style_cnt; i++) { in get_prop_core()
631 if((obj->styles[i].style->has_group & group) == 0) continue; in get_prop_core()
632 _lv_obj_style_t * obj_style = &obj->styles[i]; in get_prop_core()
633 lv_part_t part_act = lv_obj_style_get_selector_part(obj->styles[i].selector); in get_prop_core()
634 lv_state_t state_act = lv_obj_style_get_selector_state(obj->styles[i].selector); in get_prop_core()
673 static void report_style_change_core(void * style, lv_obj_t * obj) in report_style_change_core() argument
676 for(i = 0; i < obj->style_cnt; i++) { in report_style_change_core()
677 if(style == NULL || obj->styles[i].style == style) { in report_style_change_core()
678 lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY); in report_style_change_core()
683 uint32_t child_cnt = lv_obj_get_child_cnt(obj); in report_style_change_core()
685 report_style_change_core(style, obj->spec_attr->children[i]); in report_style_change_core()
694 static void refresh_children_style(lv_obj_t * obj) in refresh_children_style() argument
697 uint32_t child_cnt = lv_obj_get_child_cnt(obj); in refresh_children_style()
699 lv_obj_t * child = obj->spec_attr->children[i]; in refresh_children_style()
717 static bool trans_del(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, trans_t * tr_limit) in trans_del() argument
729 …if(tr->obj == obj && (part == tr->selector || part == LV_PART_ANY) && (prop == tr->prop || prop ==… in trans_del()
733 for(i = 0; i < obj->style_cnt; i++) { in trans_del()
734 … if(obj->styles[i].is_trans && (part == LV_PART_ANY || obj->styles[i].selector == part)) { in trans_del()
735 lv_style_remove_prop(obj->styles[i].style, tr->prop); in trans_del()
754 lv_obj_t * obj = tr->obj; in trans_anim_cb() local
757 for(i = 0; i < obj->style_cnt; i++) { in trans_anim_cb()
758 if(obj->styles[i].is_trans == 0 || obj->styles[i].selector != tr->selector) continue; in trans_anim_cb()
801 if(lv_style_get_prop(obj->styles[i].style, tr->prop, &old_value)) { in trans_anim_cb()
807 lv_style_set_prop(obj->styles[i].style, tr->prop, value_final); in trans_anim_cb()
808 if(refr) lv_obj_refresh_style(tr->obj, tr->selector, tr->prop); in trans_anim_cb()
820 tr->start_value = lv_obj_get_style_prop(tr->obj, part, tr->prop); in trans_anim_start_cb()
827 trans_del(tr->obj, part, prop_tmp, tr); in trans_anim_start_cb()
831 _lv_obj_style_t * style_trans = get_trans_style(tr->obj, tr->selector); in trans_anim_start_cb()
839 lv_obj_t * obj = tr->obj; in trans_anim_ready_cb() local
848 …if(tr_i != tr && tr_i->obj == tr->obj && tr_i->selector == tr->selector && tr_i->prop == tr->prop)… in trans_anim_ready_cb()
856 for(i = 0; i < obj->style_cnt; i++) { in trans_anim_ready_cb()
857 if(obj->styles[i].is_trans && obj->styles[i].selector == tr->selector) { in trans_anim_ready_cb()
861 _lv_obj_style_t * obj_style = &obj->styles[i]; in trans_anim_ready_cb()
864 if(lv_style_is_empty(obj->styles[i].style)) { in trans_anim_ready_cb()
865 lv_obj_remove_style(obj, obj_style->style, obj_style->selector); in trans_anim_ready_cb()
874 static lv_layer_type_t calculate_layer_type(lv_obj_t * obj) in calculate_layer_type() argument
876 if(lv_obj_get_style_transform_angle(obj, 0) != 0) return LV_LAYER_TYPE_TRANSFORM; in calculate_layer_type()
877 if(lv_obj_get_style_transform_zoom(obj, 0) != 256) return LV_LAYER_TYPE_TRANSFORM; in calculate_layer_type()
878 if(lv_obj_get_style_opa_layered(obj, 0) != LV_OPA_COVER) return LV_LAYER_TYPE_SIMPLE; in calculate_layer_type()
880 if(lv_obj_get_style_blend_mode(obj, 0) != LV_BLEND_MODE_NORMAL) return LV_LAYER_TYPE_SIMPLE; in calculate_layer_type()
885 static void fade_anim_cb(void * obj, int32_t v) in fade_anim_cb() argument
887 lv_obj_set_style_opa(obj, v, 0); in fade_anim_cb()