X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Flib%2Felm_slideshow.c;h=68549a4386b3fbc454f935ac7bf2283fec488da6;hb=e32953011e0194d933f778e93cdae4dd27373eb4;hp=372593f3db73115dab741d690fe5f640f5e5028f;hpb=2b51e9df11280266916798beb7932fc6286b2e65;p=framework%2Fuifw%2Felementary.git diff --git a/src/lib/elm_slideshow.c b/src/lib/elm_slideshow.c index 372593f..68549a4 100644 --- a/src/lib/elm_slideshow.c +++ b/src/lib/elm_slideshow.c @@ -1,30 +1,12 @@ #include #include "elm_priv.h" -/** - * @defgroup Slideshow Slideshow - * @ingroup Elementary - * - * This object display a list of object (generally a list of images) and some actions like - * next/previous are used to navigate. The animations are defined in the theme, - * consequently new animations can be added without having to update the - * applications. - * - * The slideshow use 2 callbacks to create and delete the objects displayed. When an item - * is displayed the function itc->func.get() is called. This function should create the object, - * for example the object can be an evas_object_image or a photocam. When an object is no more - * displayed the function itc->func.del() is called, the user can delete the dana associated to the item. - * - * Signals that you can add callbacks for are: - * - * "changed" - when the slideshow switch to another item - */ - typedef struct _Widget_Data Widget_Data; +typedef struct _Elm_Slideshow_Item Elm_Slideshow_Item; struct _Elm_Slideshow_Item { - Elm_Widget_Item base; + ELM_WIDGET_ITEM; Eina_List *l, *l_built; @@ -51,13 +33,15 @@ struct _Widget_Data double timeout; Eina_Bool loop:1; - struct { + struct + { const char *current; Eina_List *list; //list of const char * - } layout; + } layout; }; static const char *widtype = NULL; +static void _del_pre_hook(Evas_Object *obj); static void _del_hook(Evas_Object *obj); static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl); static void _theme_hook(Evas_Object *obj); @@ -69,9 +53,11 @@ static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info); static const char SIG_CHANGED[] = "changed"; +static const char SIG_TRANSITION_END[] = "transition,end"; static const Evas_Smart_Cb_Description _signals[] = { {SIG_CHANGED, ""}, + {SIG_TRANSITION_END, ""}, {NULL, NULL} }; @@ -84,13 +70,15 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty if (!wd) return EINA_FALSE; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; if (elm_widget_disabled_get(obj)) return EINA_FALSE; - if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left"))) + if ((!strcmp(ev->keyname, "Left")) || + ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string))) { elm_slideshow_previous(obj); ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; return EINA_TRUE; } - if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right"))) + if ((!strcmp(ev->keyname, "Right")) || + ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string))) { elm_slideshow_next(obj); ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; @@ -117,6 +105,15 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty } static void +_del_pre_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); +} + +static void _del_hook(Evas_Object *obj) { const char *layout; @@ -182,7 +179,7 @@ _sizing_eval(Evas_Object *obj) static Elm_Slideshow_Item* _item_prev_get(Elm_Slideshow_Item* item) { - Widget_Data *wd = elm_widget_data_get(item->base.widget); + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); Elm_Slideshow_Item* prev = eina_list_data_get(eina_list_prev(item->l)); if ((!prev) && (wd->loop)) prev = eina_list_data_get(eina_list_last(item->l)); @@ -191,7 +188,7 @@ static Elm_Slideshow_Item* _item_prev_get(Elm_Slideshow_Item* item) static Elm_Slideshow_Item* _item_next_get(Elm_Slideshow_Item* item) { - Widget_Data *wd = elm_widget_data_get(item->base.widget); + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); Elm_Slideshow_Item* next = eina_list_data_get(eina_list_next(item->l)); if ((!next) && (wd->loop)) next = eina_list_data_get(wd->items); @@ -214,18 +211,20 @@ static void _item_realize(Elm_Slideshow_Item *item) { Elm_Slideshow_Item *_item_prev, *_item_next; - Evas_Object *obj = item->base.widget; + Evas_Object *obj = WIDGET(item); Widget_Data *wd = elm_widget_data_get(obj); - int ac, bc, lc; + int ac, bc, lc, ic = 0; if (!wd) return; - if ((!item->base.view) && (item->itc->func.get)) + if ((!VIEW(item)) && (item->itc->func.get)) { - item->base.view = item->itc->func.get((void*)item->base.data, obj); - evas_object_smart_member_add(item->base.view, obj); + VIEW(item) = item->itc->func.get(elm_widget_item_data_get(item), + obj); + evas_object_smart_member_add(VIEW(item), obj); item->l_built = eina_list_append(NULL, item); wd->items_built = eina_list_merge(wd->items_built, item->l_built); - evas_object_hide(item->base.view); + //FIXME: item could be showed by obj + evas_object_hide(VIEW(item)); } else if (item->l_built) wd->items_built = eina_list_demote_list(wd->items_built, item->l_built); @@ -246,22 +245,27 @@ _item_realize(Elm_Slideshow_Item *item) { _item_next = _item_next_get(_item_next); if ((_item_next) - && (!_item_next->base.view) + && (!VIEW(_item_next)) && (_item_next->itc->func.get)) { - _item_next->base.view = + ic++; + VIEW(_item_next) = _item_next->itc->func.get( - (void*)_item_next->base.data, obj); - evas_object_smart_member_add(_item_next->base.view, obj); + elm_widget_item_data_get(_item_next), obj); + evas_object_smart_member_add(VIEW(_item_next), obj); _item_next->l_built = eina_list_append(NULL, _item_next); wd->items_built = eina_list_merge(wd->items_built, _item_next->l_built); - evas_object_hide(_item_next->base.view); + //FIXME: _item_next could be showed by obj later + evas_object_hide(VIEW(_item_next)); } else if (_item_next && _item_next->l_built) - wd->items_built = - eina_list_demote_list(wd->items_built, + { + ic++; + wd->items_built = + eina_list_demote_list(wd->items_built, _item_next->l_built); + } } } @@ -273,42 +277,47 @@ _item_realize(Elm_Slideshow_Item *item) { _item_prev = _item_prev_get(_item_prev); if ((_item_prev) - && (!_item_prev->base.view) + && (!VIEW(_item_prev)) && (_item_prev->itc->func.get)) { - _item_prev->base.view = + ic++; + VIEW(_item_prev) = _item_prev->itc->func.get( - (void*)_item_prev->base.data, obj); - evas_object_smart_member_add(_item_prev->base.view, obj); + elm_widget_item_data_get(_item_prev), obj); + evas_object_smart_member_add(VIEW(_item_prev), obj); _item_prev->l_built = eina_list_append(NULL, _item_prev); wd->items_built = eina_list_merge(wd->items_built, _item_prev->l_built); - evas_object_hide(_item_prev->base.view); + //FIXME: _item_prev could be showed by obj later + evas_object_hide(VIEW(_item_prev)); } else if (_item_prev && _item_prev->l_built) - wd->items_built = - eina_list_demote_list(wd->items_built, + { + ic++; + wd->items_built = + eina_list_demote_list(wd->items_built, _item_prev->l_built); + } } } } //delete unused items - lc = wd->count_item_pre_before + wd->count_item_pre_after + 1; + lc = ic + 1; while ((int)eina_list_count(wd->items_built) > lc) { item = eina_list_data_get(wd->items_built); wd->items_built = eina_list_remove_list(wd->items_built, wd->items_built); if (item->itc->func.del) - item->itc->func.del((void*)item->base.data, item->base.view); - evas_object_del(item->base.view); - item->base.view = NULL; + item->itc->func.del(elm_widget_item_data_get(item), VIEW(item)); + evas_object_del(VIEW(item)); + VIEW(item) = NULL; } } static void -_end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +_end(void *data, Evas_Object *obj __UNUSED__, const char *emission, const char *source __UNUSED__) { Elm_Slideshow_Item *item; Widget_Data *wd = elm_widget_data_get(data); @@ -317,21 +326,21 @@ _end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, c item = wd->previous; if (item) { - edje_object_part_unswallow(NULL, item->base.view); - evas_object_hide(item->base.view); + edje_object_part_unswallow(wd->slideshow, VIEW(item)); + evas_object_hide(VIEW(item)); wd->previous = NULL; } - item = wd->current; - if ((!item) || (!item->base.view)) return; + if ((!item) || (!VIEW(item))) return; _item_realize(item); - edje_object_part_unswallow(NULL, item->base.view); - evas_object_show(item->base.view); + edje_object_part_unswallow(wd->slideshow, VIEW(item)); + edje_object_part_swallow(wd->slideshow, "elm.swallow.1", VIEW(item)); edje_object_signal_emit(wd->slideshow, "anim,end", "slideshow"); - edje_object_part_swallow(wd->slideshow, "elm.swallow.1", item->base.view); + if (emission != NULL) + evas_object_smart_callback_call(data, SIG_TRANSITION_END, wd->current); } static Eina_Bool @@ -345,14 +354,39 @@ _timer_cb(void *data) return ECORE_CALLBACK_CANCEL; } -/** - * Add a new slideshow to the parent - * - * @param parent The parent object - * @return The new object or NULL if it cannot be created - * - * @ingroup Slideshow - */ +static Eina_Bool +_item_del_pre_hook(Elm_Object_Item *it) +{ + Elm_Slideshow_Item *item = (Elm_Slideshow_Item *)it; + Widget_Data *wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return EINA_FALSE; + + if (wd->previous == item) wd->previous = NULL; + if (wd->current == item) + { + Eina_List *l = eina_list_data_find_list(wd->items, item); + Eina_List *l2 = eina_list_next(l); + wd->current = NULL; + if (!l2) + { + l2 = eina_list_prev(l); + if (l2) + elm_slideshow_item_show(eina_list_data_get(l2)); + + } + else + elm_slideshow_item_show(eina_list_data_get(l2)); + } + + wd->items = eina_list_remove_list(wd->items, item->l); + wd->items_built = eina_list_remove_list(wd->items_built, item->l_built); + + if ((VIEW(item)) && (item->itc->func.del)) + item->itc->func.del(elm_widget_item_data_get(item), VIEW(item)); + + return EINA_TRUE; +} + EAPI Evas_Object * elm_slideshow_add(Evas_Object *parent) { @@ -367,6 +401,7 @@ elm_slideshow_add(Evas_Object *parent) elm_widget_sub_object_add(parent, obj); elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); elm_widget_data_set(obj, wd); + elm_widget_del_pre_hook_set(obj, _del_pre_hook); elm_widget_del_hook_set(obj, _del_hook); elm_widget_theme_hook_set(obj, _theme_hook); elm_widget_can_focus_set(obj, EINA_TRUE); @@ -377,11 +412,9 @@ elm_slideshow_add(Evas_Object *parent) wd->slideshow = edje_object_add(e); _elm_theme_object_set(obj, wd->slideshow, "slideshow", "base", "default"); - evas_object_smart_member_add(wd->slideshow, obj); wd->count_item_pre_before = 2; wd->count_item_pre_after = 2; elm_widget_resize_object_set(obj, wd->slideshow); - evas_object_show(wd->slideshow); wd->transitions = elm_widget_stringlist_get(edje_object_data_get(wd->slideshow, "transitions")); if (eina_list_count(wd->transitions) > 0) @@ -403,17 +436,7 @@ elm_slideshow_add(Evas_Object *parent) return obj; } -/** - * Add an 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 - * @return Returns The slideshow item - * - * @ingroup Slideshow - */ -EAPI Elm_Slideshow_Item* +EAPI Elm_Object_Item* elm_slideshow_item_add(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, const void *data) { Elm_Slideshow_Item *item; @@ -422,92 +445,74 @@ elm_slideshow_item_add(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, co if (!wd) return NULL; item = elm_widget_item_new(obj, Elm_Slideshow_Item); - item->base.data = data; + if (!item) return NULL; + elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook); item->itc = itc; item->l = eina_list_append(item->l, item); + elm_widget_item_data_set(item, data); wd->items = eina_list_merge(wd->items, item->l); - if (!wd->current) elm_slideshow_show(item); + if (!wd->current) elm_slideshow_item_show((Elm_Object_Item *)item); - return item; + return (Elm_Object_Item *)item; } -/** - * Insert an 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* +EAPI Elm_Object_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; + if (!item) return NULL; + elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook); item->itc = itc; item->l = eina_list_append(item->l, item); + elm_widget_item_data_set(item, data); wd->items = eina_list_sorted_merge(wd->items, item->l, func); - if (!wd->current) elm_slideshow_show(item); + if (!wd->current) elm_slideshow_item_show((Elm_Object_Item *)item); - return item; + return (Elm_Object_Item *)item; } -/** - * Go to the item - * - * @param obj The slideshow object - * @param item The item - * - * @ingroup Slideshow - */ EAPI void -elm_slideshow_show(Elm_Slideshow_Item *item) +elm_slideshow_item_show(Elm_Object_Item *it) { + ELM_OBJ_ITEM_CHECK_OR_RETURN(it); + char buf[1024]; - Elm_Slideshow_Item *next = NULL; + Elm_Slideshow_Item *item, *next = NULL; Widget_Data *wd; - ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item); - wd = elm_widget_data_get(item->base.widget); - if (!wd) - return; - if (item == wd->current) - return; + item = (Elm_Slideshow_Item *)it; + wd = elm_widget_data_get(WIDGET(item)); + if (!wd) return; + if (item == wd->current) return; next = item; - _end(item->base.widget, item->base.widget, NULL, NULL); + _end(WIDGET(item), WIDGET(item), NULL, NULL); if (wd->timer) ecore_timer_del(wd->timer); + wd->timer = NULL; if (wd->timeout > 0.0) - wd->timer = ecore_timer_add(wd->timeout, _timer_cb, item->base.widget); + wd->timer = ecore_timer_add(wd->timeout, _timer_cb, WIDGET(item)); _item_realize(next); - edje_object_part_swallow(wd->slideshow, "elm.swallow.2", next->base.view); - evas_object_show(next->base.view); - snprintf(buf, sizeof(buf), "%s,next", wd->transition); + edje_object_part_swallow(wd->slideshow, "elm.swallow.2", VIEW(next)); + + if (!wd->transition) + sprintf(buf, "none,next"); + else + snprintf(buf, sizeof(buf), "%s,next", wd->transition); edje_object_signal_emit(wd->slideshow, buf, "slideshow"); wd->previous = wd->current; wd->current = next; - evas_object_smart_callback_call(item->base.widget, SIG_CHANGED, wd->current); + evas_object_smart_callback_call(WIDGET(item), SIG_CHANGED, wd->current); } -/** - * Go to the next item - * - * @param obj The slideshow object - * - * @ingroup Slideshow - */ EAPI void elm_slideshow_next(Evas_Object *obj) { @@ -526,15 +531,18 @@ elm_slideshow_next(Evas_Object *obj) _end(obj, obj, NULL, NULL); if (wd->timer) ecore_timer_del(wd->timer); + wd->timer = NULL; if (wd->timeout > 0.0) wd->timer = ecore_timer_add(wd->timeout, _timer_cb, obj); _item_realize(next); - edje_object_part_swallow(wd->slideshow, "elm.swallow.2", next->base.view); - evas_object_show(next->base.view); + edje_object_part_swallow(wd->slideshow, "elm.swallow.2", VIEW(next)); - snprintf(buf, sizeof(buf), "%s,next", wd->transition); + if (!wd->transition) + sprintf(buf, "none,next"); + else + snprintf(buf, sizeof(buf), "%s,next", wd->transition); edje_object_signal_emit(wd->slideshow, buf, "slideshow"); wd->previous = wd->current; @@ -542,13 +550,6 @@ elm_slideshow_next(Evas_Object *obj) evas_object_smart_callback_call(obj, SIG_CHANGED, wd->current); } -/** - * Go to the previous item - * - * @param obj The slideshow object - * - * @ingroup Slideshow - */ EAPI void elm_slideshow_previous(Evas_Object *obj) { @@ -567,15 +568,18 @@ elm_slideshow_previous(Evas_Object *obj) _end(obj, obj, NULL, NULL); if (wd->timer) ecore_timer_del(wd->timer); + wd->timer = NULL; if (wd->timeout > 0.0) wd->timer = ecore_timer_add(wd->timeout, _timer_cb, obj); _item_realize(prev); - edje_object_part_swallow(wd->slideshow, "elm.swallow.2", prev->base.view); - evas_object_show(prev->base.view); + edje_object_part_swallow(wd->slideshow, "elm.swallow.2", VIEW(prev)); - snprintf(buf, 1024, "%s,previous", wd->transition); + if (!wd->transition) + sprintf(buf, "none,previous"); + else + snprintf(buf, sizeof(buf), "%s,previous", wd->transition); edje_object_signal_emit(wd->slideshow, buf, "slideshow"); wd->previous = wd->current; @@ -583,14 +587,6 @@ elm_slideshow_previous(Evas_Object *obj) evas_object_smart_callback_call(obj, SIG_CHANGED, wd->current); } -/** - * Returns the list of transitions available. - * - * @param obj The slideshow object - * @return Returns the list of transitions (list of const char*) - * - * @ingroup Slideshow - */ EAPI const Eina_List * elm_slideshow_transitions_get(const Evas_Object *obj) { @@ -600,14 +596,6 @@ elm_slideshow_transitions_get(const Evas_Object *obj) return wd->transitions; } -/** - * Returns the list of layouts available. - * - * @param obj The slideshow object - * @return Returns the list of layout (list of const char*) - * - * @ingroup Slideshow - */ EAPI const Eina_List * elm_slideshow_layouts_get(const Evas_Object *obj) { @@ -617,14 +605,6 @@ elm_slideshow_layouts_get(const Evas_Object *obj) return wd->layout.list; } -/** - * Set the transition to use - * - * @param obj The slideshow object - * @param transition the new transition - * - * @ingroup Slideshow - */ EAPI void elm_slideshow_transition_set(Evas_Object *obj, const char *transition) { @@ -634,14 +614,6 @@ elm_slideshow_transition_set(Evas_Object *obj, const char *transition) eina_stringshare_replace(&wd->transition, transition); } -/** - * Returns the transition to use - * - * @param obj The slideshow object - * @return the transition set - * - * @ingroup Slideshow - */ EAPI const char * elm_slideshow_transition_get(const Evas_Object *obj) { @@ -651,15 +623,6 @@ elm_slideshow_transition_get(const Evas_Object *obj) return wd->transition; } -/** - * The slideshow can go to the next item automatically after a few seconds. - * This method set the timeout to use. A timeout <=0 disable the timer. - * - * @param obj The slideshow object - * @param timeout The new timeout - * - * @ingroup Slideshow - */ EAPI void elm_slideshow_timeout_set(Evas_Object *obj, double timeout) { @@ -673,14 +636,6 @@ elm_slideshow_timeout_set(Evas_Object *obj, double timeout) wd->timer = ecore_timer_add(timeout, _timer_cb, obj); } -/** - * Returns the timeout value - * - * @param obj The slideshow object - * @return Returns the timeout - * - * @ingroup Slideshow - */ EAPI double elm_slideshow_timeout_get(const Evas_Object *obj) { @@ -690,14 +645,6 @@ elm_slideshow_timeout_get(const Evas_Object *obj) return wd->timeout; } -/** - * Set if the first item should follow the last and vice versa - * - * @param obj The slideshow object - * @param loop if EINA_TRUE, the first item will follow the last and vice versa - * - * @ingroup Slideshow - */ EAPI void elm_slideshow_loop_set(Evas_Object *obj, Eina_Bool loop) { @@ -707,14 +654,6 @@ elm_slideshow_loop_set(Evas_Object *obj, Eina_Bool loop) wd->loop = loop; } -/** - * Returns the current layout name - * - * @param obj The slideshow object - * @returns Returns the layout name - * - * @ingroup Slideshow - */ EAPI const char * elm_slideshow_layout_get(const Evas_Object *obj) { @@ -724,14 +663,6 @@ elm_slideshow_layout_get(const Evas_Object *obj) return wd->layout.current; } -/** - * Set the layout - * - * @param obj The slideshow object - * @param layout the new layout - * - * @ingroup Slideshow - */ EAPI void elm_slideshow_layout_set(Evas_Object *obj, const char *layout) { @@ -745,14 +676,6 @@ elm_slideshow_layout_set(Evas_Object *obj, const char *layout) edje_object_signal_emit(wd->slideshow, buf, "slideshow"); } -/** - * Return if the first item should follow the last and vice versa - * - * @param obj The slideshow object - * @returns Returns the loop flag - * - * @ingroup Slideshow - */ EAPI Eina_Bool elm_slideshow_loop_get(const Evas_Object *obj) { @@ -762,13 +685,6 @@ elm_slideshow_loop_get(const Evas_Object *obj) return wd->loop; } -/** - * Delete all the items - * - * @param obj The slideshow object - * - * @ingroup Slideshow - */ EAPI void elm_slideshow_clear(Evas_Object *obj) { @@ -781,59 +697,13 @@ elm_slideshow_clear(Evas_Object *obj) EINA_LIST_FREE(wd->items_built, item) { if (item->itc->func.del) - item->itc->func.del((void*)item->base.data, item->base.view); - evas_object_del(item->base.view); - item->base.view = NULL; + item->itc->func.del(elm_widget_item_data_get(item), VIEW(item)); } EINA_LIST_FREE(wd->items, item) - { - elm_widget_item_del(item); - } -} - -/** - * Delete the item - * - * @param item The slideshow item - * - * @ingroup Slideshow - */ -EAPI void -elm_slideshow_item_del(Elm_Slideshow_Item *item) -{ - ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item); - Widget_Data *wd = elm_widget_data_get(item->base.widget); - if (!wd) return; - if (wd->previous == item) wd->previous = NULL; - if (wd->current == item) - { - Eina_List *l = eina_list_data_find_list(wd->items, item); - Eina_List *l2 = eina_list_next(l); - wd->current = NULL; - if (!l2) - l2 = eina_list_nth_list(wd->items, eina_list_count(wd->items) - 1); - if (l2) - elm_slideshow_show(eina_list_data_get(l2)); - } - - wd->items = eina_list_remove_list(wd->items, item->l); - wd->items_built = eina_list_remove_list(wd->items_built, item->l_built); - - if ((item->base.view) && (item->itc->func.del)) - item->itc->func.del((void*)item->base.data, item->base.view); - if (item->base.view) - evas_object_del(item->base.view); - free(item); + elm_widget_item_free(item); } -/** - * Returns the list of items - * @param obj The slideshow object - * @return Returns the list of items (list of Elm_Slideshow_Item). - * - * @ingroup Slideshow - */ EAPI const Eina_List * elm_slideshow_items_get(const Evas_Object *obj) { @@ -843,61 +713,22 @@ elm_slideshow_items_get(const Evas_Object *obj) return wd->items; } -/** - * Returns the current item displayed - * - * @param obj The slideshow object - * @return Returns the current item displayed - * - * @ingroup Slideshow - */ -EAPI Elm_Slideshow_Item * +EAPI Elm_Object_Item * elm_slideshow_item_current_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return NULL; - return wd->current; + return (Elm_Object_Item *) wd->current; } -/** - * Returns the evas object associated to an item - * - * @param item The slideshow item - * @return Returns the evas object associated to this item - * - * @ingroup Slideshow - */ EAPI Evas_Object * -elm_slideshow_item_object_get(const Elm_Slideshow_Item * item) -{ - ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL); - return item->base.view; -} - -/** - * Returns the data associated to an item - * - * @param item The slideshow item - * @return Returns the data associated to this item - * - * @ingroup Slideshow - */ -EAPI void * -elm_slideshow_item_data_get(const Elm_Slideshow_Item * item) -{ - ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL); - return elm_widget_item_data_get(item); -} - -/** - * Returns max amount of cached items before current - * - * @param obj The slideshow object - * @return Returns max amount of cached items - * - * @ingroup Slideshow - */ +elm_slideshow_item_object_get(const Elm_Object_Item * it) +{ + ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); + return VIEW(it); +} + EAPI int elm_slideshow_cache_before_get(const Evas_Object *obj) { @@ -907,14 +738,6 @@ elm_slideshow_cache_before_get(const Evas_Object *obj) return wd->count_item_pre_before; } -/** - * Set max amount of cached items before current - * - * @param obj The slideshow object - * @param count Max amount of cached items - * - * @ingroup Slideshow - */ EAPI void elm_slideshow_cache_before_set(Evas_Object *obj, int count) { @@ -925,14 +748,6 @@ elm_slideshow_cache_before_set(Evas_Object *obj, int count) wd->count_item_pre_before = count; } -/** - * Returns max amount of cached items after current - * - * @param obj The slideshow object - * @return Returns max amount of cached items - * - * @ingroup Slideshow - */ EAPI int elm_slideshow_cache_after_get(const Evas_Object *obj) { @@ -942,14 +757,6 @@ elm_slideshow_cache_after_get(const Evas_Object *obj) return wd->count_item_pre_after; } -/** - * Set max amount of cached items after current - * - * @param obj The slideshow object - * @param count max amount of cached items - * - * @ingroup Slideshow - */ EAPI void elm_slideshow_cache_after_set(Evas_Object *obj, int count) { @@ -960,16 +767,7 @@ elm_slideshow_cache_after_set(Evas_Object *obj, int count) wd->count_item_pre_after = count; } -/** - * Get the nth item of the slideshow - * - * @param obj The slideshow object - * @param nth The number of the element (0 being first) - * @return The item stored in slideshow at position required - * - * @ingroup Slideshow - */ -EAPI Elm_Slideshow_Item * +EAPI Elm_Object_Item * elm_slideshow_item_nth_get(const Evas_Object *obj, unsigned int nth) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; @@ -978,14 +776,6 @@ elm_slideshow_item_nth_get(const Evas_Object *obj, unsigned int nth) return eina_list_nth(wd->items, nth); } -/** - * Get count of items stored in slideshow - * - * @param obj The slideshow object - * @return The count of items - * - * @ingroup Slideshow - */ EAPI unsigned int elm_slideshow_count_get(const Evas_Object *obj) {