From c2707f4b8e3e3637f633558799d6884c5c7b2bf4 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 --- src/lib/elm_genlist.c | 9 +++++++++ src/lib/elm_genlist_common.h | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index ccb21cd..9683ec2 100644 --- a/src/lib/elm_genlist.c +++ b/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/src/lib/elm_genlist_common.h b/src/lib/elm_genlist_common.h index 2d860ee..8ce4593 100644 --- a/src/lib/elm_genlist_common.h +++ b/src/lib/elm_genlist_common.h @@ -559,6 +559,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 * * @param it The item -- 2.7.4