Lines Matching refs:obj
29 static void lv_obj_del_async_cb(void * obj);
30 static void obj_del_core(lv_obj_t * obj);
31 static lv_obj_tree_walk_res_t walk_core(lv_obj_t * obj, lv_obj_tree_walk_cb_t cb, void * user_data);
45 void lv_obj_del(lv_obj_t * obj) in lv_obj_del() argument
47 LV_LOG_TRACE("begin (delete %p)", (void *)obj); in lv_obj_del()
48 LV_ASSERT_OBJ(obj, MY_CLASS); in lv_obj_del()
49 lv_obj_invalidate(obj); in lv_obj_del()
51 lv_obj_t * par = lv_obj_get_parent(obj); in lv_obj_del()
59 disp = lv_obj_get_disp(obj); in lv_obj_del()
61 if(disp->act_scr == obj) act_scr_del = true; in lv_obj_del()
64 obj_del_core(obj); in lv_obj_del()
82 LV_LOG_TRACE("finished (delete %p)", (void *)obj); in lv_obj_del()
85 void lv_obj_clean(lv_obj_t * obj) in lv_obj_clean() argument
87 LV_LOG_TRACE("begin (delete %p)", (void *)obj); in lv_obj_clean()
88 LV_ASSERT_OBJ(obj, MY_CLASS); in lv_obj_clean()
90 lv_obj_invalidate(obj); in lv_obj_clean()
92 lv_obj_t * child = lv_obj_get_child(obj, 0); in lv_obj_clean()
95 child = lv_obj_get_child(obj, 0); in lv_obj_clean()
98 lv_obj_scroll_to(obj, 0, 0, LV_ANIM_OFF); in lv_obj_clean()
99 if(obj->spec_attr) { in lv_obj_clean()
100 obj->spec_attr->scroll.x = 0; in lv_obj_clean()
101 obj->spec_attr->scroll.y = 0; in lv_obj_clean()
106 LV_LOG_TRACE("finished (delete %p)", (void *)obj); in lv_obj_clean()
109 void lv_obj_del_delayed(lv_obj_t * obj, uint32_t delay_ms) in lv_obj_del_delayed() argument
113 lv_anim_set_var(&a, obj); in lv_obj_del_delayed()
126 void lv_obj_del_async(lv_obj_t * obj) in lv_obj_del_async() argument
128 LV_ASSERT_OBJ(obj, MY_CLASS); in lv_obj_del_async()
129 lv_async_call(lv_obj_del_async_cb, obj); in lv_obj_del_async()
132 void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent) in lv_obj_set_parent() argument
134 LV_ASSERT_OBJ(obj, MY_CLASS); in lv_obj_set_parent()
137 if(obj->parent == NULL) { in lv_obj_set_parent()
147 lv_obj_invalidate(obj); in lv_obj_set_parent()
151 lv_obj_t * old_parent = obj->parent; in lv_obj_set_parent()
154 for(i = lv_obj_get_index(obj); i <= (int32_t)lv_obj_get_child_cnt(old_parent) - 2; i++) { in lv_obj_set_parent()
171 parent->spec_attr->children[lv_obj_get_child_cnt(parent) - 1] = obj; in lv_obj_set_parent()
173 obj->parent = parent; in lv_obj_set_parent()
178 lv_event_send(old_parent, LV_EVENT_CHILD_CHANGED, obj); in lv_obj_set_parent()
182 lv_event_send(parent, LV_EVENT_CHILD_CHANGED, obj); in lv_obj_set_parent()
185 lv_obj_mark_layout_as_dirty(obj); in lv_obj_set_parent()
187 lv_obj_invalidate(obj); in lv_obj_set_parent()
190 void lv_obj_move_to_index(lv_obj_t * obj, int32_t index) in lv_obj_move_to_index() argument
192 LV_ASSERT_OBJ(obj, MY_CLASS); in lv_obj_move_to_index()
195 index = lv_obj_get_child_cnt(lv_obj_get_parent(obj)) + index; in lv_obj_move_to_index()
198 const int32_t old_index = lv_obj_get_index(obj); in lv_obj_move_to_index()
200 lv_obj_t * parent = lv_obj_get_parent(obj); in lv_obj_move_to_index()
220 parent->spec_attr->children[index] = obj; in lv_obj_move_to_index()
255 lv_obj_t * lv_obj_get_screen(const lv_obj_t * obj) in lv_obj_get_screen() argument
257 LV_ASSERT_OBJ(obj, MY_CLASS); in lv_obj_get_screen()
259 const lv_obj_t * par = obj; in lv_obj_get_screen()
270 lv_disp_t * lv_obj_get_disp(const lv_obj_t * obj) in lv_obj_get_disp() argument
272 LV_ASSERT_OBJ(obj, MY_CLASS); in lv_obj_get_disp()
276 if(obj->parent == NULL) scr = obj; /*`obj` is a screen*/ in lv_obj_get_disp()
277 else scr = lv_obj_get_screen(obj); /*get the screen of `obj`*/ in lv_obj_get_disp()
291 lv_obj_t * lv_obj_get_parent(const lv_obj_t * obj) in lv_obj_get_parent() argument
293 if(obj == NULL) return NULL; in lv_obj_get_parent()
294 LV_ASSERT_OBJ(obj, MY_CLASS); in lv_obj_get_parent()
296 return obj->parent; in lv_obj_get_parent()
299 lv_obj_t * lv_obj_get_child(const lv_obj_t * obj, int32_t id) in lv_obj_get_child() argument
301 LV_ASSERT_OBJ(obj, MY_CLASS); in lv_obj_get_child()
303 if(obj->spec_attr == NULL) return NULL; in lv_obj_get_child()
307 id = obj->spec_attr->child_cnt + id; in lv_obj_get_child()
315 if(idu >= obj->spec_attr->child_cnt) return NULL; in lv_obj_get_child()
316 else return obj->spec_attr->children[id]; in lv_obj_get_child()
319 uint32_t lv_obj_get_child_cnt(const lv_obj_t * obj) in lv_obj_get_child_cnt() argument
321 LV_ASSERT_OBJ(obj, MY_CLASS); in lv_obj_get_child_cnt()
322 if(obj->spec_attr == NULL) return 0; in lv_obj_get_child_cnt()
323 return obj->spec_attr->child_cnt; in lv_obj_get_child_cnt()
326 uint32_t lv_obj_get_index(const lv_obj_t * obj) in lv_obj_get_index() argument
328 LV_ASSERT_OBJ(obj, MY_CLASS); in lv_obj_get_index()
330 lv_obj_t * parent = lv_obj_get_parent(obj); in lv_obj_get_index()
335 if(lv_obj_get_child(parent, i) == obj) return i; in lv_obj_get_index()
350 static void lv_obj_del_async_cb(void * obj) in lv_obj_del_async_cb() argument
352 LV_ASSERT_OBJ(obj, MY_CLASS); in lv_obj_del_async_cb()
354 lv_obj_del(obj); in lv_obj_del_async_cb()
357 static void obj_del_core(lv_obj_t * obj) in obj_del_core() argument
360 lv_res_t res = lv_event_send(obj, LV_EVENT_DELETE, NULL); in obj_del_core()
364 lv_obj_t * child = lv_obj_get_child(obj, 0); in obj_del_core()
367 child = lv_obj_get_child(obj, 0); in obj_del_core()
370 lv_group_t * group = lv_obj_get_group(obj); in obj_del_core()
375 if(indev->proc.types.pointer.act_obj == obj || indev->proc.types.pointer.last_obj == obj) { in obj_del_core()
376 lv_indev_reset(indev, obj); in obj_del_core()
378 if(indev->proc.types.pointer.last_pressed == obj) { in obj_del_core()
382 if(indev->group == group && obj == lv_indev_get_obj_act()) { in obj_del_core()
383 lv_indev_reset(indev, obj); in obj_del_core()
389 _lv_obj_destruct(obj); in obj_del_core()
392 if(obj->parent == NULL) { in obj_del_core()
393 lv_disp_t * disp = lv_obj_get_disp(obj); in obj_del_core()
397 if(disp->screens[i] == obj) break; in obj_del_core()
409 uint32_t id = lv_obj_get_index(obj); in obj_del_core()
411 for(i = id; i < obj->parent->spec_attr->child_cnt - 1; i++) { in obj_del_core()
412 obj->parent->spec_attr->children[i] = obj->parent->spec_attr->children[i + 1]; in obj_del_core()
414 obj->parent->spec_attr->child_cnt--; in obj_del_core()
415 obj->parent->spec_attr->children = lv_mem_realloc(obj->parent->spec_attr->children, in obj_del_core()
416 … obj->parent->spec_attr->child_cnt * sizeof(lv_obj_t *)); in obj_del_core()
420 lv_mem_free(obj); in obj_del_core()
424 static lv_obj_tree_walk_res_t walk_core(lv_obj_t * obj, lv_obj_tree_walk_cb_t cb, void * user_data) in walk_core() argument
428 if(obj == NULL) { in walk_core()
440 res = cb(obj, user_data); in walk_core()
446 for(i = 0; i < lv_obj_get_child_cnt(obj); i++) { in walk_core()
447 res = walk_core(lv_obj_get_child(obj, i), cb, user_data); in walk_core()