elementary: add item_sorted_insert in slideshow

SVN revision: 59239
This commit is contained in:
Michael BOUCHAUD 2011-05-06 10:22:32 +00:00
parent 90990ed63e
commit 9647cbcdd6
2 changed files with 32 additions and 0 deletions

View File

@ -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);

View File

@ -424,6 +424,37 @@ elm_slideshow_item_add(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, co
return item;
}
/**
* 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
*