initial commit of lv_obj_count_children_recursive and of lv_ll_get_len

This commit is contained in:
Brian Pugh
2019-05-13 09:06:01 -07:00
parent 1489629b61
commit 85ead39b6a
4 changed files with 46 additions and 0 deletions

View File

@@ -206,6 +206,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
new_obj->opa_scale_en = 0;
new_obj->opa_scale = LV_OPA_COVER;
new_obj->parent_event = 0;
new_obj->reserved = 0;
new_obj->ext_attr = NULL;
@@ -1570,6 +1571,22 @@ uint16_t lv_obj_count_children(const lv_obj_t * obj)
return cnt;
}
/** Recursively count the children of an object
* @param obj pointer to an object
* @return children number of 'obj'
*/
uint16_t lv_obj_count_children_recursive(const lv_obj_t * obj){
lv_obj_t * i;
uint16_t cnt = 0;
LV_LL_READ(obj->child_ll, i) {
cnt++; // Count the child
cnt += lv_obj_count_children_recursive(i); // recursively count children's children
}
return cnt;
}
/*---------------------
* Coordinate get
*--------------------*/