From cc62fc71ce8d2738a76bb401ada9e7589b31ba1a Mon Sep 17 00:00:00 2001 From: yoz Date: Tue, 10 May 2011 09:06:51 +0000 Subject: [PATCH] elementary: add 2 method to slideshow item_nth_get and count_get git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@59308 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/Elementary.h.in | 2 ++ src/lib/elm_slideshow.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index 9cf0587..455e12e 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -2116,6 +2116,7 @@ extern "C" { EAPI void *elm_slideshow_item_data_get(const Elm_Slideshow_Item *item) EINA_ARG_NONNULL(1); EAPI Elm_Slideshow_Item *elm_slideshow_item_current_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); EAPI Evas_Object* elm_slideshow_item_object_get(const Elm_Slideshow_Item* item) EINA_ARG_NONNULL(1); + EAPI Elm_Slideshow_Item *elm_slideshow_item_nth_get(const Evas_Object *obj, unsigned int nth) EINA_ARG_NONNULL(1); EAPI const char *elm_slideshow_layout_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); EAPI void elm_slideshow_layout_set(Evas_Object *obj, const char *layout) EINA_ARG_NONNULL(1); EAPI const Eina_List *elm_slideshow_layouts_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); @@ -2123,6 +2124,7 @@ extern "C" { EAPI int elm_slideshow_cache_before_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); EAPI void elm_slideshow_cache_after_set(Evas_Object *obj, int count) EINA_ARG_NONNULL(1); EAPI int elm_slideshow_cache_after_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI unsigned int elm_slideshow_count_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); /* smart callbacks called: * "changed" - when the slideshow switch to another item */ diff --git a/src/lib/elm_slideshow.c b/src/lib/elm_slideshow.c index 073ff39..8d68ad7 100644 --- a/src/lib/elm_slideshow.c +++ b/src/lib/elm_slideshow.c @@ -958,3 +958,39 @@ elm_slideshow_cache_after_set(Evas_Object *obj, int count) if (count < 0) count = 0; 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 * +elm_slideshow_item_nth_get(const Evas_Object *obj, unsigned int nth) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + 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) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return eina_list_count(wd->items); +} + -- 2.7.4