1 #include <Elementary.h>
5 * @defgroup Slideshow Slideshow
8 * This object display a list of object (generally a list of images) and some actions like
9 * next/previous are used to navigate. The animations are defined in the theme,
10 * consequently new animations can be added without having to update the
13 * The slideshow use 2 callbacks to create and delete the objects displayed. When an item
14 * is displayed the function itc->func.get() is called. This function should create the object,
15 * for example the object can be an evas_object_image or a photocam. When an object is no more
16 * displayed the function itc->func.del() is called, the user can delete the dana associated to the item.
18 * Signals that you can add callbacks for are:
20 * "changed" - when the slideshow switch to another item
23 typedef struct _Widget_Data Widget_Data;
25 struct _Elm_Slideshow_Item
29 Eina_List *l, *l_built;
31 const Elm_Slideshow_Item_Class *itc;
36 Evas_Object *slideshow;
38 // list of Elm_Slideshow_Item*
40 Eina_List *items_built;
42 Elm_Slideshow_Item *current;
43 Elm_Slideshow_Item *previous;
45 Eina_List *transitions;
46 const char *transition;
48 int count_item_pre_before;
49 int count_item_pre_after;
56 Eina_List *list; //list of const char *
60 static const char *widtype = NULL;
61 static void _del_hook(Evas_Object *obj);
62 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
63 static void _theme_hook(Evas_Object *obj);
64 static void _sizing_eval(Evas_Object *obj);
65 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
66 static Eina_Bool _timer_cb(void *data);
67 static void _on_focus_hook(void *data, Evas_Object *obj);
68 static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
69 Evas_Callback_Type type, void *event_info);
71 static const char SIG_CHANGED[] = "changed";
73 static const Evas_Smart_Cb_Description _signals[] = {
79 _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
81 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
82 Evas_Event_Key_Down *ev = event_info;
83 Widget_Data *wd = elm_widget_data_get(obj);
84 if (!wd) return EINA_FALSE;
85 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
86 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
87 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
89 elm_slideshow_previous(obj);
90 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
93 if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")))
95 elm_slideshow_next(obj);
96 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
99 if ((!strcmp(ev->keyname, "Return")) ||
100 (!strcmp(ev->keyname, "KP_Enter")) ||
101 (!strcmp(ev->keyname, "space")))
107 ecore_timer_del(wd->timer);
111 elm_slideshow_timeout_set(obj, wd->timeout);
113 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
120 _del_hook(Evas_Object *obj)
123 Widget_Data *wd = elm_widget_data_get(obj);
125 elm_slideshow_clear(obj);
126 elm_widget_stringlist_free(wd->transitions);
127 if (wd->timer) ecore_timer_del(wd->timer);
128 EINA_LIST_FREE(wd->layout.list, layout)
129 eina_stringshare_del(layout);
134 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
136 Widget_Data *wd = elm_widget_data_get(obj);
138 if (elm_widget_focus_get(obj))
140 edje_object_signal_emit(wd->slideshow, "elm,action,focus", "elm");
141 evas_object_focus_set(wd->slideshow, EINA_TRUE);
145 edje_object_signal_emit(wd->slideshow, "elm,action,unfocus", "elm");
146 evas_object_focus_set(wd->slideshow, EINA_FALSE);
151 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
153 Widget_Data *wd = elm_widget_data_get(obj);
155 edje_object_mirrored_set(wd->slideshow, rtl);
159 _theme_hook(Evas_Object *obj)
161 Widget_Data *wd = elm_widget_data_get(obj);
163 _elm_widget_mirrored_reload(obj);
164 _mirrored_set(obj, elm_widget_mirrored_get(obj));
165 _elm_theme_object_set(obj, wd->slideshow, "slideshow", "base", elm_widget_style_get(obj));
166 edje_object_scale_set(wd->slideshow, elm_widget_scale_get(obj) *
172 _sizing_eval(Evas_Object *obj)
174 Widget_Data *wd = elm_widget_data_get(obj);
175 Evas_Coord minw = -1, minh = -1;
177 edje_object_size_min_calc(wd->slideshow, &minw, &minh);
178 evas_object_size_hint_min_set(obj, minw, minh);
179 evas_object_size_hint_max_set(obj, minw, minh);
183 static Elm_Slideshow_Item* _item_prev_get(Elm_Slideshow_Item* item)
185 Widget_Data *wd = elm_widget_data_get(item->base.widget);
186 Elm_Slideshow_Item* prev = eina_list_data_get(eina_list_prev(item->l));
187 if ((!prev) && (wd->loop))
188 prev = eina_list_data_get(eina_list_last(item->l));
192 static Elm_Slideshow_Item* _item_next_get(Elm_Slideshow_Item* item)
194 Widget_Data *wd = elm_widget_data_get(item->base.widget);
195 Elm_Slideshow_Item* next = eina_list_data_get(eina_list_next(item->l));
196 if ((!next) && (wd->loop))
197 next = eina_list_data_get(wd->items);
202 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
208 _sub_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
214 _item_realize(Elm_Slideshow_Item *item)
216 Elm_Slideshow_Item *_item_prev, *_item_next;
217 Evas_Object *obj = item->base.widget;
218 Widget_Data *wd = elm_widget_data_get(obj);
222 if ((!item->base.view) && (item->itc->func.get))
224 item->base.view = item->itc->func.get((void*)item->base.data, obj);
225 evas_object_smart_member_add(item->base.view, obj);
226 item->l_built = eina_list_append(NULL, item);
227 wd->items_built = eina_list_merge(wd->items_built, item->l_built);
228 evas_object_hide(item->base.view);
230 else if (item->l_built)
231 wd->items_built = eina_list_demote_list(wd->items_built, item->l_built);
233 //pre-create previous and next item
234 ac = wd->count_item_pre_after;
236 bc = wd->count_item_pre_before;
238 lc = eina_list_count(wd->items) - 1;
239 while (lc > 0 && ((ac > 0) || (bc > 0)))
241 if (lc > 0 && ac > 0)
247 _item_next = _item_next_get(_item_next);
249 && (!_item_next->base.view)
250 && (_item_next->itc->func.get))
252 _item_next->base.view =
253 _item_next->itc->func.get(
254 (void*)_item_next->base.data, obj);
255 evas_object_smart_member_add(_item_next->base.view, obj);
256 _item_next->l_built = eina_list_append(NULL, _item_next);
257 wd->items_built = eina_list_merge(wd->items_built,
258 _item_next->l_built);
259 evas_object_hide(_item_next->base.view);
261 else if (_item_next && _item_next->l_built)
263 eina_list_demote_list(wd->items_built,
264 _item_next->l_built);
268 if (lc > 0 && bc > 0)
274 _item_prev = _item_prev_get(_item_prev);
276 && (!_item_prev->base.view)
277 && (_item_prev->itc->func.get))
279 _item_prev->base.view =
280 _item_prev->itc->func.get(
281 (void*)_item_prev->base.data, obj);
282 evas_object_smart_member_add(_item_prev->base.view, obj);
283 _item_prev->l_built = eina_list_append(NULL, _item_prev);
284 wd->items_built = eina_list_merge(wd->items_built,
285 _item_prev->l_built);
286 evas_object_hide(_item_prev->base.view);
288 else if (_item_prev && _item_prev->l_built)
290 eina_list_demote_list(wd->items_built,
291 _item_prev->l_built);
296 //delete unused items
297 lc = wd->count_item_pre_before + wd->count_item_pre_after + 1;
298 while ((int)eina_list_count(wd->items_built) > lc)
300 item = eina_list_data_get(wd->items_built);
301 wd->items_built = eina_list_remove_list(wd->items_built,
303 if (item->itc->func.del)
304 item->itc->func.del((void*)item->base.data, item->base.view);
305 evas_object_del(item->base.view);
306 item->base.view = NULL;
311 _end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
313 Elm_Slideshow_Item *item;
314 Widget_Data *wd = elm_widget_data_get(data);
320 edje_object_part_unswallow(NULL, item->base.view);
321 evas_object_hide(item->base.view);
327 if ((!item) || (!item->base.view)) return;
330 edje_object_part_unswallow(NULL, item->base.view);
331 evas_object_show(item->base.view);
333 edje_object_signal_emit(wd->slideshow, "anim,end", "slideshow");
334 edje_object_part_swallow(wd->slideshow, "elm.swallow.1", item->base.view);
338 _timer_cb(void *data)
340 Evas_Object *obj = data;
341 Widget_Data *wd = elm_widget_data_get(obj);
342 if (!wd) return ECORE_CALLBACK_CANCEL;
344 elm_slideshow_next(obj);
345 return ECORE_CALLBACK_CANCEL;
349 * Add a new slideshow to the parent
351 * @param parent The parent object
352 * @return The new object or NULL if it cannot be created
357 elm_slideshow_add(Evas_Object *parent)
363 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
365 ELM_SET_WIDTYPE(widtype, "slideshow");
366 elm_widget_type_set(obj, "slideshow");
367 elm_widget_sub_object_add(parent, obj);
368 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
369 elm_widget_data_set(obj, wd);
370 elm_widget_del_hook_set(obj, _del_hook);
371 elm_widget_theme_hook_set(obj, _theme_hook);
372 elm_widget_can_focus_set(obj, EINA_TRUE);
373 elm_widget_event_hook_set(obj, _event_hook);
378 wd->slideshow = edje_object_add(e);
379 _elm_theme_object_set(obj, wd->slideshow, "slideshow", "base", "default");
380 evas_object_smart_member_add(wd->slideshow, obj);
381 wd->count_item_pre_before = 2;
382 wd->count_item_pre_after = 2;
383 elm_widget_resize_object_set(obj, wd->slideshow);
384 evas_object_show(wd->slideshow);
386 wd->transitions = elm_widget_stringlist_get(edje_object_data_get(wd->slideshow, "transitions"));
387 if (eina_list_count(wd->transitions) > 0)
388 wd->transition = eina_stringshare_add(eina_list_data_get(wd->transitions));
390 wd->layout.list = elm_widget_stringlist_get(edje_object_data_get(wd->slideshow, "layouts"));
391 if (eina_list_count(wd->layout.list) > 0)
392 wd->layout.current = eina_list_data_get(wd->layout.list);
394 edje_object_signal_callback_add(wd->slideshow, "end", "slideshow", _end, obj);
396 evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
397 evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
399 evas_object_smart_callbacks_descriptions_set(obj, _signals);
401 _mirrored_set(obj, elm_widget_mirrored_get(obj));
407 * Add an object in the list. The object can be a evas object image or a elm photo for example.
409 * @param obj The slideshow object
410 * @aram itc Callbacks used to create the object and delete the data associated when the item is deleted.
411 * @param data Data used by the user to identified the item
412 * @return Returns The slideshow item
416 EAPI Elm_Slideshow_Item*
417 elm_slideshow_item_add(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, const void *data)
419 Elm_Slideshow_Item *item;
420 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
421 Widget_Data *wd = elm_widget_data_get(obj);
423 if (!wd) return NULL;
424 item = elm_widget_item_new(obj, Elm_Slideshow_Item);
425 item->base.data = data;
427 item->l = eina_list_append(item->l, item);
429 wd->items = eina_list_merge(wd->items, item->l);
431 if (!wd->current) elm_slideshow_show(item);
437 * Insert an object in the list. The object can be a evas object image or a elm photo for example.
439 * @param obj The slideshow object
440 * @aram itc Callbacks used to create the object and delete the data associated when the item is deleted.
441 * @param data Data used by the user to identified the item
442 * @param func The function to compare data
443 * @return Returns The slideshow item
447 EAPI Elm_Slideshow_Item*
448 elm_slideshow_item_sorted_insert(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, const void *data, Eina_Compare_Cb func)
450 Elm_Slideshow_Item *item;
451 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
452 Widget_Data *wd = elm_widget_data_get(obj);
454 if (!wd) return NULL;
455 item = elm_widget_item_new(obj, Elm_Slideshow_Item);
456 item->base.data = data;
458 item->l = eina_list_append(item->l, item);
460 wd->items = eina_list_sorted_merge(wd->items, item->l, func);
462 if (!wd->current) elm_slideshow_show(item);
470 * @param obj The slideshow object
471 * @param item The item
476 elm_slideshow_show(Elm_Slideshow_Item *item)
479 Elm_Slideshow_Item *next = NULL;
481 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
482 wd = elm_widget_data_get(item->base.widget);
485 if (item == wd->current)
489 _end(item->base.widget, item->base.widget, NULL, NULL);
491 if (wd->timer) ecore_timer_del(wd->timer);
492 if (wd->timeout > 0.0)
493 wd->timer = ecore_timer_add(wd->timeout, _timer_cb, item->base.widget);
495 edje_object_part_swallow(wd->slideshow, "elm.swallow.2", next->base.view);
496 evas_object_show(next->base.view);
497 snprintf(buf, sizeof(buf), "%s,next", wd->transition);
498 edje_object_signal_emit(wd->slideshow, buf, "slideshow");
499 wd->previous = wd->current;
501 evas_object_smart_callback_call(item->base.widget, SIG_CHANGED, wd->current);
505 * Go to the next item
507 * @param obj The slideshow object
512 elm_slideshow_next(Evas_Object *obj)
515 Elm_Slideshow_Item *next = NULL;
516 ELM_CHECK_WIDTYPE(obj, widtype);
517 Widget_Data *wd = elm_widget_data_get(obj);
522 next = _item_next_get(wd->current);
524 if ((!next) || (next == wd->current)) return;
526 _end(obj, obj, NULL, NULL);
528 if (wd->timer) ecore_timer_del(wd->timer);
529 if (wd->timeout > 0.0)
530 wd->timer = ecore_timer_add(wd->timeout, _timer_cb, obj);
534 edje_object_part_swallow(wd->slideshow, "elm.swallow.2", next->base.view);
535 evas_object_show(next->base.view);
537 snprintf(buf, sizeof(buf), "%s,next", wd->transition);
538 edje_object_signal_emit(wd->slideshow, buf, "slideshow");
540 wd->previous = wd->current;
542 evas_object_smart_callback_call(obj, SIG_CHANGED, wd->current);
546 * Go to the previous item
548 * @param obj The slideshow object
553 elm_slideshow_previous(Evas_Object *obj)
556 Elm_Slideshow_Item *prev = NULL;
557 ELM_CHECK_WIDTYPE(obj, widtype);
558 Widget_Data *wd = elm_widget_data_get(obj);
563 prev = _item_prev_get(wd->current);
565 if ((!prev) || (prev == wd->current)) return;
567 _end(obj, obj, NULL, NULL);
569 if (wd->timer) ecore_timer_del(wd->timer);
570 if (wd->timeout > 0.0)
571 wd->timer = ecore_timer_add(wd->timeout, _timer_cb, obj);
575 edje_object_part_swallow(wd->slideshow, "elm.swallow.2", prev->base.view);
576 evas_object_show(prev->base.view);
578 snprintf(buf, 1024, "%s,previous", wd->transition);
579 edje_object_signal_emit(wd->slideshow, buf, "slideshow");
581 wd->previous = wd->current;
583 evas_object_smart_callback_call(obj, SIG_CHANGED, wd->current);
587 * Returns the list of transitions available.
589 * @param obj The slideshow object
590 * @return Returns the list of transitions (list of const char*)
594 EAPI const Eina_List *
595 elm_slideshow_transitions_get(const Evas_Object *obj)
597 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
598 Widget_Data *wd = elm_widget_data_get(obj);
599 if (!wd) return NULL;
600 return wd->transitions;
604 * Returns the list of layouts available.
606 * @param obj The slideshow object
607 * @return Returns the list of layout (list of const char*)
611 EAPI const Eina_List *
612 elm_slideshow_layouts_get(const Evas_Object *obj)
614 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
615 Widget_Data *wd = elm_widget_data_get(obj);
616 if (!wd) return NULL;
617 return wd->layout.list;
621 * Set the transition to use
623 * @param obj The slideshow object
624 * @param transition the new transition
629 elm_slideshow_transition_set(Evas_Object *obj, const char *transition)
631 ELM_CHECK_WIDTYPE(obj, widtype);
632 Widget_Data *wd = elm_widget_data_get(obj);
634 eina_stringshare_replace(&wd->transition, transition);
638 * Returns the transition to use
640 * @param obj The slideshow object
641 * @return the transition set
646 elm_slideshow_transition_get(const Evas_Object *obj)
648 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
649 Widget_Data *wd = elm_widget_data_get(obj);
650 if (!wd) return NULL;
651 return wd->transition;
655 * The slideshow can go to the next item automatically after a few seconds.
656 * This method set the timeout to use. A timeout <=0 disable the timer.
658 * @param obj The slideshow object
659 * @param timeout The new timeout
664 elm_slideshow_timeout_set(Evas_Object *obj, double timeout)
666 ELM_CHECK_WIDTYPE(obj, widtype);
667 Widget_Data *wd = elm_widget_data_get(obj);
669 wd->timeout = timeout;
670 if (wd->timer) ecore_timer_del(wd->timer);
673 wd->timer = ecore_timer_add(timeout, _timer_cb, obj);
677 * Returns the timeout value
679 * @param obj The slideshow object
680 * @return Returns the timeout
685 elm_slideshow_timeout_get(const Evas_Object *obj)
687 ELM_CHECK_WIDTYPE(obj, widtype) -1.0;
688 Widget_Data *wd = elm_widget_data_get(obj);
689 if (!wd) return -1.0;
694 * Set if the first item should follow the last and vice versa
696 * @param obj The slideshow object
697 * @param loop if EINA_TRUE, the first item will follow the last and vice versa
702 elm_slideshow_loop_set(Evas_Object *obj, Eina_Bool loop)
704 ELM_CHECK_WIDTYPE(obj, widtype);
705 Widget_Data *wd = elm_widget_data_get(obj);
711 * Returns the current layout name
713 * @param obj The slideshow object
714 * @returns Returns the layout name
719 elm_slideshow_layout_get(const Evas_Object *obj)
721 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
722 Widget_Data *wd = elm_widget_data_get(obj);
723 if (!wd) return EINA_FALSE;
724 return wd->layout.current;
730 * @param obj The slideshow object
731 * @param layout the new layout
736 elm_slideshow_layout_set(Evas_Object *obj, const char *layout)
739 ELM_CHECK_WIDTYPE(obj, widtype);
740 Widget_Data *wd = elm_widget_data_get(obj);
743 wd->layout.current = layout;
744 snprintf(buf, sizeof(buf), "layout,%s", layout);
745 edje_object_signal_emit(wd->slideshow, buf, "slideshow");
749 * Return if the first item should follow the last and vice versa
751 * @param obj The slideshow object
752 * @returns Returns the loop flag
757 elm_slideshow_loop_get(const Evas_Object *obj)
759 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
760 Widget_Data *wd = elm_widget_data_get(obj);
761 if (!wd) return EINA_FALSE;
766 * Delete all the items
768 * @param obj The slideshow object
773 elm_slideshow_clear(Evas_Object *obj)
775 Elm_Slideshow_Item *item;
776 ELM_CHECK_WIDTYPE(obj, widtype);
777 Widget_Data *wd = elm_widget_data_get(obj);
781 EINA_LIST_FREE(wd->items_built, item)
783 if (item->itc->func.del)
784 item->itc->func.del((void*)item->base.data, item->base.view);
785 evas_object_del(item->base.view);
786 item->base.view = NULL;
789 EINA_LIST_FREE(wd->items, item)
791 elm_widget_item_del(item);
798 * @param item The slideshow item
803 elm_slideshow_item_del(Elm_Slideshow_Item *item)
805 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
806 Widget_Data *wd = elm_widget_data_get(item->base.widget);
808 if (wd->previous == item) wd->previous = NULL;
809 if (wd->current == item)
811 Eina_List *l = eina_list_data_find_list(wd->items, item);
812 Eina_List *l2 = eina_list_next(l);
815 l2 = eina_list_nth_list(wd->items, eina_list_count(wd->items) - 1);
817 elm_slideshow_show(eina_list_data_get(l2));
820 wd->items = eina_list_remove_list(wd->items, item->l);
821 wd->items_built = eina_list_remove_list(wd->items_built, item->l_built);
823 if ((item->base.view) && (item->itc->func.del))
824 item->itc->func.del((void*)item->base.data, item->base.view);
826 evas_object_del(item->base.view);
831 * Returns the list of items
832 * @param obj The slideshow object
833 * @return Returns the list of items (list of Elm_Slideshow_Item).
837 EAPI const Eina_List *
838 elm_slideshow_items_get(const Evas_Object *obj)
840 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
841 Widget_Data *wd = elm_widget_data_get(obj);
842 if (!wd) return NULL;
847 * Returns the current item displayed
849 * @param obj The slideshow object
850 * @return Returns the current item displayed
854 EAPI Elm_Slideshow_Item *
855 elm_slideshow_item_current_get(const Evas_Object *obj)
857 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
858 Widget_Data *wd = elm_widget_data_get(obj);
859 if (!wd) return NULL;
864 * Returns the evas object associated to an item
866 * @param item The slideshow item
867 * @return Returns the evas object associated to this item
872 elm_slideshow_item_object_get(const Elm_Slideshow_Item * item)
874 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
875 return item->base.view;
879 * Returns the data associated to an item
881 * @param item The slideshow item
882 * @return Returns the data associated to this item
887 elm_slideshow_item_data_get(const Elm_Slideshow_Item * item)
889 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
890 return elm_widget_item_data_get(item);
894 * Returns max amount of cached items before current
896 * @param obj The slideshow object
897 * @return Returns max amount of cached items
902 elm_slideshow_cache_before_get(const Evas_Object *obj)
904 ELM_CHECK_WIDTYPE(obj, widtype) -1;
905 Widget_Data *wd = elm_widget_data_get(obj);
907 return wd->count_item_pre_before;
911 * Set max amount of cached items before current
913 * @param obj The slideshow object
914 * @param count Max amount of cached items
919 elm_slideshow_cache_before_set(Evas_Object *obj, int count)
921 ELM_CHECK_WIDTYPE(obj, widtype);
922 Widget_Data *wd = elm_widget_data_get(obj);
924 if (count < 0) count = 0;
925 wd->count_item_pre_before = count;
929 * Returns max amount of cached items after current
931 * @param obj The slideshow object
932 * @return Returns max amount of cached items
937 elm_slideshow_cache_after_get(const Evas_Object *obj)
939 ELM_CHECK_WIDTYPE(obj, widtype) -1;
940 Widget_Data *wd = elm_widget_data_get(obj);
942 return wd->count_item_pre_after;
946 * Set max amount of cached items after current
948 * @param obj The slideshow object
949 * @param count max amount of cached items
954 elm_slideshow_cache_after_set(Evas_Object *obj, int count)
956 ELM_CHECK_WIDTYPE(obj, widtype);
957 Widget_Data *wd = elm_widget_data_get(obj);
959 if (count < 0) count = 0;
960 wd->count_item_pre_after = count;
964 * Get the nth item of the slideshow
966 * @param obj The slideshow object
967 * @param nth The number of the element (0 being first)
968 * @return The item stored in slideshow at position required
972 EAPI Elm_Slideshow_Item *
973 elm_slideshow_item_nth_get(const Evas_Object *obj, unsigned int nth)
975 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
976 Widget_Data *wd = elm_widget_data_get(obj);
977 if (!wd) return NULL;
978 return eina_list_nth(wd->items, nth);
982 * Get count of items stored in slideshow
984 * @param obj The slideshow object
985 * @return The count of items
990 elm_slideshow_count_get(const Evas_Object *obj)
992 ELM_CHECK_WIDTYPE(obj, widtype) 0;
993 Widget_Data *wd = elm_widget_data_get(obj);
995 return eina_list_count(wd->items);