From ba6113e06535ecd06990e0e2c726acb692bd763c Mon Sep 17 00:00:00 2001 From: yoz Date: Fri, 6 May 2011 10:22:32 +0000 Subject: [PATCH] elementary: add item_sorted_insert in slideshow git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@59239 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/Elementary.h.in | 1 + src/lib/elm_slideshow.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) 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 -- 2.7.4