From a3ff7009822746b067206ed9e5125d1714848d6e Mon Sep 17 00:00:00 2001 From: zmike Date: Sat, 8 Feb 2014 01:14:36 -0500 Subject: [PATCH] +genlist_item_subitems_count() group apis are currently pretty lacking. there should probably be functions for iterating over subitems in addition to this one --- legacy/elementary/src/lib/elm_genlist.c | 9 +++++++++ legacy/elementary/src/lib/elm_genlist_common.h | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index ccb21cdbf9..9683ec2a0b 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -6127,6 +6127,15 @@ elm_genlist_item_parent_get(const Elm_Object_Item *it) return (Elm_Object_Item *)((Elm_Gen_Item *)it)->parent; } +EAPI unsigned int +elm_genlist_item_subitems_count(const Elm_Object_Item *it) +{ + Elm_Gen_Item *item = (Elm_Gen_Item *)it; + ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, 0); + + return eina_list_count(item->item->items); +} + EAPI void elm_genlist_item_subitems_clear(Elm_Object_Item *item) { diff --git a/legacy/elementary/src/lib/elm_genlist_common.h b/legacy/elementary/src/lib/elm_genlist_common.h index 2d860ee188..8ce45933d5 100644 --- a/legacy/elementary/src/lib/elm_genlist_common.h +++ b/legacy/elementary/src/lib/elm_genlist_common.h @@ -558,6 +558,18 @@ EAPI Eina_Bool elm_genlist_item_cursor_engine_only_get(const */ EAPI Elm_Object_Item *elm_genlist_item_parent_get(const Elm_Object_Item *it); +/** + * Get the number of subitems of a given item + * + * @param it The item + * @return The number of subitems, 0 on error + * + * This returns the number of subitems that an item possesses. + * + * @since 1.9 + * @ingroup Genlist + */ +EAPI unsigned int elm_genlist_item_subitems_count(const Elm_Object_Item *it); /** * Remove all sub-items (children) of the given item *