From cb8c22cde465c28a1e5881fede6bb5fc9fce7132 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Mon, 25 Jan 2010 05:54:31 +0000 Subject: [PATCH] genlist - get realized items call! add! SVN revision: 45543 --- legacy/elementary/src/lib/Elementary.h.in | 1 + legacy/elementary/src/lib/elm_genlist.c | 49 +++++++++++++++++++++-- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index a84fd16a42..309f68c72c 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -863,6 +863,7 @@ extern "C" { EAPI void elm_genlist_multi_select_set(Evas_Object *obj, Eina_Bool multi); EAPI Elm_Genlist_Item *elm_genlist_selected_item_get(const Evas_Object *obj); EAPI const Eina_List *elm_genlist_selected_items_get(const Evas_Object *obj); + EAPI Eina_List *elm_genlist_realized_items_get(const Evas_Object *obj); EAPI Elm_Genlist_Item *elm_genlist_at_xy_item_get(const Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *posret); EAPI Elm_Genlist_Item *elm_genlist_first_item_get(const Evas_Object *obj); EAPI Elm_Genlist_Item *elm_genlist_last_item_get(const Evas_Object *obj); diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index e1e6ab8e20..0eddf0f203 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -371,10 +371,10 @@ _theme_hook(Evas_Object *obj) edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale); EINA_INLIST_FOREACH(wd->blocks, itb) { - if (itb->realized) _item_block_unrealize(itb); - Eina_List *l; Elm_Genlist_Item *it; + + if (itb->realized) _item_block_unrealize(itb); EINA_LIST_FOREACH(itb->items, l, it) it->mincalcd = EINA_FALSE; @@ -1978,7 +1978,7 @@ elm_genlist_selected_item_get(const Evas_Object *obj) * by deletion). The list contains Elm_Genlist_Item pointers. * * @param obj The genlist object - * @return The list of selected items, nor NUL if none are selected. + * @return The list of selected items, nor NULL if none are selected. * * @ingroup Genlist */ @@ -1990,6 +1990,49 @@ elm_genlist_selected_items_get(const Evas_Object *obj) return wd->selected; } +/** + * Get a list of realized items in genlist + * + * This returns a list of the realized items in the genlist. The list + * contains Elm_Genlist_Item pointers. The list must be freed by the + * caller when done with eina_list_free(). The item pointers in the list + * are only vallid so long as those items are not deleted or the genlist is + * not deleted. + * + * @param obj The genlist object + * @return The list of realized items, nor NULL if none are realized. + * + * @ingroup Genlist + */ +EAPI Eina_List * +elm_genlist_realized_items_get(const Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Eina_List *list = NULL; + Item_Block *itb; + Eina_Bool done = 0; + + EINA_INLIST_FOREACH(wd->blocks, itb) + { + if (itb->realized) + { + Eina_List *l; + Elm_Genlist_Item *it; + + done = 1; + EINA_LIST_FOREACH(itb->items, l, it) + { + if (it->realized) list = eina_list_append(list, it); + } + } + else + { + if (done) break; + } + } + return list; +} + /** * Get the item that is at the x, y canvas coords *