From: yoz Date: Fri, 6 May 2011 10:22:32 +0000 (+0000) Subject: elementary: add item_sorted_insert in slideshow X-Git-Tag: REL_F_I9200_20110722_1~8^2~50^2~370 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ba6113e06535ecd06990e0e2c726acb692bd763c;p=framework%2Fuifw%2Felementary.git elementary: add item_sorted_insert in slideshow git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@59239 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index fefcc12..2d7f660 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -2022,6 +2022,7 @@ extern "C" { EAPI Evas_Object *elm_slideshow_add(Evas_Object *parent) EINA_ARG_NONNULL(1); EAPI Elm_Slideshow_Item *elm_slideshow_item_add(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, const void *data) EINA_ARG_NONNULL(1); + EAPI Elm_Slideshow_Item *elm_slideshow_item_sorted_insert(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, const void *data, Eina_Compare_Cb func) EINA_ARG_NONNULL(1); EAPI void elm_slideshow_show(Elm_Slideshow_Item *item) EINA_ARG_NONNULL(1); EAPI void elm_slideshow_next(Evas_Object *obj) EINA_ARG_NONNULL(1); EAPI void elm_slideshow_previous(Evas_Object *obj) EINA_ARG_NONNULL(1); diff --git a/src/lib/elm_slideshow.c b/src/lib/elm_slideshow.c index 9133400..6442a3e 100644 --- a/src/lib/elm_slideshow.c +++ b/src/lib/elm_slideshow.c @@ -425,6 +425,37 @@ elm_slideshow_item_add(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, co } /** + * Insert a object in the list. The object can be a evas object image or a elm photo for example. + * + * @param obj The slideshow object + * @aram itc Callbacks used to create the object and delete the data associated when the item is deleted. + * @param data Data used by the user to identified the item + * @param func The function to compare data + * @return Returns The slideshow item + * + * @ingroup Slideshow + */ +EAPI Elm_Slideshow_Item* +elm_slideshow_item_sorted_insert(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, const void *data, Eina_Compare_Cb func) +{ + Elm_Slideshow_Item *item; + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return NULL; + item = elm_widget_item_new(obj, Elm_Slideshow_Item); + item->base.data = data; + item->itc = itc; + item->l = eina_list_append(item->l, item); + + wd->items = eina_list_sorted_merge(wd->items, item->l, func); + + if (!wd->current) elm_slideshow_show(item); + + return item; +} + +/** * Go to the item * * @param obj The slideshow object