1 #include <Elementary.h>
5 * @defgroup Slideshow Slideshow
7 * This object display a list of object (generally a list of images) and some actions like
8 * next/previous are used to navigate. The animations are defined in the theme,
9 * consequently new animations can be added without having to update the
12 * The slideshow use 2 callbacks to create and delete the objects displayed. When an item
13 * is displayed the function itc->func.get() is called. This function should create the object,
14 * for example the object can be an evas_object_image or a photocam. When an object is no more
15 * displayed the function itc->func.del() is called, the user can delete the dana associated to the item.
17 * Signals that you can add callbacks for are:
19 * "changed" - when the slideshow switch to another item
22 typedef struct _Widget_Data Widget_Data;
24 struct _Elm_Slideshow_Item
28 Eina_List *l, *l_built;
30 const Elm_Slideshow_Item_Class *itc;
35 Evas_Object *slideshow;
37 // list of Elm_Slideshow_Item*
39 Eina_List *items_built;
41 Elm_Slideshow_Item *current;
42 Elm_Slideshow_Item *previous;
44 Eina_List *transitions;
45 const char *transition;
47 int count_item_pre_before;
48 int count_item_pre_after;
55 Eina_List *list; //list of const char *
59 static const char *widtype = NULL;
60 static void _del_hook(Evas_Object *obj);
61 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
62 static void _theme_hook(Evas_Object *obj);
63 static void _sizing_eval(Evas_Object *obj);
64 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
65 static Eina_Bool _timer_cb(void *data);
66 static void _on_focus_hook(void *data, Evas_Object *obj);
67 static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
68 Evas_Callback_Type type, void *event_info);
70 static const char SIG_CHANGED[] = "changed";
72 static const Evas_Smart_Cb_Description _signals[] = {
78 _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
80 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
81 Evas_Event_Key_Down *ev = event_info;
82 Widget_Data *wd = elm_widget_data_get(obj);
83 if (!wd) return EINA_FALSE;
84 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
85 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
86 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
88 elm_slideshow_previous(obj);
89 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
92 if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")))
94 elm_slideshow_next(obj);
95 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
98 if ((!strcmp(ev->keyname, "Return")) ||
99 (!strcmp(ev->keyname, "KP_Enter")) ||
100 (!strcmp(ev->keyname, "space")))
106 ecore_timer_del(wd->timer);
110 elm_slideshow_timeout_set(obj, wd->timeout);
112 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
119 _del_hook(Evas_Object *obj)
122 Widget_Data *wd = elm_widget_data_get(obj);
124 elm_slideshow_clear(obj);
125 elm_widget_stringlist_free(wd->transitions);
126 if (wd->timer) ecore_timer_del(wd->timer);
127 EINA_LIST_FREE(wd->layout.list, layout)
128 eina_stringshare_del(layout);
133 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
135 Widget_Data *wd = elm_widget_data_get(obj);
137 if (elm_widget_focus_get(obj))
139 edje_object_signal_emit(wd->slideshow, "elm,action,focus", "elm");
140 evas_object_focus_set(wd->slideshow, EINA_TRUE);
144 edje_object_signal_emit(wd->slideshow, "elm,action,unfocus", "elm");
145 evas_object_focus_set(wd->slideshow, EINA_FALSE);
150 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
152 Widget_Data *wd = elm_widget_data_get(obj);
154 edje_object_mirrored_set(wd->slideshow, rtl);
158 _theme_hook(Evas_Object *obj)
160 Widget_Data *wd = elm_widget_data_get(obj);
162 _elm_widget_mirrored_reload(obj);
163 _mirrored_set(obj, elm_widget_mirrored_get(obj));
164 _elm_theme_object_set(obj, wd->slideshow, "slideshow", "base", elm_widget_style_get(obj));
165 edje_object_scale_set(wd->slideshow, elm_widget_scale_get(obj) *
171 _sizing_eval(Evas_Object *obj)
173 Widget_Data *wd = elm_widget_data_get(obj);
174 Evas_Coord minw = -1, minh = -1;
176 edje_object_size_min_calc(wd->slideshow, &minw, &minh);
177 evas_object_size_hint_min_set(obj, minw, minh);
178 evas_object_size_hint_max_set(obj, minw, minh);
182 static Elm_Slideshow_Item* _item_prev_get(Elm_Slideshow_Item* item)
184 Widget_Data *wd = elm_widget_data_get(item->base.widget);
185 Elm_Slideshow_Item* prev = eina_list_data_get(eina_list_prev(item->l));
186 if ((!prev) && (wd->loop))
187 prev = eina_list_data_get(eina_list_last(item->l));
191 static Elm_Slideshow_Item* _item_next_get(Elm_Slideshow_Item* item)
193 Widget_Data *wd = elm_widget_data_get(item->base.widget);
194 Elm_Slideshow_Item* next = eina_list_data_get(eina_list_next(item->l));
195 if ((!next) && (wd->loop))
196 next = eina_list_data_get(wd->items);
201 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
207 _sub_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
213 _item_realize(Elm_Slideshow_Item *item)
215 Elm_Slideshow_Item *_item_prev, *_item_next;
216 Evas_Object *obj = item->base.widget;
217 Widget_Data *wd = elm_widget_data_get(obj);
221 if ((!item->base.view) && (item->itc->func.get))
223 item->base.view = item->itc->func.get((void*)item->base.data, obj);
224 evas_object_smart_member_add(item->base.view, obj);
225 item->l_built = eina_list_append(NULL, item);
226 wd->items_built = eina_list_merge(wd->items_built, item->l_built);
227 evas_object_hide(item->base.view);
229 else if (item->l_built)
230 wd->items_built = eina_list_demote_list(wd->items_built, item->l_built);
232 //pre-create previous and next item
233 ac = wd->count_item_pre_after;
235 bc = wd->count_item_pre_before;
237 lc = eina_list_count(wd->items) - 1;
238 while (lc > 0 && ((ac > 0) || (bc > 0)))
240 if (lc > 0 && ac > 0)
246 _item_next = _item_next_get(_item_next);
248 && (!_item_next->base.view)
249 && (_item_next->itc->func.get))
251 _item_next->base.view =
252 _item_next->itc->func.get(
253 (void*)_item_next->base.data, obj);
254 evas_object_smart_member_add(_item_next->base.view, obj);
255 _item_next->l_built = eina_list_append(NULL, _item_next);
256 wd->items_built = eina_list_merge(wd->items_built,
257 _item_next->l_built);
258 evas_object_hide(_item_next->base.view);
260 else if (_item_next && _item_next->l_built)
262 eina_list_demote_list(wd->items_built,
263 _item_next->l_built);
267 if (lc > 0 && bc > 0)
273 _item_prev = _item_prev_get(_item_prev);
275 && (!_item_prev->base.view)
276 && (_item_prev->itc->func.get))
278 _item_prev->base.view =
279 _item_prev->itc->func.get(
280 (void*)_item_prev->base.data, obj);
281 evas_object_smart_member_add(_item_prev->base.view, obj);
282 _item_prev->l_built = eina_list_append(NULL, _item_prev);
283 wd->items_built = eina_list_merge(wd->items_built,
284 _item_prev->l_built);
285 evas_object_hide(_item_prev->base.view);
287 else if (_item_prev && _item_prev->l_built)
289 eina_list_demote_list(wd->items_built,
290 _item_prev->l_built);
295 //delete unused items
296 lc = wd->count_item_pre_before + wd->count_item_pre_after + 1;
297 while ((int)eina_list_count(wd->items_built) > lc)
299 item = eina_list_data_get(wd->items_built);
300 wd->items_built = eina_list_remove_list(wd->items_built,
302 if (item->itc->func.del)
303 item->itc->func.del((void*)item->base.data, item->base.view);
304 evas_object_del(item->base.view);
305 item->base.view = NULL;
310 _end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
312 Elm_Slideshow_Item *item;
313 Widget_Data *wd = elm_widget_data_get(data);
319 edje_object_part_unswallow(NULL, item->base.view);
320 evas_object_hide(item->base.view);
326 if ((!item) || (!item->base.view)) return;
329 edje_object_part_unswallow(NULL, item->base.view);
330 evas_object_show(item->base.view);
332 edje_object_signal_emit(wd->slideshow, "anim,end", "slideshow");
333 edje_object_part_swallow(wd->slideshow, "elm.swallow.1", item->base.view);
337 _timer_cb(void *data)
339 Evas_Object *obj = data;
340 Widget_Data *wd = elm_widget_data_get(obj);
341 if (!wd) return ECORE_CALLBACK_CANCEL;
343 elm_slideshow_next(obj);
344 return ECORE_CALLBACK_CANCEL;
348 * Add a new slideshow to the parent
350 * @param parent The parent object
351 * @return The new object or NULL if it cannot be created
356 elm_slideshow_add(Evas_Object *parent)
362 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
364 ELM_SET_WIDTYPE(widtype, "slideshow");
365 elm_widget_type_set(obj, "slideshow");
366 elm_widget_sub_object_add(parent, obj);
367 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
368 elm_widget_data_set(obj, wd);
369 elm_widget_del_hook_set(obj, _del_hook);
370 elm_widget_theme_hook_set(obj, _theme_hook);
371 elm_widget_can_focus_set(obj, EINA_TRUE);
372 elm_widget_event_hook_set(obj, _event_hook);
377 wd->slideshow = edje_object_add(e);
378 _elm_theme_object_set(obj, wd->slideshow, "slideshow", "base", "default");
379 evas_object_smart_member_add(wd->slideshow, obj);
380 wd->count_item_pre_before = 2;
381 wd->count_item_pre_after = 2;
382 elm_widget_resize_object_set(obj, wd->slideshow);
383 evas_object_show(wd->slideshow);
385 wd->transitions = elm_widget_stringlist_get(edje_object_data_get(wd->slideshow, "transitions"));
386 if (eina_list_count(wd->transitions) > 0)
387 wd->transition = eina_stringshare_add(eina_list_data_get(wd->transitions));
389 wd->layout.list = elm_widget_stringlist_get(edje_object_data_get(wd->slideshow, "layouts"));
390 if (eina_list_count(wd->layout.list) > 0)
391 wd->layout.current = eina_list_data_get(wd->layout.list);
393 edje_object_signal_callback_add(wd->slideshow, "end", "slideshow", _end, obj);
395 evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
396 evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
398 evas_object_smart_callbacks_descriptions_set(obj, _signals);
400 _mirrored_set(obj, elm_widget_mirrored_get(obj));
406 * Add an object in the list. The object can be a evas object image or a elm photo for example.
408 * @param obj The slideshow object
409 * @aram itc Callbacks used to create the object and delete the data associated when the item is deleted.
410 * @param data Data used by the user to identified the item
411 * @return Returns The slideshow item
415 EAPI Elm_Slideshow_Item*
416 elm_slideshow_item_add(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, const void *data)
418 Elm_Slideshow_Item *item;
419 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
420 Widget_Data *wd = elm_widget_data_get(obj);
422 if (!wd) return NULL;
423 item = elm_widget_item_new(obj, Elm_Slideshow_Item);
424 item->base.data = data;
426 item->l = eina_list_append(item->l, item);
428 wd->items = eina_list_merge(wd->items, item->l);
430 if (!wd->current) elm_slideshow_show(item);
436 * Insert an object in the list. The object can be a evas object image or a elm photo for example.
438 * @param obj The slideshow object
439 * @aram itc Callbacks used to create the object and delete the data associated when the item is deleted.
440 * @param data Data used by the user to identified the item
441 * @param func The function to compare data
442 * @return Returns The slideshow item
446 EAPI Elm_Slideshow_Item*
447 elm_slideshow_item_sorted_insert(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, const void *data, Eina_Compare_Cb func)
449 Elm_Slideshow_Item *item;
450 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
451 Widget_Data *wd = elm_widget_data_get(obj);
453 if (!wd) return NULL;
454 item = elm_widget_item_new(obj, Elm_Slideshow_Item);
455 item->base.data = data;
457 item->l = eina_list_append(item->l, item);
459 wd->items = eina_list_sorted_merge(wd->items, item->l, func);
461 if (!wd->current) elm_slideshow_show(item);
469 * @param obj The slideshow object
470 * @param item The item
475 elm_slideshow_show(Elm_Slideshow_Item *item)
478 Elm_Slideshow_Item *next = NULL;
480 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
481 wd = elm_widget_data_get(item->base.widget);
484 if (item == wd->current)
488 _end(item->base.widget, item->base.widget, NULL, NULL);
490 if (wd->timer) ecore_timer_del(wd->timer);
491 if (wd->timeout > 0.0)
492 wd->timer = ecore_timer_add(wd->timeout, _timer_cb, item->base.widget);
494 edje_object_part_swallow(wd->slideshow, "elm.swallow.2", next->base.view);
495 evas_object_show(next->base.view);
496 snprintf(buf, sizeof(buf), "%s,next", wd->transition);
497 edje_object_signal_emit(wd->slideshow, buf, "slideshow");
498 wd->previous = wd->current;
500 evas_object_smart_callback_call(item->base.widget, SIG_CHANGED, wd->current);
504 * Go to the next item
506 * @param obj The slideshow object
511 elm_slideshow_next(Evas_Object *obj)
514 Elm_Slideshow_Item *next = NULL;
515 ELM_CHECK_WIDTYPE(obj, widtype);
516 Widget_Data *wd = elm_widget_data_get(obj);
521 next = _item_next_get(wd->current);
523 if ((!next) || (next == wd->current)) return;
525 _end(obj, obj, NULL, NULL);
527 if (wd->timer) ecore_timer_del(wd->timer);
528 if (wd->timeout > 0.0)
529 wd->timer = ecore_timer_add(wd->timeout, _timer_cb, obj);
533 edje_object_part_swallow(wd->slideshow, "elm.swallow.2", next->base.view);
534 evas_object_show(next->base.view);
536 snprintf(buf, sizeof(buf), "%s,next", wd->transition);
537 edje_object_signal_emit(wd->slideshow, buf, "slideshow");
539 wd->previous = wd->current;
541 evas_object_smart_callback_call(obj, SIG_CHANGED, wd->current);
545 * Go to the previous item
547 * @param obj The slideshow object
552 elm_slideshow_previous(Evas_Object *obj)
555 Elm_Slideshow_Item *prev = NULL;
556 ELM_CHECK_WIDTYPE(obj, widtype);
557 Widget_Data *wd = elm_widget_data_get(obj);
562 prev = _item_prev_get(wd->current);
564 if ((!prev) || (prev == wd->current)) return;
566 _end(obj, obj, NULL, NULL);
568 if (wd->timer) ecore_timer_del(wd->timer);
569 if (wd->timeout > 0.0)
570 wd->timer = ecore_timer_add(wd->timeout, _timer_cb, obj);
574 edje_object_part_swallow(wd->slideshow, "elm.swallow.2", prev->base.view);
575 evas_object_show(prev->base.view);
577 snprintf(buf, 1024, "%s,previous", wd->transition);
578 edje_object_signal_emit(wd->slideshow, buf, "slideshow");
580 wd->previous = wd->current;
582 evas_object_smart_callback_call(obj, SIG_CHANGED, wd->current);
586 * Returns the list of transitions available.
588 * @param obj The slideshow object
589 * @return Returns the list of transitions (list of const char*)
593 EAPI const Eina_List *
594 elm_slideshow_transitions_get(const Evas_Object *obj)
596 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
597 Widget_Data *wd = elm_widget_data_get(obj);
598 if (!wd) return NULL;
599 return wd->transitions;
603 * Returns the list of layouts available.
605 * @param obj The slideshow object
606 * @return Returns the list of layout (list of const char*)
610 EAPI const Eina_List *
611 elm_slideshow_layouts_get(const Evas_Object *obj)
613 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
614 Widget_Data *wd = elm_widget_data_get(obj);
615 if (!wd) return NULL;
616 return wd->layout.list;
620 * Set the transition to use
622 * @param obj The slideshow object
623 * @param transition the new transition
628 elm_slideshow_transition_set(Evas_Object *obj, const char *transition)
630 ELM_CHECK_WIDTYPE(obj, widtype);
631 Widget_Data *wd = elm_widget_data_get(obj);
633 eina_stringshare_replace(&wd->transition, transition);
637 * Returns the transition to use
639 * @param obj The slideshow object
640 * @return the transition set
645 elm_slideshow_transition_get(const Evas_Object *obj)
647 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
648 Widget_Data *wd = elm_widget_data_get(obj);
649 if (!wd) return NULL;
650 return wd->transition;
654 * The slideshow can go to the next item automatically after a few seconds.
655 * This method set the timeout to use. A timeout <=0 disable the timer.
657 * @param obj The slideshow object
658 * @param timeout The new timeout
663 elm_slideshow_timeout_set(Evas_Object *obj, double timeout)
665 ELM_CHECK_WIDTYPE(obj, widtype);
666 Widget_Data *wd = elm_widget_data_get(obj);
668 wd->timeout = timeout;
669 if (wd->timer) ecore_timer_del(wd->timer);
672 wd->timer = ecore_timer_add(timeout, _timer_cb, obj);
676 * Returns the timeout value
678 * @param obj The slideshow object
679 * @return Returns the timeout
684 elm_slideshow_timeout_get(const Evas_Object *obj)
686 ELM_CHECK_WIDTYPE(obj, widtype) -1.0;
687 Widget_Data *wd = elm_widget_data_get(obj);
688 if (!wd) return -1.0;
693 * Set if the first item should follow the last and vice versa
695 * @param obj The slideshow object
696 * @param loop if EINA_TRUE, the first item will follow the last and vice versa
701 elm_slideshow_loop_set(Evas_Object *obj, Eina_Bool loop)
703 ELM_CHECK_WIDTYPE(obj, widtype);
704 Widget_Data *wd = elm_widget_data_get(obj);
710 * Returns the current layout name
712 * @param obj The slideshow object
713 * @returns Returns the layout name
718 elm_slideshow_layout_get(const Evas_Object *obj)
720 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
721 Widget_Data *wd = elm_widget_data_get(obj);
722 if (!wd) return EINA_FALSE;
723 return wd->layout.current;
729 * @param obj The slideshow object
730 * @param layout the new layout
735 elm_slideshow_layout_set(Evas_Object *obj, const char *layout)
738 ELM_CHECK_WIDTYPE(obj, widtype);
739 Widget_Data *wd = elm_widget_data_get(obj);
742 wd->layout.current = layout;
743 snprintf(buf, sizeof(buf), "layout,%s", layout);
744 edje_object_signal_emit(wd->slideshow, buf, "slideshow");
748 * Return if the first item should follow the last and vice versa
750 * @param obj The slideshow object
751 * @returns Returns the loop flag
756 elm_slideshow_loop_get(const Evas_Object *obj)
758 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
759 Widget_Data *wd = elm_widget_data_get(obj);
760 if (!wd) return EINA_FALSE;
765 * Delete all the items
767 * @param obj The slideshow object
772 elm_slideshow_clear(Evas_Object *obj)
774 Elm_Slideshow_Item *item;
775 ELM_CHECK_WIDTYPE(obj, widtype);
776 Widget_Data *wd = elm_widget_data_get(obj);
780 EINA_LIST_FREE(wd->items_built, item)
782 if (item->itc->func.del)
783 item->itc->func.del((void*)item->base.data, item->base.view);
784 evas_object_del(item->base.view);
785 item->base.view = NULL;
788 EINA_LIST_FREE(wd->items, item)
790 elm_widget_item_del(item);
797 * @param item The slideshow item
802 elm_slideshow_item_del(Elm_Slideshow_Item *item)
804 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
805 Widget_Data *wd = elm_widget_data_get(item->base.widget);
807 if (wd->previous == item) wd->previous = NULL;
808 if (wd->current == item)
810 Eina_List *l = eina_list_data_find_list(wd->items, item);
811 Eina_List *l2 = eina_list_next(l);
814 l2 = eina_list_nth_list(wd->items, eina_list_count(wd->items) - 1);
816 elm_slideshow_show(eina_list_data_get(l2));
819 wd->items = eina_list_remove_list(wd->items, item->l);
820 wd->items_built = eina_list_remove_list(wd->items_built, item->l_built);
822 if ((item->base.view) && (item->itc->func.del))
823 item->itc->func.del((void*)item->base.data, item->base.view);
825 evas_object_del(item->base.view);
830 * Returns the list of items
831 * @param obj The slideshow object
832 * @return Returns the list of items (list of Elm_Slideshow_Item).
836 EAPI const Eina_List *
837 elm_slideshow_items_get(const Evas_Object *obj)
839 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
840 Widget_Data *wd = elm_widget_data_get(obj);
841 if (!wd) return NULL;
846 * Returns the current item displayed
848 * @param obj The slideshow object
849 * @return Returns the current item displayed
853 EAPI Elm_Slideshow_Item *
854 elm_slideshow_item_current_get(const Evas_Object *obj)
856 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
857 Widget_Data *wd = elm_widget_data_get(obj);
858 if (!wd) return NULL;
863 * Returns the evas object associated to an item
865 * @param item The slideshow item
866 * @return Returns the evas object associated to this item
871 elm_slideshow_item_object_get(const Elm_Slideshow_Item * item)
873 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
874 return item->base.view;
878 * Returns the data associated to an item
880 * @param item The slideshow item
881 * @return Returns the data associated to this item
886 elm_slideshow_item_data_get(const Elm_Slideshow_Item * item)
888 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
889 return elm_widget_item_data_get(item);
893 * Returns max amount of cached items before current
895 * @param obj The slideshow object
896 * @return Returns max amount of cached items
901 elm_slideshow_cache_before_get(const Evas_Object *obj)
903 ELM_CHECK_WIDTYPE(obj, widtype) -1;
904 Widget_Data *wd = elm_widget_data_get(obj);
906 return wd->count_item_pre_before;
910 * Set max amount of cached items before current
912 * @param obj The slideshow object
913 * @param count Max amount of cached items
918 elm_slideshow_cache_before_set(Evas_Object *obj, int count)
920 ELM_CHECK_WIDTYPE(obj, widtype);
921 Widget_Data *wd = elm_widget_data_get(obj);
923 if (count < 0) count = 0;
924 wd->count_item_pre_before = count;
928 * Returns max amount of cached items after current
930 * @param obj The slideshow object
931 * @return Returns max amount of cached items
936 elm_slideshow_cache_after_get(const Evas_Object *obj)
938 ELM_CHECK_WIDTYPE(obj, widtype) -1;
939 Widget_Data *wd = elm_widget_data_get(obj);
941 return wd->count_item_pre_after;
945 * Set max amount of cached items after current
947 * @param obj The slideshow object
948 * @param count max amount of cached items
953 elm_slideshow_cache_after_set(Evas_Object *obj, int count)
955 ELM_CHECK_WIDTYPE(obj, widtype);
956 Widget_Data *wd = elm_widget_data_get(obj);
958 if (count < 0) count = 0;
959 wd->count_item_pre_after = count;
963 * Get the nth item of the slideshow
965 * @param obj The slideshow object
966 * @param nth The number of the element (0 being first)
967 * @return The item stored in slideshow at position required
971 EAPI Elm_Slideshow_Item *
972 elm_slideshow_item_nth_get(const Evas_Object *obj, unsigned int nth)
974 ELM_CHECK_WIDTYPE(obj, widtype);
975 Widget_Data *wd = elm_widget_data_get(obj);
976 if (!wd) return NULL;
977 return eina_list_nth(wd->items, nth);
981 * Get count of items stored in slideshow
983 * @param obj The slideshow object
984 * @return The count of items
989 elm_slideshow_count_get(const Evas_Object *obj)
991 ELM_CHECK_WIDTYPE(obj, widtype);
992 Widget_Data *wd = elm_widget_data_get(obj);
994 return eina_list_count(wd->items);