2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-10-17 08:56:11 -07:00
|
|
|
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
|
|
|
|
#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
|
|
|
|
|
2014-09-27 22:14:20 -07:00
|
|
|
#define ELM_WIDGET_ITEM_PROTECTED
|
2009-09-23 15:56:47 -07:00
|
|
|
#include <Elementary.h>
|
2013-04-25 22:13:00 -07:00
|
|
|
|
2009-09-23 15:56:47 -07:00
|
|
|
#include "elm_priv.h"
|
2016-10-26 16:53:12 -07:00
|
|
|
#include "elm_slideshow.eo.h"
|
|
|
|
#include "elm_slideshow_item.eo.h"
|
2012-07-31 15:06:00 -07:00
|
|
|
#include "elm_widget_slideshow.h"
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_SLIDESHOW_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Slideshow"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_slideshow"
|
2009-09-23 15:56:47 -07:00
|
|
|
|
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
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
2011-04-21 17:42:32 -07:00
|
|
|
{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, ""},
|
2014-01-23 03:07:20 -08:00
|
|
|
{SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-07 21:05:06 -08:00
|
|
|
{SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-05 23:18:57 -08:00
|
|
|
{SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */
|
|
|
|
{SIG_LAYOUT_UNFOCUSED, ""}, /**< handled by elm_layout */
|
2011-04-21 17:42:32 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2014-04-15 00:07:41 -07:00
|
|
|
static Eina_Bool _key_action_move(Evas_Object *obj, const char *params);
|
|
|
|
static Eina_Bool _key_action_pause(Evas_Object *obj, const char *params);
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2014-04-15 00:07:41 -07:00
|
|
|
static const Elm_Action key_actions[] = {
|
|
|
|
{"move", _key_action_move},
|
|
|
|
{"pause", _key_action_pause},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_key_action_move(Evas_Object *obj, const char *params)
|
|
|
|
{
|
|
|
|
const char *dir = params;
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2015-09-10 02:29:24 -07:00
|
|
|
_elm_widget_focus_auto_show(obj);
|
2014-04-15 00:07:41 -07:00
|
|
|
if (!strcmp(dir, "left"))
|
2010-09-27 14:13:41 -07:00
|
|
|
{
|
|
|
|
elm_slideshow_previous(obj);
|
|
|
|
}
|
2014-04-15 00:07:41 -07:00
|
|
|
else if (!strcmp(dir, "right"))
|
2010-09-27 14:13:41 -07:00
|
|
|
{
|
|
|
|
elm_slideshow_next(obj);
|
|
|
|
}
|
2014-04-15 00:07:41 -07:00
|
|
|
else return EINA_FALSE;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_key_action_pause(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ELM_SLIDESHOW_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (sd->timeout)
|
2010-09-27 14:13:41 -07:00
|
|
|
{
|
2014-04-15 00:07:41 -07:00
|
|
|
if (sd->timer)
|
|
|
|
ELM_SAFE_FREE(sd->timer, ecore_timer_del);
|
|
|
|
else
|
|
|
|
elm_slideshow_timeout_set(obj, sd->timeout);
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
2012-05-02 09:59:25 -07:00
|
|
|
|
2014-04-15 00:07:41 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2017-01-01 23:48:17 -08:00
|
|
|
_elm_slideshow_elm_widget_widget_event(Eo *obj, Elm_Slideshow_Data *sd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info)
|
2014-04-15 00:07:41 -07:00
|
|
|
{
|
|
|
|
Evas_Event_Key_Down *ev = event_info;
|
|
|
|
(void) src;
|
|
|
|
|
|
|
|
if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
|
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
|
|
|
|
|
2015-12-21 04:55:23 -08:00
|
|
|
if (!_elm_config_key_binding_call(obj, MY_CLASS_NAME, ev, key_actions))
|
2014-04-15 00:07:41 -07:00
|
|
|
return EINA_FALSE;
|
2013-11-12 17:29:30 -08:00
|
|
|
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2014-03-26 02:53:31 -07:00
|
|
|
return EINA_TRUE;
|
2010-07-14 14:12:58 -07:00
|
|
|
}
|
2011-02-08 14:23:00 -08:00
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_slideshow_elm_layout_sizing_eval(Eo *obj, Elm_Slideshow_Data *_pd EINA_UNUSED)
|
2010-07-14 14:12:58 -07:00
|
|
|
{
|
2013-10-05 01:15:49 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-02 18:19:05 -07:00
|
|
|
Evas_Coord minw = -1, minh = -1;
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_size_min_calc(wd->resize_obj, &minw, &minh);
|
2012-05-02 18:19:05 -07:00
|
|
|
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
|
|
|
|
2014-09-27 22:14:20 -07:00
|
|
|
static Elm_Slideshow_Item_Data *
|
|
|
|
_item_prev_get(Elm_Slideshow_Item_Data *item)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2012-05-03 15:42:43 -07:00
|
|
|
ELM_SLIDESHOW_DATA_GET(WIDGET(item), sd);
|
2014-09-27 22:14:20 -07:00
|
|
|
Elm_Object_Item *eo_prev = eina_list_data_get(eina_list_prev(item->l));
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2014-09-27 22:14:20 -07:00
|
|
|
if ((!eo_prev) && (sd->loop))
|
|
|
|
eo_prev = eina_list_data_get(eina_list_last(item->l));
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2014-09-27 22:14:20 -07:00
|
|
|
ELM_SLIDESHOW_ITEM_DATA_GET(eo_prev, prev);
|
2012-05-02 18:19:05 -07:00
|
|
|
return prev;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:20 -07:00
|
|
|
static Elm_Slideshow_Item_Data *
|
|
|
|
_item_next_get(Elm_Slideshow_Item_Data *item)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2012-05-03 15:42:43 -07:00
|
|
|
ELM_SLIDESHOW_DATA_GET(WIDGET(item), sd);
|
2014-09-27 22:14:20 -07:00
|
|
|
Elm_Object_Item *eo_next = eina_list_data_get(eina_list_next(item->l));
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2014-09-27 22:14:20 -07:00
|
|
|
if ((!eo_next) && (sd->loop))
|
|
|
|
eo_next = eina_list_data_get(sd->items);
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2014-09-27 22:14:20 -07:00
|
|
|
ELM_SLIDESHOW_ITEM_DATA_GET(eo_next, next);
|
2012-05-03 15:42:43 -07:00
|
|
|
return next;
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-05-03 15:42:43 -07:00
|
|
|
_on_size_hints_changed(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2012-05-03 15:42:43 -07:00
|
|
|
elm_layout_sizing_eval(data);
|
2009-09-23 15:56:47 -07:00
|
|
|
}
|
|
|
|
|
2009-09-27 20:07:20 -07:00
|
|
|
static void
|
2014-09-27 22:14:20 -07:00
|
|
|
_item_realize(Elm_Slideshow_Item_Data *item)
|
2009-09-23 15:56:47 -07:00
|
|
|
{
|
2014-09-27 22:14:20 -07:00
|
|
|
Elm_Slideshow_Item_Data *_item_prev, *_item_next;
|
2011-10-20 18:08:01 -07:00
|
|
|
Evas_Object *obj = WIDGET(item);
|
2011-08-26 06:54:12 -07:00
|
|
|
int ac, bc, lc, ic = 0;
|
2010-07-14 14:12:58 -07:00
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
ELM_SLIDESHOW_DATA_GET_OR_RETURN(obj, sd);
|
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
if ((!VIEW(item)) && (item->itc->func.get))
|
2010-08-18 12:18:42 -07:00
|
|
|
{
|
2014-09-27 22:14:20 -07:00
|
|
|
VIEW(item) = item->itc->func.get(elm_object_item_data_get(EO_OBJ(item)), obj);
|
2010-08-18 12:18:42 -07:00
|
|
|
item->l_built = eina_list_append(NULL, item);
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->items_built = eina_list_merge(sd->items_built, item->l_built);
|
|
|
|
//FIXME: item could be shown 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)
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->items_built = eina_list_demote_list(sd->items_built, item->l_built);
|
2010-08-18 12:18:42 -07:00
|
|
|
|
|
|
|
//pre-create previous and next item
|
2012-05-03 15:42:43 -07:00
|
|
|
ac = sd->count_item_pre_after;
|
2011-04-22 02:19:25 -07:00
|
|
|
_item_next = item;
|
2012-05-03 15:42:43 -07:00
|
|
|
bc = sd->count_item_pre_before;
|
2011-04-22 02:19:25 -07:00
|
|
|
_item_prev = item;
|
2012-05-03 15:42:43 -07:00
|
|
|
lc = eina_list_count(sd->items) - 1;
|
|
|
|
|
2011-04-22 02:19:25 -07:00
|
|
|
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) =
|
2012-05-03 15:42:43 -07:00
|
|
|
_item_next->itc->func.get(
|
2014-09-27 22:14:20 -07:00
|
|
|
elm_object_item_data_get(EO_OBJ(_item_next)), obj);
|
2012-05-03 15:42:43 -07:00
|
|
|
_item_next->l_built =
|
|
|
|
eina_list_append(NULL, _item_next);
|
|
|
|
sd->items_built = eina_list_merge
|
|
|
|
(sd->items_built, _item_next->l_built);
|
|
|
|
//FIXME: _item_next could be shown 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++;
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->items_built =
|
|
|
|
eina_list_demote_list
|
|
|
|
(sd->items_built, _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) =
|
2012-05-03 15:42:43 -07:00
|
|
|
_item_prev->itc->func.get(
|
2014-09-27 22:14:20 -07:00
|
|
|
elm_object_item_data_get(EO_OBJ(_item_prev)), obj);
|
2012-05-03 15:42:43 -07:00
|
|
|
_item_prev->l_built =
|
|
|
|
eina_list_append(NULL, _item_prev);
|
|
|
|
sd->items_built = eina_list_merge
|
|
|
|
(sd->items_built, _item_prev->l_built);
|
|
|
|
//FIXME: _item_prev could be shown 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++;
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->items_built =
|
|
|
|
eina_list_demote_list
|
|
|
|
(sd->items_built, _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;
|
2012-05-03 15:42:43 -07:00
|
|
|
|
|
|
|
while ((int)eina_list_count(sd->items_built) > lc)
|
2010-08-18 12:18:42 -07:00
|
|
|
{
|
2012-05-03 15:42:43 -07:00
|
|
|
item = eina_list_data_get(sd->items_built);
|
|
|
|
sd->items_built = eina_list_remove_list
|
|
|
|
(sd->items_built, sd->items_built);
|
2011-04-22 05:06:00 -07:00
|
|
|
if (item->itc->func.del)
|
2014-09-27 22:14:20 -07:00
|
|
|
item->itc->func.del(elm_object_item_data_get(EO_OBJ(item)), VIEW(item));
|
2014-01-21 17:38:55 -08:00
|
|
|
ELM_SAFE_FREE(VIEW(item), evas_object_del);
|
2015-05-17 04:59:06 -07:00
|
|
|
item->l_built = 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
|
2012-05-03 15:42:43 -07:00
|
|
|
_on_slideshow_end(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-05-03 15:42:43 -07:00
|
|
|
const char *emission,
|
2014-01-06 06:30:02 -08:00
|
|
|
const char *source EINA_UNUSED)
|
2010-07-14 14:12:58 -07:00
|
|
|
{
|
2014-09-27 22:14:20 -07:00
|
|
|
Elm_Slideshow_Item_Data *item;
|
2012-05-03 15:42:43 -07:00
|
|
|
ELM_SLIDESHOW_DATA_GET(data, sd);
|
2010-07-14 14:12:58 -07:00
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
item = sd->previous;
|
2011-04-22 05:06:00 -07:00
|
|
|
if (item)
|
2011-04-01 04:24:15 -07:00
|
|
|
{
|
2012-05-03 15:42:43 -07:00
|
|
|
elm_layout_content_unset(data, "elm.swallow.1");
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_hide(VIEW(item));
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->previous = NULL;
|
2011-04-01 04:24:15 -07:00
|
|
|
}
|
2010-07-14 14:12:58 -07:00
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
item = sd->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);
|
2012-05-03 15:42:43 -07:00
|
|
|
elm_layout_content_unset(data, "elm.swallow.2");
|
|
|
|
|
|
|
|
elm_layout_content_set(data, "elm.swallow.1", VIEW(item));
|
2013-10-05 05:35:27 -07:00
|
|
|
elm_layout_signal_emit(data, "elm,anim,end", "elm");
|
2013-07-31 02:57:12 -07:00
|
|
|
// XXX: fort backwards compat
|
2012-05-03 15:42:43 -07:00
|
|
|
elm_layout_signal_emit(data, "anim,end", "slideshow");
|
2010-07-15 10:09:59 -07:00
|
|
|
|
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)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(data, ELM_SLIDESHOW_EVENT_TRANSITION_END, EO_OBJ(sd->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;
|
2012-05-03 15:42:43 -07:00
|
|
|
ELM_SLIDESHOW_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
sd->timer = NULL;
|
2009-09-24 02:43:05 -07:00
|
|
|
elm_slideshow_next(obj);
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2010-06-25 02:58:14 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
2009-09-24 02:43:05 -07:00
|
|
|
}
|
|
|
|
|
2014-09-17 06:44:05 -07:00
|
|
|
EOLIAN static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_slideshow_item_efl_object_destructor(Eo *eo_item, Elm_Slideshow_Item_Data *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
|
|
|
{
|
2014-09-17 06:44:05 -07:00
|
|
|
ELM_SLIDESHOW_DATA_GET_OR_RETURN(WIDGET(item), sd);
|
2012-01-27 03:56:14 -08:00
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
if (sd->previous == item) sd->previous = NULL;
|
|
|
|
if (sd->current == 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
|
|
|
{
|
2014-09-27 22:14:20 -07:00
|
|
|
Eina_List *l = eina_list_data_find_list(sd->items, eo_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
|
|
|
Eina_List *l2 = eina_list_next(l);
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->current = 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
|
|
|
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
|
|
|
}
|
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->items = eina_list_remove_list(sd->items, item->l);
|
|
|
|
sd->items_built = eina_list_remove_list(sd->items_built, item->l_built);
|
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 ((VIEW(item)) && (item->itc->func.del))
|
2014-08-19 00:52:24 -07:00
|
|
|
item->itc->func.del(elm_object_item_data_get(eo_item), VIEW(item));
|
2012-01-27 03:56:14 -08:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_destructor(efl_super(eo_item, ELM_SLIDESHOW_ITEM_CLASS));
|
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
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_slideshow_efl_canvas_group_group_add(Eo *obj, Elm_Slideshow_Data *priv)
|
2012-05-02 09:59:25 -07:00
|
|
|
{
|
2013-10-05 01:15:49 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
priv->count_item_pre_before = 2;
|
|
|
|
priv->count_item_pre_after = 2;
|
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set
|
|
|
|
(obj, "slideshow", "base", elm_widget_style_get(obj)))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2012-05-03 15:42:43 -07:00
|
|
|
|
|
|
|
priv->transitions = elm_widget_stringlist_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(edje_object_data_get(wd->resize_obj,
|
2012-05-03 15:42:43 -07:00
|
|
|
"transitions"));
|
|
|
|
if (eina_list_count(priv->transitions) > 0)
|
|
|
|
priv->transition =
|
|
|
|
eina_stringshare_add(eina_list_data_get(priv->transitions));
|
|
|
|
|
|
|
|
priv->layout.list = elm_widget_stringlist_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(edje_object_data_get(wd->resize_obj, "layouts"));
|
2012-05-03 15:42:43 -07:00
|
|
|
|
|
|
|
if (eina_list_count(priv->layout.list) > 0)
|
|
|
|
priv->layout.current = eina_list_data_get(priv->layout.list);
|
|
|
|
|
2013-07-31 02:57:12 -07:00
|
|
|
edje_object_signal_callback_add
|
2013-10-05 05:35:27 -07:00
|
|
|
(wd->resize_obj, "elm,end", "elm", _on_slideshow_end,
|
2013-07-31 02:57:12 -07:00
|
|
|
obj);
|
|
|
|
// XXX: for backwards compat :(
|
2012-05-03 15:42:43 -07:00
|
|
|
edje_object_signal_callback_add
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "end", "slideshow", _on_slideshow_end,
|
2012-05-03 15:42:43 -07:00
|
|
|
obj);
|
|
|
|
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_size_hints_changed, obj);
|
|
|
|
|
2012-05-02 18:19:05 -07:00
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
2012-07-17 11:45:16 -07:00
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
2012-05-03 15:42:43 -07:00
|
|
|
}
|
2012-05-02 18:19:05 -07:00
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_slideshow_efl_canvas_group_group_del(Eo *obj, Elm_Slideshow_Data *sd)
|
2012-05-03 15:42:43 -07:00
|
|
|
{
|
|
|
|
const char *layout;
|
2012-05-02 09:59:25 -07:00
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
elm_slideshow_clear(obj);
|
2014-01-21 18:13:30 -08:00
|
|
|
elm_widget_stringlist_free(sd->transitions);
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_timer_del(sd->timer);
|
2012-05-02 09:59:25 -07:00
|
|
|
|
2013-03-08 20:23:42 -08:00
|
|
|
EINA_LIST_FREE(sd->layout.list, layout)
|
2012-05-03 15:42:43 -07:00
|
|
|
eina_stringshare_del(layout);
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
2012-05-03 15:42:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_slideshow_add(Evas_Object *parent)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2017-07-06 00:47:41 -07:00
|
|
|
return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added));
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-02 09:59:25 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_slideshow_efl_object_constructor(Eo *obj, Elm_Slideshow_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
2016-06-16 22:12:02 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_DOCUMENT_PRESENTATION);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2009-09-23 15:56:47 -07:00
|
|
|
}
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_slideshow_item_efl_object_constructor(Eo *obj, Elm_Slideshow_Item_Data *it)
|
2014-09-27 22:14:20 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, ELM_SLIDESHOW_ITEM_CLASS));
|
|
|
|
it->base = efl_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2014-09-27 22:14:20 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_slideshow_item_add(Eo *obj, Elm_Slideshow_Data *sd, const Elm_Slideshow_Item_Class *itc, const void *data)
|
2009-09-23 15:56:47 -07:00
|
|
|
{
|
2014-09-27 22:14:20 -07:00
|
|
|
Eo *eo_item;
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
eo_item = efl_add(ELM_SLIDESHOW_ITEM_CLASS, obj);
|
2014-09-27 22:14:20 -07:00
|
|
|
if (!eo_item) return NULL;
|
2009-09-27 20:07:20 -07:00
|
|
|
|
2014-09-27 22:14:20 -07:00
|
|
|
ELM_SLIDESHOW_ITEM_DATA_GET(eo_item, item);
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2009-10-12 13:02:56 -07:00
|
|
|
item->itc = itc;
|
2014-09-27 22:14:20 -07:00
|
|
|
item->l = eina_list_append(item->l, eo_item);
|
2014-09-14 04:51:26 -07:00
|
|
|
WIDGET_ITEM_DATA_SET(eo_item, data);
|
2009-10-12 13:02:56 -07:00
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->items = eina_list_merge(sd->items, item->l);
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2014-08-19 00:52:24 -07:00
|
|
|
if (!sd->current) elm_slideshow_item_show(eo_item);
|
2009-10-12 13:02:56 -07:00
|
|
|
|
2014-08-19 00:52:24 -07:00
|
|
|
return eo_item;
|
2009-09-23 15:56:47 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_slideshow_item_sorted_insert(Eo *obj, Elm_Slideshow_Data *sd, const Elm_Slideshow_Item_Class *itc, const void *data, Eina_Compare_Cb func)
|
2011-05-06 03:22:32 -07:00
|
|
|
{
|
2014-09-27 22:14:20 -07:00
|
|
|
Eo *eo_item;
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
eo_item = efl_add(ELM_SLIDESHOW_ITEM_CLASS, obj);
|
2014-09-27 22:14:20 -07:00
|
|
|
if (!eo_item) return NULL;
|
|
|
|
|
|
|
|
ELM_SLIDESHOW_ITEM_DATA_GET(eo_item, item);
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2011-05-06 03:22:32 -07:00
|
|
|
item->itc = itc;
|
2014-09-27 22:14:20 -07:00
|
|
|
item->l = eina_list_append(item->l, eo_item);
|
2014-09-14 04:51:26 -07:00
|
|
|
WIDGET_ITEM_DATA_SET(eo_item, data);
|
2011-05-06 03:22:32 -07:00
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->items = eina_list_sorted_merge(sd->items, item->l, func);
|
2011-05-06 03:22:32 -07:00
|
|
|
|
2014-08-19 00:52:24 -07:00
|
|
|
if (!sd->current) elm_slideshow_item_show(eo_item);
|
2011-05-06 03:22:32 -07:00
|
|
|
|
2014-08-19 00:52:24 -07:00
|
|
|
return eo_item;
|
2011-05-06 03:22:32 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:20 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_slideshow_item_show(Eo *eo_item EINA_UNUSED, Elm_Slideshow_Item_Data *item)
|
|
|
|
{
|
|
|
|
char buf[1024];
|
|
|
|
Elm_Slideshow_Item_Data *next = NULL;
|
2012-05-03 15:42:43 -07:00
|
|
|
|
|
|
|
ELM_SLIDESHOW_DATA_GET(WIDGET(item), sd);
|
|
|
|
|
|
|
|
if (item == sd->current) return;
|
2010-07-22 09:13:40 -07:00
|
|
|
|
|
|
|
next = item;
|
2012-05-03 15:42:43 -07:00
|
|
|
_on_slideshow_end(WIDGET(item), WIDGET(item), NULL, NULL);
|
|
|
|
|
2013-05-29 05:06:48 -07:00
|
|
|
ELM_SAFE_FREE(sd->timer, ecore_timer_del);
|
2012-05-03 15:42:43 -07:00
|
|
|
if (sd->timeout > 0.0)
|
|
|
|
sd->timer = ecore_timer_add(sd->timeout, _timer_cb, WIDGET(item));
|
2009-09-27 20:07:20 -07:00
|
|
|
|
2010-07-22 09:13:40 -07:00
|
|
|
_item_realize(next);
|
2012-05-03 15:42:43 -07:00
|
|
|
elm_layout_content_set(WIDGET(item), "elm.swallow.2", VIEW(next));
|
|
|
|
|
2012-06-19 09:31:30 -07:00
|
|
|
if (!sd->transition)
|
2013-10-05 05:35:27 -07:00
|
|
|
sprintf(buf, "elm,none,next");
|
2012-06-19 09:31:30 -07:00
|
|
|
else
|
2013-10-05 05:35:27 -07:00
|
|
|
snprintf(buf, sizeof(buf), "elm,%s,next", sd->transition);
|
2013-07-31 02:57:12 -07:00
|
|
|
elm_layout_signal_emit(WIDGET(item), buf, "elm");
|
|
|
|
// XXX: for backwards compat
|
2013-10-05 05:35:27 -07:00
|
|
|
if (!sd->transition)
|
|
|
|
sprintf(buf,"none,next");
|
|
|
|
else
|
|
|
|
snprintf(buf, sizeof(buf), "%s,next", sd->transition);
|
2012-05-03 15:42:43 -07:00
|
|
|
elm_layout_signal_emit(WIDGET(item), buf, "slideshow");
|
|
|
|
|
|
|
|
sd->previous = sd->current;
|
|
|
|
sd->current = next;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(item), ELM_SLIDESHOW_EVENT_CHANGED, EO_OBJ(sd->current));
|
2009-09-23 15:56:47 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_slideshow_next(Eo *obj, Elm_Slideshow_Data *sd)
|
2009-09-23 15:56:47 -07:00
|
|
|
{
|
|
|
|
char buf[1024];
|
2014-09-27 22:14:20 -07:00
|
|
|
Elm_Slideshow_Item_Data *next = NULL;
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
if (sd->current) next = _item_next_get(sd->current);
|
2009-09-24 02:43:05 -07:00
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
if ((!next) || (next == sd->current)) return;
|
2010-07-14 14:12:58 -07:00
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
_on_slideshow_end(obj, obj, NULL, NULL);
|
2010-07-15 10:09:59 -07:00
|
|
|
|
2013-05-29 05:06:48 -07:00
|
|
|
ELM_SAFE_FREE(sd->timer, ecore_timer_del);
|
2012-05-03 15:42:43 -07:00
|
|
|
if (sd->timeout > 0.0)
|
|
|
|
sd->timer = ecore_timer_add(sd->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
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
elm_layout_content_set(obj, "elm.swallow.2", VIEW(next));
|
2010-07-14 14:12:58 -07:00
|
|
|
|
2012-06-19 09:31:30 -07:00
|
|
|
if (!sd->transition)
|
2013-10-05 05:35:27 -07:00
|
|
|
sprintf(buf, "elm,none,next");
|
2012-06-19 09:31:30 -07:00
|
|
|
else
|
2013-10-05 05:35:27 -07:00
|
|
|
snprintf(buf, sizeof(buf), "elm,%s,next", sd->transition);
|
2013-07-31 02:57:12 -07:00
|
|
|
elm_layout_signal_emit(obj, buf, "elm");
|
|
|
|
// XXX: for backwards compat
|
2013-10-05 05:35:27 -07:00
|
|
|
if (!sd->transition)
|
|
|
|
sprintf(buf,"none,next");
|
|
|
|
else
|
|
|
|
snprintf(buf, sizeof(buf), "%s,next", sd->transition);
|
2012-05-03 15:42:43 -07:00
|
|
|
elm_layout_signal_emit(obj, buf, "slideshow");
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->previous = sd->current;
|
|
|
|
sd->current = next;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_SLIDESHOW_EVENT_CHANGED, EO_OBJ(sd->current));
|
2009-09-23 15:56:47 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_slideshow_previous(Eo *obj, Elm_Slideshow_Data *sd)
|
2009-09-23 15:56:47 -07:00
|
|
|
{
|
|
|
|
char buf[1024];
|
2014-09-27 22:14:20 -07:00
|
|
|
Elm_Slideshow_Item_Data *prev = NULL;
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
if (sd->current) prev = _item_prev_get(sd->current);
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
if ((!prev) || (prev == sd->current)) return;
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
_on_slideshow_end(obj, obj, NULL, NULL);
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2013-05-29 05:06:48 -07:00
|
|
|
ELM_SAFE_FREE(sd->timer, ecore_timer_del);
|
2012-05-03 15:42:43 -07:00
|
|
|
if (sd->timeout > 0.0)
|
|
|
|
sd->timer = ecore_timer_add(sd->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
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
elm_layout_content_set(obj, "elm.swallow.2", VIEW(prev));
|
2009-09-27 20:07:20 -07:00
|
|
|
|
2012-06-19 09:31:30 -07:00
|
|
|
if (!sd->transition)
|
2013-10-05 05:35:27 -07:00
|
|
|
sprintf(buf, "elm,none,previous");
|
2012-06-19 09:31:30 -07:00
|
|
|
else
|
2013-10-05 05:35:27 -07:00
|
|
|
snprintf(buf, 1024, "elm,%s,previous", sd->transition);
|
2013-07-31 02:57:12 -07:00
|
|
|
elm_layout_signal_emit(obj, buf, "elm");
|
|
|
|
// XXX: for backwards compat
|
2013-10-05 05:35:27 -07:00
|
|
|
if (!sd->transition)
|
|
|
|
sprintf(buf,"none,previous");
|
|
|
|
else
|
|
|
|
snprintf(buf, 1024, "%s,previous", sd->transition);
|
2012-05-03 15:42:43 -07:00
|
|
|
elm_layout_signal_emit(obj, buf, "slideshow");
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->previous = sd->current;
|
|
|
|
sd->current = prev;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_SLIDESHOW_EVENT_CHANGED, EO_OBJ(sd->current));
|
2009-09-23 15:56:47 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static const Eina_List*
|
|
|
|
_elm_slideshow_transitions_get(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd)
|
2009-09-23 15:56:47 -07:00
|
|
|
{
|
2014-03-26 02:53:31 -07:00
|
|
|
return sd->transitions;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static const Eina_List*
|
|
|
|
_elm_slideshow_layouts_get(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-26 02:53:31 -07:00
|
|
|
return sd->layout.list;
|
2010-07-14 02:07:43 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_slideshow_transition_set(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd, const char *transition)
|
2009-09-23 15:56:47 -07:00
|
|
|
{
|
2012-05-03 15:42:43 -07:00
|
|
|
eina_stringshare_replace(&sd->transition, transition);
|
2009-09-23 15:56:47 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static const char*
|
|
|
|
_elm_slideshow_transition_get(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd)
|
2010-04-05 13:23:30 -07:00
|
|
|
{
|
2014-03-26 02:53:31 -07:00
|
|
|
return sd->transition;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_slideshow_timeout_set(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd, double timeout)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->timeout = timeout;
|
|
|
|
|
2013-05-29 05:06:48 -07:00
|
|
|
ELM_SAFE_FREE(sd->timer, ecore_timer_del);
|
2011-01-09 21:27:15 -08:00
|
|
|
if (timeout > 0.0)
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->timer = ecore_timer_add(timeout, _timer_cb, obj);
|
2009-09-24 02:43:05 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static double
|
|
|
|
_elm_slideshow_timeout_get(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd)
|
2009-09-24 02:43:05 -07:00
|
|
|
{
|
2014-03-26 02:53:31 -07:00
|
|
|
return sd->timeout;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_slideshow_loop_set(Eo *obj, Elm_Slideshow_Data *sd, Eina_Bool loop)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
|
|
|
ELM_SLIDESHOW_CHECK(obj);
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->loop = loop;
|
2009-09-24 02:43:05 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static const char*
|
|
|
|
_elm_slideshow_layout_get(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd)
|
2010-07-14 02:07:43 -07:00
|
|
|
{
|
2014-03-26 02:53:31 -07:00
|
|
|
return sd->layout.current;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_slideshow_layout_set(Eo *obj, Elm_Slideshow_Data *sd, const char *layout)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2010-07-14 02:07:43 -07:00
|
|
|
char buf[PATH_MAX];
|
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
|
|
|
|
sd->layout.current = layout;
|
2013-10-05 05:35:27 -07:00
|
|
|
snprintf(buf, sizeof(buf), "elm,layout,%s", layout);
|
2013-07-31 02:57:12 -07:00
|
|
|
elm_layout_signal_emit(obj, buf, "elm");
|
|
|
|
// XXX: for bakcwards compat
|
2013-10-05 05:35:27 -07:00
|
|
|
snprintf(buf, sizeof(buf), "layout,%s", layout);
|
2012-05-03 15:42:43 -07:00
|
|
|
elm_layout_signal_emit(obj, buf, "slideshow");
|
2010-07-14 02:07:43 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_slideshow_loop_get(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd)
|
2010-04-05 13:23:30 -07:00
|
|
|
{
|
2014-03-26 02:53:31 -07:00
|
|
|
return sd->loop;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_slideshow_clear(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd)
|
2009-09-24 02:43:05 -07:00
|
|
|
{
|
2014-09-27 22:14:20 -07:00
|
|
|
Eo *eo_item;
|
2015-05-17 04:59:06 -07:00
|
|
|
Eina_List *itr, *itr2;
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->previous = NULL;
|
|
|
|
sd->current = NULL;
|
2011-04-01 04:24:15 -07:00
|
|
|
|
2015-05-17 04:59:06 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(sd->items, itr, itr2, eo_item)
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_del(eo_item);
|
2009-10-12 13:02:56 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static const Eina_List*
|
|
|
|
_elm_slideshow_items_get(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd)
|
2009-10-29 10:26:52 -07:00
|
|
|
{
|
2014-03-26 02:53:31 -07:00
|
|
|
return sd->items;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_slideshow_item_current_get(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-08-19 00:52:24 -07:00
|
|
|
return EO_OBJ(sd->current);
|
2009-10-12 15:00:14 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:20 -07:00
|
|
|
EOLIAN static Evas_Object *
|
2015-06-25 04:21:00 -07:00
|
|
|
_elm_slideshow_item_object_get(const Eo *eo_item EINA_UNUSED, Elm_Slideshow_Item_Data *it)
|
2009-10-12 15:00:14 -07:00
|
|
|
{
|
2011-12-08 03:01:01 -08:00
|
|
|
return VIEW(it);
|
2009-10-12 15:00:14 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static int
|
|
|
|
_elm_slideshow_cache_before_get(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-26 02:53:31 -07:00
|
|
|
return sd->count_item_pre_before;
|
2011-04-22 02:19:25 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_slideshow_cache_before_set(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd, int count)
|
2011-04-22 02:19:25 -07:00
|
|
|
{
|
2012-05-03 15:42:43 -07:00
|
|
|
if (!sd) return;
|
2011-04-22 02:19:25 -07:00
|
|
|
if (count < 0) count = 0;
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->count_item_pre_before = count;
|
2011-04-22 02:19:25 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static int
|
|
|
|
_elm_slideshow_cache_after_get(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-26 02:53:31 -07:00
|
|
|
return sd->count_item_pre_after;
|
2011-04-22 02:19:25 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_slideshow_cache_after_set(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd, int count)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2011-04-22 02:19:25 -07:00
|
|
|
if (count < 0) count = 0;
|
2012-05-03 15:42:43 -07:00
|
|
|
sd->count_item_pre_after = count;
|
2011-04-22 02:19:25 -07:00
|
|
|
}
|
2011-05-10 02:06:51 -07:00
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2015-06-25 04:21:00 -07:00
|
|
|
_elm_slideshow_item_nth_get(const Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd, unsigned int nth)
|
2011-05-10 02:06:51 -07:00
|
|
|
{
|
2014-03-26 02:53:31 -07:00
|
|
|
return eina_list_nth(sd->items, nth);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static unsigned int
|
|
|
|
_elm_slideshow_count_get(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-26 02:53:31 -07:00
|
|
|
return eina_list_count(sd->items);
|
2011-05-10 02:06:51 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_slideshow_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *_pd EINA_UNUSED)
|
2011-05-10 02:06:51 -07:00
|
|
|
{
|
2014-03-26 02:53:31 -07:00
|
|
|
return EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_slideshow_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-26 02:53:31 -07:00
|
|
|
return EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_slideshow_class_constructor(Efl_Class *klass)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2011-05-10 02:06:51 -07:00
|
|
|
}
|
2014-03-26 02:53:31 -07:00
|
|
|
|
2014-07-25 01:33:19 -07:00
|
|
|
EOLIAN static const Elm_Atspi_Action*
|
|
|
|
_elm_slideshow_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
static Elm_Atspi_Action atspi_actions[] = {
|
|
|
|
{ "move,left", "move", "left", _key_action_move},
|
|
|
|
{ "move,right", "move", "right", _key_action_move},
|
|
|
|
{ "pause", "pause", NULL, _key_action_pause},
|
|
|
|
{ NULL, NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
return &atspi_actions[0];
|
|
|
|
}
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
|
|
|
#define ELM_SLIDESHOW_EXTRA_OPS \
|
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_slideshow)
|
|
|
|
|
2014-09-27 22:14:20 -07:00
|
|
|
#include "elm_slideshow_item.eo.c"
|
2014-03-26 02:53:31 -07:00
|
|
|
#include "elm_slideshow.eo.c"
|