From 8c5c8ed82a9996cefeecadc99f349f440eb457de Mon Sep 17 00:00:00 2001 From: Ali Rostami <9710249+ali-rostami@users.noreply.github.com> Date: Sun, 19 May 2019 10:00:59 +0430 Subject: [PATCH] defining lv_group_remove_all_objs `lv_group_remove_all_objs` is a function for removing all objects from a group and making it free of objects. --- src/lv_core/lv_group.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/lv_core/lv_group.c b/src/lv_core/lv_group.c index fd5f25753..9a3cb6b35 100644 --- a/src/lv_core/lv_group.c +++ b/src/lv_core/lv_group.c @@ -193,6 +193,28 @@ void lv_group_remove_obj(lv_obj_t * obj) } } +/** + * remove all objects from a group + * @param group pointer to a group + */ +void lv_group_remove_all_objs(lv_group_t * group) +{ + /*Defocus the the currently focused object*/ + if(group->obj_focus != NULL) { + (*group->obj_focus)->signal_cb(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL); + lv_obj_invalidate(*group->obj_focus); + group->obj_focus = NULL; + } + + /*Remove the objects from the group*/ + lv_obj_t ** obj; + LV_LL_READ(group->obj_ll, obj) { + (*obj)->group_p = NULL; + } + + lv_ll_clear(&(group->obj_ll)); +} + /** * Focus on an object (defocus the current) * @param obj pointer to an object to focus on