2009-09-23 15:56:47 -07:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
|
|
|
|
|
|
|
typedef struct _Widget_Data Widget_Data;
|
2011-12-08 03:01:01 -08:00
|
|
|
typedef struct _Elm_Slideshow_Item Elm_Slideshow_Item;
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2009-10-12 13:02:56 -07:00
|
|
|
struct _Elm_Slideshow_Item
|
|
|
|
{
|
2011-10-20 17:45:19 -07:00
|
|
|
ELM_WIDGET_ITEM;
|
2009-10-12 13:02:56 -07:00
|
|
|
|
2010-07-15 10:09:59 -07:00
|
|
|
Eina_List *l, *l_built;
|
2009-10-12 13:02:56 -07:00
|
|
|
|
|
|
|
const Elm_Slideshow_Item_Class *itc;
|
|
|
|
};
|
|
|
|
|
2009-09-23 15:56:47 -07:00
|
|
|
struct _Widget_Data
|
|
|
|
{
|
|
|
|
Evas_Object *slideshow;
|
|
|
|
|
2009-10-12 13:02:56 -07:00
|
|
|
// list of Elm_Slideshow_Item*
|
2009-10-11 10:18:44 -07:00
|
|
|
Eina_List *items;
|
2009-10-29 10:26:52 -07:00
|
|
|
Eina_List *items_built;
|
2010-07-15 02:30:52 -07:00
|
|
|
|
2009-10-12 13:02:56 -07:00
|
|
|
Elm_Slideshow_Item *current;
|
|
|
|
Elm_Slideshow_Item *previous;
|
2009-09-23 15:56:47 -07:00
|
|
|
|
|
|
|
Eina_List *transitions;
|
|
|
|
const char *transition;
|
2009-09-24 02:43:05 -07:00
|
|
|
|
2011-04-22 02:19:25 -07:00
|
|
|
int count_item_pre_before;
|
|
|
|
int count_item_pre_after;
|
2009-09-24 02:43:05 -07:00
|
|
|
Ecore_Timer *timer;
|
2011-01-09 21:27:15 -08:00
|
|
|
double timeout;
|
2010-04-05 13:23:30 -07:00
|
|
|
Eina_Bool loop:1;
|
2010-07-14 02:07:43 -07:00
|
|
|
|
2012-03-28 02:02:22 -07:00
|
|
|
struct
|
|
|
|
{
|
2011-04-01 04:24:15 -07:00
|
|
|
const char *current;
|
|
|
|
Eina_List *list; //list of const char *
|
2012-03-28 02:02:22 -07:00
|
|
|
} layout;
|
2009-09-23 15:56:47 -07:00
|
|
|
};
|
|
|
|
|
2010-03-08 22:15:39 -08:00
|
|
|
static const char *widtype = NULL;
|
2011-10-30 17:13:32 -07:00
|
|
|
static void _del_pre_hook(Evas_Object *obj);
|
2009-09-23 15:56:47 -07:00
|
|
|
static void _del_hook(Evas_Object *obj);
|
2011-02-08 04:08:28 -08:00
|
|
|
static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
|
2009-09-23 15:56:47 -07:00
|
|
|
static void _theme_hook(Evas_Object *obj);
|
|
|
|
static void _sizing_eval(Evas_Object *obj);
|
|
|
|
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
2010-06-25 02:58:14 -07:00
|
|
|
static Eina_Bool _timer_cb(void *data);
|
2010-09-22 10:45:46 -07:00
|
|
|
static void _on_focus_hook(void *data, Evas_Object *obj);
|
2010-09-27 14:13:41 -07:00
|
|
|
static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
|
|
|
|
Evas_Callback_Type type, void *event_info);
|
|
|
|
|
2011-04-21 17:42:32 -07:00
|
|
|
static const char SIG_CHANGED[] = "changed";
|
From: Rajeev Ranjan (Rajeev) <rajeev.r@samsung.com> <rajeev.jnnce@gmail.com>
Subject: Re: [E-devel] [Patch] elm_slideshow patch
From: PRINCE KUMAR DUBEY <prince.dubey@samsung.com>
On behalf of Rajeev Ranjan, I am submitting the elm_slideshow patch
which add support for getting notification when transition completes.
Change Log:
new signal “transition,end” has been introduced to get notification
when transition completes.
Detail Description:
The actual requirement is to get user notified when the last item is
visible in the slideshow. In this case, user wants to take some
action, say updating button text to Restart if the slideshow does not
have loop.
The current implementation of slideshow has a signal called “changed”
which has current visible item as event_info parameter in the
callback. User can compare it with the last appended item and come to
know that the last item is visible if even_info is equal to the data
passed which should be the last appended item. The only problem is
that this signal is emitted by C code asynchronously to the
transition, hence if the transition involves an animation, user will
most likely get it even before the transition completes. This may look
bad to the user if the button label gets updated to Restart even
before the last transition gets over.
In order to fulfill the requirement, I have introduced another signal
“transition,end” which is emitted once the transition is over.
The same requirement could have been fulfilled by emitting “changed”
signal after the transition gets over but then this will be different
from the existing implementation for other widgets, hence I introduced
the new signal “transition,end”.
SVN revision: 65951
2011-12-06 01:03:01 -08:00
|
|
|
static const char SIG_TRANSITION_END[] = "transition,end";
|
2011-04-21 17:42:32 -07:00
|
|
|
|
|
|
|
static const Evas_Smart_Cb_Description _signals[] = {
|
|
|
|
{SIG_CHANGED, ""},
|
From: Rajeev Ranjan (Rajeev) <rajeev.r@samsung.com> <rajeev.jnnce@gmail.com>
Subject: Re: [E-devel] [Patch] elm_slideshow patch
From: PRINCE KUMAR DUBEY <prince.dubey@samsung.com>
On behalf of Rajeev Ranjan, I am submitting the elm_slideshow patch
which add support for getting notification when transition completes.
Change Log:
new signal “transition,end” has been introduced to get notification
when transition completes.
Detail Description:
The actual requirement is to get user notified when the last item is
visible in the slideshow. In this case, user wants to take some
action, say updating button text to Restart if the slideshow does not
have loop.
The current implementation of slideshow has a signal called “changed”
which has current visible item as event_info parameter in the
callback. User can compare it with the last appended item and come to
know that the last item is visible if even_info is equal to the data
passed which should be the last appended item. The only problem is
that this signal is emitted by C code asynchronously to the
transition, hence if the transition involves an animation, user will
most likely get it even before the transition completes. This may look
bad to the user if the button label gets updated to Restart even
before the last transition gets over.
In order to fulfill the requirement, I have introduced another signal
“transition,end” which is emitted once the transition is over.
The same requirement could have been fulfilled by emitting “changed”
signal after the transition gets over but then this will be different
from the existing implementation for other widgets, hence I introduced
the new signal “transition,end”.
SVN revision: 65951
2011-12-06 01:03:01 -08:00
|
|
|
{SIG_TRANSITION_END, ""},
|
2011-04-21 17:42:32 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2010-09-27 14:13:41 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
|
|
|
|
{
|
|
|
|
if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
|
|
|
|
Evas_Event_Key_Down *ev = event_info;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
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;
|
2012-04-06 03:34:03 -07:00
|
|
|
if ((!strcmp(ev->keyname, "Left")) ||
|
|
|
|
((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)))
|
2010-09-27 14:13:41 -07:00
|
|
|
{
|
|
|
|
elm_slideshow_previous(obj);
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2012-04-06 03:34:03 -07:00
|
|
|
if ((!strcmp(ev->keyname, "Right")) ||
|
|
|
|
((!strcmp(ev->keyname, "KP_Right")) && (!ev->string)))
|
2010-09-27 14:13:41 -07:00
|
|
|
{
|
|
|
|
elm_slideshow_next(obj);
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2010-11-29 05:56:33 -08:00
|
|
|
if ((!strcmp(ev->keyname, "Return")) ||
|
|
|
|
(!strcmp(ev->keyname, "KP_Enter")) ||
|
|
|
|
(!strcmp(ev->keyname, "space")))
|
2010-09-27 14:13:41 -07:00
|
|
|
{
|
|
|
|
if (wd->timeout)
|
2011-01-20 12:07:57 -08:00
|
|
|
{
|
|
|
|
if (wd->timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(wd->timer);
|
|
|
|
wd->timer = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
elm_slideshow_timeout_set(obj, wd->timeout);
|
|
|
|
}
|
2010-09-27 14:13:41 -07:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2011-10-30 17:13:32 -07:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2009-09-27 20:07:20 -07:00
|
|
|
static void
|
2009-09-23 15:56:47 -07:00
|
|
|
_del_hook(Evas_Object *obj)
|
|
|
|
{
|
2010-07-15 10:09:59 -07:00
|
|
|
const char *layout;
|
2009-09-23 15:56:47 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 08:27:46 -08:00
|
|
|
if (!wd) return;
|
2009-09-24 02:43:05 -07:00
|
|
|
elm_slideshow_clear(obj);
|
2010-09-13 00:56:23 -07:00
|
|
|
elm_widget_stringlist_free(wd->transitions);
|
2009-09-27 20:07:20 -07:00
|
|
|
if (wd->timer) ecore_timer_del(wd->timer);
|
2010-07-14 14:12:58 -07:00
|
|
|
EINA_LIST_FREE(wd->layout.list, layout)
|
2011-04-01 04:24:15 -07:00
|
|
|
eina_stringshare_del(layout);
|
2009-09-23 15:56:47 -07:00
|
|
|
free(wd);
|
|
|
|
}
|
|
|
|
|
2010-09-22 10:45:46 -07:00
|
|
|
static void
|
|
|
|
_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
if (elm_widget_focus_get(obj))
|
|
|
|
{
|
2011-04-01 04:24:15 -07:00
|
|
|
edje_object_signal_emit(wd->slideshow, "elm,action,focus", "elm");
|
|
|
|
evas_object_focus_set(wd->slideshow, EINA_TRUE);
|
2010-09-22 10:45:46 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-04-01 04:24:15 -07:00
|
|
|
edje_object_signal_emit(wd->slideshow, "elm,action,unfocus", "elm");
|
|
|
|
evas_object_focus_set(wd->slideshow, EINA_FALSE);
|
2010-09-22 10:45:46 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
static void
|
|
|
|
_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
edje_object_mirrored_set(wd->slideshow, rtl);
|
|
|
|
}
|
|
|
|
|
2009-09-27 20:07:20 -07:00
|
|
|
static void
|
2009-09-23 15:56:47 -07:00
|
|
|
_theme_hook(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 08:27:46 -08:00
|
|
|
if (!wd) return;
|
2011-02-09 08:14:02 -08:00
|
|
|
_elm_widget_mirrored_reload(obj);
|
2011-02-08 04:08:28 -08:00
|
|
|
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
2010-07-14 14:14:52 -07:00
|
|
|
_elm_theme_object_set(obj, wd->slideshow, "slideshow", "base", elm_widget_style_get(obj));
|
2009-10-29 10:26:52 -07:00
|
|
|
edje_object_scale_set(wd->slideshow, elm_widget_scale_get(obj) *
|
2009-09-27 20:07:20 -07:00
|
|
|
_elm_config->scale);
|
2009-09-23 15:56:47 -07:00
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
2009-09-27 20:07:20 -07:00
|
|
|
static void
|
2009-09-23 15:56:47 -07:00
|
|
|
_sizing_eval(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Evas_Coord minw = -1, minh = -1;
|
2010-03-09 08:27:46 -08:00
|
|
|
if (!wd) return;
|
2009-09-23 15:56:47 -07:00
|
|
|
edje_object_size_min_calc(wd->slideshow, &minw, &minh);
|
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
|
|
|
evas_object_size_hint_max_set(obj, minw, minh);
|
|
|
|
}
|
|
|
|
|
2010-07-14 14:12:58 -07:00
|
|
|
|
|
|
|
static Elm_Slideshow_Item* _item_prev_get(Elm_Slideshow_Item* item)
|
|
|
|
{
|
2011-10-20 18:08:01 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(WIDGET(item));
|
2011-04-01 04:24:15 -07:00
|
|
|
Elm_Slideshow_Item* prev = eina_list_data_get(eina_list_prev(item->l));
|
2011-04-22 05:06:00 -07:00
|
|
|
if ((!prev) && (wd->loop))
|
2011-04-01 04:24:15 -07:00
|
|
|
prev = eina_list_data_get(eina_list_last(item->l));
|
|
|
|
return prev;
|
2010-07-14 14:12:58 -07:00
|
|
|
}
|
2011-02-08 14:23:00 -08:00
|
|
|
|
2010-07-14 14:12:58 -07:00
|
|
|
static Elm_Slideshow_Item* _item_next_get(Elm_Slideshow_Item* item)
|
|
|
|
{
|
2011-10-20 18:08:01 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(WIDGET(item));
|
2011-04-01 04:24:15 -07:00
|
|
|
Elm_Slideshow_Item* next = eina_list_data_get(eina_list_next(item->l));
|
2011-04-22 05:06:00 -07:00
|
|
|
if ((!next) && (wd->loop))
|
2011-04-01 04:24:15 -07:00
|
|
|
next = eina_list_data_get(wd->items);
|
|
|
|
return next;
|
2010-07-14 14:12:58 -07:00
|
|
|
}
|
|
|
|
|
2009-09-27 20:07:20 -07:00
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-09-23 15:56:47 -07:00
|
|
|
{
|
|
|
|
_sizing_eval(data);
|
|
|
|
}
|
|
|
|
|
2009-09-27 20:07:20 -07:00
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_sub_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-09-23 15:56:47 -07:00
|
|
|
{
|
2009-11-25 13:06:23 -08:00
|
|
|
;
|
2009-09-23 15:56:47 -07:00
|
|
|
}
|
|
|
|
|
2009-09-27 20:07:20 -07:00
|
|
|
static void
|
2010-07-15 10:09:59 -07:00
|
|
|
_item_realize(Elm_Slideshow_Item *item)
|
2009-09-23 15:56:47 -07:00
|
|
|
{
|
2011-04-22 02:19:25 -07:00
|
|
|
Elm_Slideshow_Item *_item_prev, *_item_next;
|
2011-10-20 18:08:01 -07:00
|
|
|
Evas_Object *obj = WIDGET(item);
|
2010-08-18 12:18:42 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2011-08-26 06:54:12 -07:00
|
|
|
int ac, bc, lc, ic = 0;
|
2010-07-14 14:12:58 -07:00
|
|
|
|
2010-08-18 12:18:42 -07:00
|
|
|
if (!wd) return;
|
2011-10-20 18:08:01 -07:00
|
|
|
if ((!VIEW(item)) && (item->itc->func.get))
|
2010-08-18 12:18:42 -07:00
|
|
|
{
|
2011-12-08 23:08:49 -08:00
|
|
|
VIEW(item) = item->itc->func.get(elm_widget_item_data_get(item),
|
|
|
|
obj);
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_smart_member_add(VIEW(item), obj);
|
2010-08-18 12:18:42 -07:00
|
|
|
item->l_built = eina_list_append(NULL, item);
|
|
|
|
wd->items_built = eina_list_merge(wd->items_built, item->l_built);
|
2012-04-03 08:18:09 -07:00
|
|
|
//FIXME: item could be showed by obj
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_hide(VIEW(item));
|
2010-08-18 12:18:42 -07:00
|
|
|
}
|
|
|
|
else if (item->l_built)
|
|
|
|
wd->items_built = eina_list_demote_list(wd->items_built, item->l_built);
|
|
|
|
|
|
|
|
//pre-create previous and next item
|
2011-04-22 02:19:25 -07:00
|
|
|
ac = wd->count_item_pre_after;
|
|
|
|
_item_next = item;
|
|
|
|
bc = wd->count_item_pre_before;
|
|
|
|
_item_prev = item;
|
|
|
|
lc = eina_list_count(wd->items) - 1;
|
|
|
|
while (lc > 0 && ((ac > 0) || (bc > 0)))
|
2010-08-18 12:18:42 -07:00
|
|
|
{
|
2011-04-22 02:19:25 -07:00
|
|
|
if (lc > 0 && ac > 0)
|
|
|
|
{
|
|
|
|
--ac;
|
|
|
|
--lc;
|
2011-05-10 01:38:02 -07:00
|
|
|
if (_item_next)
|
2011-04-22 02:19:25 -07:00
|
|
|
{
|
2011-05-10 01:38:02 -07:00
|
|
|
_item_next = _item_next_get(_item_next);
|
|
|
|
if ((_item_next)
|
2011-10-20 18:08:01 -07:00
|
|
|
&& (!VIEW(_item_next))
|
2011-05-10 01:38:02 -07:00
|
|
|
&& (_item_next->itc->func.get))
|
|
|
|
{
|
2011-08-28 00:18:28 -07:00
|
|
|
ic++;
|
2011-10-20 18:08:01 -07:00
|
|
|
VIEW(_item_next) =
|
2011-05-10 01:38:02 -07:00
|
|
|
_item_next->itc->func.get(
|
2011-12-08 23:08:49 -08:00
|
|
|
elm_widget_item_data_get(_item_next), obj);
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_smart_member_add(VIEW(_item_next), obj);
|
2011-05-10 01:38:02 -07:00
|
|
|
_item_next->l_built = eina_list_append(NULL, _item_next);
|
|
|
|
wd->items_built = eina_list_merge(wd->items_built,
|
|
|
|
_item_next->l_built);
|
2012-04-03 08:18:09 -07:00
|
|
|
//FIXME: _item_next could be showed by obj later
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_hide(VIEW(_item_next));
|
2011-05-10 01:38:02 -07:00
|
|
|
}
|
|
|
|
else if (_item_next && _item_next->l_built)
|
2011-08-26 06:54:12 -07:00
|
|
|
{
|
2011-08-28 00:18:28 -07:00
|
|
|
ic++;
|
2011-08-26 06:54:12 -07:00
|
|
|
wd->items_built =
|
|
|
|
eina_list_demote_list(wd->items_built,
|
2011-05-10 01:38:02 -07:00
|
|
|
_item_next->l_built);
|
2011-08-26 06:54:12 -07:00
|
|
|
}
|
2011-04-22 02:19:25 -07:00
|
|
|
}
|
|
|
|
}
|
2010-08-18 12:18:42 -07:00
|
|
|
|
2011-04-22 02:19:25 -07:00
|
|
|
if (lc > 0 && bc > 0)
|
|
|
|
{
|
|
|
|
--bc;
|
|
|
|
--lc;
|
2011-05-10 01:38:02 -07:00
|
|
|
if (_item_prev)
|
2011-04-22 02:19:25 -07:00
|
|
|
{
|
2011-05-10 01:38:02 -07:00
|
|
|
_item_prev = _item_prev_get(_item_prev);
|
|
|
|
if ((_item_prev)
|
2011-10-20 18:08:01 -07:00
|
|
|
&& (!VIEW(_item_prev))
|
2011-05-10 01:38:02 -07:00
|
|
|
&& (_item_prev->itc->func.get))
|
|
|
|
{
|
2011-08-28 00:18:28 -07:00
|
|
|
ic++;
|
2011-10-20 18:08:01 -07:00
|
|
|
VIEW(_item_prev) =
|
2011-05-10 01:38:02 -07:00
|
|
|
_item_prev->itc->func.get(
|
2011-12-08 23:08:49 -08:00
|
|
|
elm_widget_item_data_get(_item_prev), obj);
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_smart_member_add(VIEW(_item_prev), obj);
|
2011-05-10 01:38:02 -07:00
|
|
|
_item_prev->l_built = eina_list_append(NULL, _item_prev);
|
|
|
|
wd->items_built = eina_list_merge(wd->items_built,
|
|
|
|
_item_prev->l_built);
|
2012-04-03 08:18:09 -07:00
|
|
|
//FIXME: _item_prev could be showed by obj later
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_hide(VIEW(_item_prev));
|
2011-05-10 01:38:02 -07:00
|
|
|
}
|
|
|
|
else if (_item_prev && _item_prev->l_built)
|
2011-08-26 06:54:12 -07:00
|
|
|
{
|
2011-08-28 00:18:28 -07:00
|
|
|
ic++;
|
2011-08-26 06:54:12 -07:00
|
|
|
wd->items_built =
|
|
|
|
eina_list_demote_list(wd->items_built,
|
2011-05-10 01:38:02 -07:00
|
|
|
_item_prev->l_built);
|
2011-08-26 06:54:12 -07:00
|
|
|
}
|
2011-04-22 02:19:25 -07:00
|
|
|
}
|
|
|
|
}
|
2010-08-18 12:18:42 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//delete unused items
|
2011-08-26 06:54:12 -07:00
|
|
|
lc = ic + 1;
|
2011-04-22 05:06:00 -07:00
|
|
|
while ((int)eina_list_count(wd->items_built) > lc)
|
2010-08-18 12:18:42 -07:00
|
|
|
{
|
2011-04-22 02:19:25 -07:00
|
|
|
item = eina_list_data_get(wd->items_built);
|
|
|
|
wd->items_built = eina_list_remove_list(wd->items_built,
|
|
|
|
wd->items_built);
|
2011-04-22 05:06:00 -07:00
|
|
|
if (item->itc->func.del)
|
2011-12-08 23:08:49 -08:00
|
|
|
item->itc->func.del(elm_widget_item_data_get(item), VIEW(item));
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_del(VIEW(item));
|
|
|
|
VIEW(item) = NULL;
|
2010-08-18 12:18:42 -07:00
|
|
|
}
|
2010-07-14 14:12:58 -07:00
|
|
|
}
|
2009-10-30 05:05:31 -07:00
|
|
|
|
2010-07-14 14:12:58 -07:00
|
|
|
static void
|
From: Rajeev Ranjan (Rajeev) <rajeev.r@samsung.com> <rajeev.jnnce@gmail.com>
Subject: Re: [E-devel] [Patch] elm_slideshow patch
From: PRINCE KUMAR DUBEY <prince.dubey@samsung.com>
On behalf of Rajeev Ranjan, I am submitting the elm_slideshow patch
which add support for getting notification when transition completes.
Change Log:
new signal “transition,end” has been introduced to get notification
when transition completes.
Detail Description:
The actual requirement is to get user notified when the last item is
visible in the slideshow. In this case, user wants to take some
action, say updating button text to Restart if the slideshow does not
have loop.
The current implementation of slideshow has a signal called “changed”
which has current visible item as event_info parameter in the
callback. User can compare it with the last appended item and come to
know that the last item is visible if even_info is equal to the data
passed which should be the last appended item. The only problem is
that this signal is emitted by C code asynchronously to the
transition, hence if the transition involves an animation, user will
most likely get it even before the transition completes. This may look
bad to the user if the button label gets updated to Restart even
before the last transition gets over.
In order to fulfill the requirement, I have introduced another signal
“transition,end” which is emitted once the transition is over.
The same requirement could have been fulfilled by emitting “changed”
signal after the transition gets over but then this will be different
from the existing implementation for other widgets, hence I introduced
the new signal “transition,end”.
SVN revision: 65951
2011-12-06 01:03:01 -08:00
|
|
|
_end(void *data, Evas_Object *obj __UNUSED__, const char *emission, const char *source __UNUSED__)
|
2010-07-14 14:12:58 -07:00
|
|
|
{
|
2011-04-01 04:24:15 -07:00
|
|
|
Elm_Slideshow_Item *item;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(data);
|
|
|
|
if (!wd) return;
|
2010-07-14 14:12:58 -07:00
|
|
|
|
2011-04-01 04:24:15 -07:00
|
|
|
item = wd->previous;
|
2011-04-22 05:06:00 -07:00
|
|
|
if (item)
|
2011-04-01 04:24:15 -07:00
|
|
|
{
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_part_unswallow(wd->slideshow, VIEW(item));
|
|
|
|
evas_object_hide(VIEW(item));
|
2011-04-01 04:24:15 -07:00
|
|
|
wd->previous = NULL;
|
|
|
|
}
|
2010-07-14 14:12:58 -07:00
|
|
|
|
2011-04-01 04:24:15 -07:00
|
|
|
item = wd->current;
|
2011-10-20 18:08:01 -07:00
|
|
|
if ((!item) || (!VIEW(item))) return;
|
2010-07-14 14:12:58 -07:00
|
|
|
|
2011-04-01 04:24:15 -07:00
|
|
|
_item_realize(item);
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_part_unswallow(wd->slideshow, VIEW(item));
|
2010-07-15 10:09:59 -07:00
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_part_swallow(wd->slideshow, "elm.swallow.1", VIEW(item));
|
2011-10-13 22:21:55 -07:00
|
|
|
edje_object_signal_emit(wd->slideshow, "anim,end", "slideshow");
|
From: Rajeev Ranjan (Rajeev) <rajeev.r@samsung.com> <rajeev.jnnce@gmail.com>
Subject: Re: [E-devel] [Patch] elm_slideshow patch
From: PRINCE KUMAR DUBEY <prince.dubey@samsung.com>
On behalf of Rajeev Ranjan, I am submitting the elm_slideshow patch
which add support for getting notification when transition completes.
Change Log:
new signal “transition,end” has been introduced to get notification
when transition completes.
Detail Description:
The actual requirement is to get user notified when the last item is
visible in the slideshow. In this case, user wants to take some
action, say updating button text to Restart if the slideshow does not
have loop.
The current implementation of slideshow has a signal called “changed”
which has current visible item as event_info parameter in the
callback. User can compare it with the last appended item and come to
know that the last item is visible if even_info is equal to the data
passed which should be the last appended item. The only problem is
that this signal is emitted by C code asynchronously to the
transition, hence if the transition involves an animation, user will
most likely get it even before the transition completes. This may look
bad to the user if the button label gets updated to Restart even
before the last transition gets over.
In order to fulfill the requirement, I have introduced another signal
“transition,end” which is emitted once the transition is over.
The same requirement could have been fulfilled by emitting “changed”
signal after the transition gets over but then this will be different
from the existing implementation for other widgets, hence I introduced
the new signal “transition,end”.
SVN revision: 65951
2011-12-06 01:03:01 -08:00
|
|
|
if (emission != NULL)
|
|
|
|
evas_object_smart_callback_call(data, SIG_TRANSITION_END, wd->current);
|
2009-09-23 15:56:47 -07:00
|
|
|
}
|
|
|
|
|
2010-06-25 02:58:14 -07:00
|
|
|
static Eina_Bool
|
2009-09-24 02:43:05 -07:00
|
|
|
_timer_cb(void *data)
|
|
|
|
{
|
|
|
|
Evas_Object *obj = data;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-06-25 02:58:14 -07:00
|
|
|
if (!wd) return ECORE_CALLBACK_CANCEL;
|
2009-09-24 02:43:05 -07:00
|
|
|
wd->timer = NULL;
|
|
|
|
elm_slideshow_next(obj);
|
2010-06-25 02:58:14 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
2009-09-24 02:43:05 -07:00
|
|
|
}
|
|
|
|
|
2012-01-27 03:56:14 -08:00
|
|
|
static Eina_Bool
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
_item_del_pre_hook(Elm_Object_Item *it)
|
|
|
|
{
|
2012-03-06 03:51:42 -08:00
|
|
|
Elm_Slideshow_Item *item = (Elm_Slideshow_Item *)it;
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(WIDGET(item));
|
2012-01-27 03:56:14 -08:00
|
|
|
if (!wd) return EINA_FALSE;
|
|
|
|
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
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)
|
2012-03-01 03:50:56 -08:00
|
|
|
elm_slideshow_item_show(eina_list_data_get(l2));
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
|
|
|
|
}
|
|
|
|
else
|
2012-03-01 03:50:56 -08:00
|
|
|
elm_slideshow_item_show(eina_list_data_get(l2));
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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));
|
2012-01-27 03:56:14 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-27 20:07:20 -07:00
|
|
|
EAPI Evas_Object *
|
2009-09-23 15:56:47 -07:00
|
|
|
elm_slideshow_add(Evas_Object *parent)
|
|
|
|
{
|
|
|
|
Evas_Object *obj;
|
|
|
|
Evas *e;
|
|
|
|
Widget_Data *wd;
|
|
|
|
|
2011-03-31 23:08:02 -07:00
|
|
|
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
|
2011-04-01 04:24:15 -07:00
|
|
|
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_SET_WIDTYPE(widtype, "slideshow");
|
2009-09-23 15:56:47 -07:00
|
|
|
elm_widget_type_set(obj, "slideshow");
|
|
|
|
elm_widget_sub_object_add(parent, obj);
|
2010-09-22 10:45:46 -07:00
|
|
|
elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
|
2009-09-23 15:56:47 -07:00
|
|
|
elm_widget_data_set(obj, wd);
|
2011-10-30 17:13:32 -07:00
|
|
|
elm_widget_del_pre_hook_set(obj, _del_pre_hook);
|
2009-09-23 15:56:47 -07:00
|
|
|
elm_widget_del_hook_set(obj, _del_hook);
|
|
|
|
elm_widget_theme_hook_set(obj, _theme_hook);
|
2010-09-22 10:45:46 -07:00
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
2010-09-27 14:13:41 -07:00
|
|
|
elm_widget_event_hook_set(obj, _event_hook);
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2009-10-12 13:02:56 -07:00
|
|
|
wd->current = NULL;
|
2009-10-11 10:18:44 -07:00
|
|
|
wd->previous = NULL;
|
|
|
|
|
2009-09-23 15:56:47 -07:00
|
|
|
wd->slideshow = edje_object_add(e);
|
2010-05-11 18:03:46 -07:00
|
|
|
_elm_theme_object_set(obj, wd->slideshow, "slideshow", "base", "default");
|
2011-04-22 02:19:25 -07:00
|
|
|
wd->count_item_pre_before = 2;
|
|
|
|
wd->count_item_pre_after = 2;
|
2009-09-23 15:56:47 -07:00
|
|
|
elm_widget_resize_object_set(obj, wd->slideshow);
|
|
|
|
|
2010-09-13 00:56:23 -07:00
|
|
|
wd->transitions = elm_widget_stringlist_get(edje_object_data_get(wd->slideshow, "transitions"));
|
2010-03-09 08:27:46 -08:00
|
|
|
if (eina_list_count(wd->transitions) > 0)
|
2009-09-23 15:56:47 -07:00
|
|
|
wd->transition = eina_stringshare_add(eina_list_data_get(wd->transitions));
|
|
|
|
|
2010-09-13 00:56:23 -07:00
|
|
|
wd->layout.list = elm_widget_stringlist_get(edje_object_data_get(wd->slideshow, "layouts"));
|
2010-07-14 14:12:58 -07:00
|
|
|
if (eina_list_count(wd->layout.list) > 0)
|
2011-04-01 04:24:15 -07:00
|
|
|
wd->layout.current = eina_list_data_get(wd->layout.list);
|
2010-07-14 02:07:43 -07:00
|
|
|
|
2009-09-23 15:56:47 -07:00
|
|
|
edje_object_signal_callback_add(wd->slideshow, "end", "slideshow", _end, obj);
|
|
|
|
|
|
|
|
evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
|
2009-11-25 13:06:23 -08:00
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2011-04-21 17:42:32 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _signals);
|
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
2009-09-23 15:56:47 -07:00
|
|
|
_sizing_eval(obj);
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2011-12-08 03:01:01 -08:00
|
|
|
EAPI Elm_Object_Item*
|
2009-10-12 13:02:56 -07:00
|
|
|
elm_slideshow_item_add(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, const void *data)
|
2009-09-23 15:56:47 -07:00
|
|
|
{
|
2009-10-12 13:02:56 -07:00
|
|
|
Elm_Slideshow_Item *item;
|
2010-03-09 08:27:46 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2009-09-23 15:56:47 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-09-27 20:07:20 -07:00
|
|
|
|
2010-03-09 08:27:46 -08:00
|
|
|
if (!wd) return NULL;
|
2010-09-09 19:05:45 -07:00
|
|
|
item = elm_widget_item_new(obj, Elm_Slideshow_Item);
|
2011-12-08 23:08:49 -08:00
|
|
|
if (!item) return NULL;
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook);
|
2009-10-12 13:02:56 -07:00
|
|
|
item->itc = itc;
|
|
|
|
item->l = eina_list_append(item->l, item);
|
2011-12-08 23:08:49 -08:00
|
|
|
elm_widget_item_data_set(item, data);
|
2009-10-12 13:02:56 -07:00
|
|
|
|
|
|
|
wd->items = eina_list_merge(wd->items, item->l);
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2012-03-06 03:51:42 -08:00
|
|
|
if (!wd->current) elm_slideshow_item_show((Elm_Object_Item *)item);
|
2009-10-12 13:02:56 -07:00
|
|
|
|
2012-03-06 03:51:42 -08:00
|
|
|
return (Elm_Object_Item *)item;
|
2009-09-23 15:56:47 -07:00
|
|
|
}
|
|
|
|
|
2011-12-08 03:01:01 -08:00
|
|
|
EAPI Elm_Object_Item*
|
2011-05-06 03:22:32 -07:00
|
|
|
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;
|
2011-12-08 23:08:49 -08:00
|
|
|
|
2011-05-06 03:22:32 -07:00
|
|
|
item = elm_widget_item_new(obj, Elm_Slideshow_Item);
|
2011-12-08 23:08:49 -08:00
|
|
|
if (!item) return NULL;
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook);
|
2011-05-06 03:22:32 -07:00
|
|
|
item->itc = itc;
|
|
|
|
item->l = eina_list_append(item->l, item);
|
2011-12-08 23:08:49 -08:00
|
|
|
elm_widget_item_data_set(item, data);
|
2011-05-06 03:22:32 -07:00
|
|
|
|
|
|
|
wd->items = eina_list_sorted_merge(wd->items, item->l, func);
|
|
|
|
|
2012-03-06 03:51:42 -08:00
|
|
|
if (!wd->current) elm_slideshow_item_show((Elm_Object_Item *)item);
|
2011-05-06 03:22:32 -07:00
|
|
|
|
2012-03-06 03:51:42 -08:00
|
|
|
return (Elm_Object_Item *)item;
|
2011-05-06 03:22:32 -07:00
|
|
|
}
|
|
|
|
|
2009-09-27 20:07:20 -07:00
|
|
|
EAPI void
|
2012-03-01 03:50:56 -08:00
|
|
|
elm_slideshow_item_show(Elm_Object_Item *it)
|
2009-09-23 15:56:47 -07:00
|
|
|
{
|
2011-12-08 03:01:01 -08:00
|
|
|
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
2010-07-22 09:13:40 -07:00
|
|
|
char buf[1024];
|
2011-12-08 03:01:01 -08:00
|
|
|
Elm_Slideshow_Item *item, *next = NULL;
|
2010-07-22 09:13:40 -07:00
|
|
|
Widget_Data *wd;
|
2012-03-06 03:51:42 -08:00
|
|
|
item = (Elm_Slideshow_Item *)it;
|
2011-10-20 18:08:01 -07:00
|
|
|
wd = elm_widget_data_get(WIDGET(item));
|
2011-12-08 03:01:01 -08:00
|
|
|
if (!wd) return;
|
|
|
|
if (item == wd->current) return;
|
2010-07-22 09:13:40 -07:00
|
|
|
|
|
|
|
next = item;
|
2011-10-20 18:08:01 -07:00
|
|
|
_end(WIDGET(item), WIDGET(item), NULL, NULL);
|
2009-09-27 20:07:20 -07:00
|
|
|
|
2010-07-22 09:13:40 -07:00
|
|
|
if (wd->timer) ecore_timer_del(wd->timer);
|
2012-03-30 05:31:11 -07:00
|
|
|
wd->timer = NULL;
|
2011-01-20 11:44:12 -08:00
|
|
|
if (wd->timeout > 0.0)
|
2011-10-20 18:08:01 -07:00
|
|
|
wd->timer = ecore_timer_add(wd->timeout, _timer_cb, WIDGET(item));
|
2010-07-22 09:13:40 -07:00
|
|
|
_item_realize(next);
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_part_swallow(wd->slideshow, "elm.swallow.2", VIEW(next));
|
2010-07-22 09:13:40 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s,next", wd->transition);
|
|
|
|
edje_object_signal_emit(wd->slideshow, buf, "slideshow");
|
2009-10-12 13:02:56 -07:00
|
|
|
wd->previous = wd->current;
|
2010-07-22 09:13:40 -07:00
|
|
|
wd->current = next;
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_smart_callback_call(WIDGET(item), SIG_CHANGED, wd->current);
|
2009-09-23 15:56:47 -07:00
|
|
|
}
|
|
|
|
|
2009-09-27 20:07:20 -07:00
|
|
|
EAPI void
|
2009-09-23 15:56:47 -07:00
|
|
|
elm_slideshow_next(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
char buf[1024];
|
2010-07-15 10:09:59 -07:00
|
|
|
Elm_Slideshow_Item *next = NULL;
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-09-23 15:56:47 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
|
2009-09-27 20:07:20 -07:00
|
|
|
if (!wd) return;
|
2011-04-01 04:24:15 -07:00
|
|
|
|
2010-03-01 17:27:08 -08:00
|
|
|
if (wd->current)
|
2011-04-01 04:24:15 -07:00
|
|
|
next = _item_next_get(wd->current);
|
2009-09-24 02:43:05 -07:00
|
|
|
|
2010-10-22 14:41:22 -07:00
|
|
|
if ((!next) || (next == wd->current)) return;
|
2010-07-14 14:12:58 -07:00
|
|
|
|
2009-09-23 15:56:47 -07:00
|
|
|
_end(obj, obj, NULL, NULL);
|
2010-07-15 10:09:59 -07:00
|
|
|
|
2009-10-14 14:57:46 -07:00
|
|
|
if (wd->timer) ecore_timer_del(wd->timer);
|
2012-03-30 05:31:11 -07:00
|
|
|
wd->timer = NULL;
|
2011-01-20 11:44:12 -08:00
|
|
|
if (wd->timeout > 0.0)
|
2011-04-01 04:24:15 -07:00
|
|
|
wd->timer = ecore_timer_add(wd->timeout, _timer_cb, obj);
|
2010-07-14 14:12:58 -07:00
|
|
|
|
2010-07-15 10:09:59 -07:00
|
|
|
_item_realize(next);
|
2010-07-14 14:12:58 -07:00
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_part_swallow(wd->slideshow, "elm.swallow.2", VIEW(next));
|
2010-07-14 14:12:58 -07:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "%s,next", wd->transition);
|
2009-09-23 15:56:47 -07:00
|
|
|
edje_object_signal_emit(wd->slideshow, buf, "slideshow");
|
|
|
|
|
2009-10-12 13:02:56 -07:00
|
|
|
wd->previous = wd->current;
|
2009-09-24 02:43:05 -07:00
|
|
|
wd->current = next;
|
2011-04-21 17:42:32 -07:00
|
|
|
evas_object_smart_callback_call(obj, SIG_CHANGED, wd->current);
|
2009-09-23 15:56:47 -07:00
|
|
|
}
|
|
|
|
|
2010-03-09 08:27:46 -08:00
|
|
|
EAPI void
|
2009-09-23 15:56:47 -07:00
|
|
|
elm_slideshow_previous(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
char buf[1024];
|
2010-07-15 10:09:59 -07:00
|
|
|
Elm_Slideshow_Item *prev = NULL;
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-09-23 15:56:47 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
|
2009-09-27 20:07:20 -07:00
|
|
|
if (!wd) return;
|
2009-10-29 10:26:52 -07:00
|
|
|
|
2010-03-09 08:27:46 -08:00
|
|
|
if (wd->current)
|
2010-07-14 14:12:58 -07:00
|
|
|
prev = _item_prev_get(wd->current);
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2010-10-22 14:41:22 -07:00
|
|
|
if ((!prev) || (prev == wd->current)) return;
|
2009-09-23 15:56:47 -07:00
|
|
|
|
|
|
|
_end(obj, obj, NULL, NULL);
|
|
|
|
|
2009-10-14 14:57:46 -07:00
|
|
|
if (wd->timer) ecore_timer_del(wd->timer);
|
2012-03-30 05:31:11 -07:00
|
|
|
wd->timer = NULL;
|
2011-01-20 11:44:12 -08:00
|
|
|
if (wd->timeout > 0.0)
|
2011-04-01 04:24:15 -07:00
|
|
|
wd->timer = ecore_timer_add(wd->timeout, _timer_cb, obj);
|
2010-07-14 14:12:58 -07:00
|
|
|
|
2010-07-15 10:09:59 -07:00
|
|
|
_item_realize(prev);
|
2010-07-14 14:12:58 -07:00
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_part_swallow(wd->slideshow, "elm.swallow.2", VIEW(prev));
|
2009-09-27 20:07:20 -07:00
|
|
|
|
2009-09-23 15:56:47 -07:00
|
|
|
snprintf(buf, 1024, "%s,previous", wd->transition);
|
|
|
|
edje_object_signal_emit(wd->slideshow, buf, "slideshow");
|
|
|
|
|
2009-10-12 13:02:56 -07:00
|
|
|
wd->previous = wd->current;
|
|
|
|
wd->current = prev;
|
2011-04-21 17:42:32 -07:00
|
|
|
evas_object_smart_callback_call(obj, SIG_CHANGED, wd->current);
|
2009-09-23 15:56:47 -07:00
|
|
|
}
|
|
|
|
|
2010-10-22 09:40:50 -07:00
|
|
|
EAPI const Eina_List *
|
2010-03-23 20:06:00 -07:00
|
|
|
elm_slideshow_transitions_get(const Evas_Object *obj)
|
2009-09-23 15:56:47 -07:00
|
|
|
{
|
2010-03-09 08:27:46 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2009-09-23 15:56:47 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 08:27:46 -08:00
|
|
|
if (!wd) return NULL;
|
2009-09-23 15:56:47 -07:00
|
|
|
return wd->transitions;
|
|
|
|
}
|
|
|
|
|
2010-10-22 09:40:50 -07:00
|
|
|
EAPI const Eina_List *
|
2010-07-14 02:07:43 -07:00
|
|
|
elm_slideshow_layouts_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->layout.list;
|
|
|
|
}
|
|
|
|
|
2009-09-27 20:07:20 -07:00
|
|
|
EAPI void
|
2009-09-23 15:56:47 -07:00
|
|
|
elm_slideshow_transition_set(Evas_Object *obj, const char *transition)
|
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-09-23 15:56:47 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 08:27:46 -08:00
|
|
|
if (!wd) return;
|
2010-03-13 13:01:26 -08:00
|
|
|
eina_stringshare_replace(&wd->transition, transition);
|
2009-09-23 15:56:47 -07:00
|
|
|
}
|
|
|
|
|
2010-04-05 13:23:30 -07:00
|
|
|
EAPI const char *
|
|
|
|
elm_slideshow_transition_get(const Evas_Object *obj)
|
|
|
|
{
|
2010-04-08 13:16:21 -07:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2010-04-05 13:23:30 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
|
|
|
return wd->transition;
|
|
|
|
}
|
|
|
|
|
2009-09-27 20:07:20 -07:00
|
|
|
EAPI void
|
2011-01-09 21:27:15 -08:00
|
|
|
elm_slideshow_timeout_set(Evas_Object *obj, double timeout)
|
2009-09-24 02:43:05 -07:00
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-09-24 02:43:05 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 08:27:46 -08:00
|
|
|
if (!wd) return;
|
2009-09-24 02:43:05 -07:00
|
|
|
wd->timeout = timeout;
|
2009-09-27 20:07:20 -07:00
|
|
|
if (wd->timer) ecore_timer_del(wd->timer);
|
2009-09-24 02:43:05 -07:00
|
|
|
wd->timer = NULL;
|
2011-01-09 21:27:15 -08:00
|
|
|
if (timeout > 0.0)
|
2009-09-24 02:43:05 -07:00
|
|
|
wd->timer = ecore_timer_add(timeout, _timer_cb, obj);
|
|
|
|
}
|
|
|
|
|
2011-01-09 21:27:15 -08:00
|
|
|
EAPI double
|
2010-03-23 20:06:00 -07:00
|
|
|
elm_slideshow_timeout_get(const Evas_Object *obj)
|
2009-09-24 02:43:05 -07:00
|
|
|
{
|
2011-01-09 21:27:15 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) -1.0;
|
2009-09-24 02:43:05 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2011-01-09 21:27:15 -08:00
|
|
|
if (!wd) return -1.0;
|
2009-09-24 02:43:05 -07:00
|
|
|
return wd->timeout;
|
|
|
|
}
|
|
|
|
|
2009-09-27 20:07:20 -07:00
|
|
|
EAPI void
|
2010-04-05 13:23:30 -07:00
|
|
|
elm_slideshow_loop_set(Evas_Object *obj, Eina_Bool loop)
|
2009-09-24 02:43:05 -07:00
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-09-24 02:43:05 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 08:27:46 -08:00
|
|
|
if (!wd) return;
|
2009-09-24 02:43:05 -07:00
|
|
|
wd->loop = loop;
|
|
|
|
}
|
|
|
|
|
2010-07-15 10:09:59 -07:00
|
|
|
EAPI const char *
|
2010-07-14 02:07:43 -07:00
|
|
|
elm_slideshow_layout_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return EINA_FALSE;
|
|
|
|
return wd->layout.current;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2010-07-15 10:09:59 -07:00
|
|
|
elm_slideshow_layout_set(Evas_Object *obj, const char *layout)
|
2010-07-14 02:07:43 -07:00
|
|
|
{
|
|
|
|
char buf[PATH_MAX];
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
|
2010-07-15 10:09:59 -07:00
|
|
|
wd->layout.current = layout;
|
|
|
|
snprintf(buf, sizeof(buf), "layout,%s", layout);
|
|
|
|
edje_object_signal_emit(wd->slideshow, buf, "slideshow");
|
2010-07-14 02:07:43 -07:00
|
|
|
}
|
|
|
|
|
2010-04-05 13:23:30 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_slideshow_loop_get(const Evas_Object *obj)
|
|
|
|
{
|
2010-04-08 13:16:21 -07:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
2010-04-05 13:23:30 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return EINA_FALSE;
|
|
|
|
return wd->loop;
|
|
|
|
}
|
|
|
|
|
2009-09-27 20:07:20 -07:00
|
|
|
EAPI void
|
2009-09-24 02:43:05 -07:00
|
|
|
elm_slideshow_clear(Evas_Object *obj)
|
|
|
|
{
|
2011-04-01 04:24:15 -07:00
|
|
|
Elm_Slideshow_Item *item;
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
wd->previous = NULL;
|
|
|
|
wd->current = NULL;
|
|
|
|
EINA_LIST_FREE(wd->items_built, item)
|
|
|
|
{
|
|
|
|
if (item->itc->func.del)
|
2011-12-08 23:08:49 -08:00
|
|
|
item->itc->func.del(elm_widget_item_data_get(item), VIEW(item));
|
2011-04-01 04:24:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EINA_LIST_FREE(wd->items, item)
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
elm_widget_item_free(item);
|
2009-10-12 13:02:56 -07:00
|
|
|
}
|
|
|
|
|
2010-03-09 08:27:46 -08:00
|
|
|
EAPI const Eina_List *
|
2009-10-29 10:26:52 -07:00
|
|
|
elm_slideshow_items_get(const Evas_Object *obj)
|
|
|
|
{
|
2010-03-09 08:27:46 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2009-10-29 10:26:52 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
|
|
|
return wd->items;
|
|
|
|
}
|
|
|
|
|
2011-12-08 03:01:01 -08:00
|
|
|
EAPI Elm_Object_Item *
|
2010-03-23 20:06:00 -07:00
|
|
|
elm_slideshow_item_current_get(const Evas_Object *obj)
|
2009-10-12 15:00:14 -07:00
|
|
|
{
|
2010-03-09 08:27:46 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2009-10-12 15:00:14 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
2011-12-08 03:01:01 -08:00
|
|
|
return (Elm_Object_Item *) wd->current;
|
2009-10-12 15:00:14 -07:00
|
|
|
}
|
|
|
|
|
2010-03-09 08:27:46 -08:00
|
|
|
EAPI Evas_Object *
|
2011-12-08 03:01:01 -08:00
|
|
|
elm_slideshow_item_object_get(const Elm_Object_Item * it)
|
2009-10-12 15:00:14 -07:00
|
|
|
{
|
2011-12-08 03:01:01 -08:00
|
|
|
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
return VIEW(it);
|
2009-10-12 15:00:14 -07:00
|
|
|
}
|
|
|
|
|
2011-04-22 02:19:25 -07:00
|
|
|
EAPI int
|
|
|
|
elm_slideshow_cache_before_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) -1;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return -1;
|
|
|
|
return wd->count_item_pre_before;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_slideshow_cache_before_set(Evas_Object *obj, int count)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
if (count < 0) count = 0;
|
|
|
|
wd->count_item_pre_before = count;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
elm_slideshow_cache_after_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) -1;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return -1;
|
|
|
|
return wd->count_item_pre_after;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_slideshow_cache_after_set(Evas_Object *obj, int count)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
if (count < 0) count = 0;
|
|
|
|
wd->count_item_pre_after = count;
|
|
|
|
}
|
2011-05-10 02:06:51 -07:00
|
|
|
|
2011-12-08 03:01:01 -08:00
|
|
|
EAPI Elm_Object_Item *
|
2011-05-10 02:06:51 -07:00
|
|
|
elm_slideshow_item_nth_get(const Evas_Object *obj, unsigned int nth)
|
|
|
|
{
|
2011-05-10 05:59:57 -07:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2011-05-10 02:06:51 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
|
|
|
return eina_list_nth(wd->items, nth);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI unsigned int
|
|
|
|
elm_slideshow_count_get(const Evas_Object *obj)
|
|
|
|
{
|
2011-05-10 05:59:57 -07:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) 0;
|
2011-05-10 02:06:51 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return 0;
|
|
|
|
return eina_list_count(wd->items);
|
|
|
|
}
|