2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
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"
|
2012-07-31 15:06:00 -07:00
|
|
|
#include "elm_widget_slideshow.h"
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
#define MY_CLASS ELM_OBJ_SLIDESHOW_CLASS
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
_elm_slideshow_elm_widget_event(Eo *obj, Elm_Slideshow_Data *sd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
|
|
|
if (!_elm_config_key_binding_call(obj, ev, key_actions))
|
|
|
|
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
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
static Elm_Slideshow_Item *
|
|
|
|
_item_prev_get(Elm_Slideshow_Item *item)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2012-05-03 15:42:43 -07:00
|
|
|
ELM_SLIDESHOW_DATA_GET(WIDGET(item), sd);
|
|
|
|
Elm_Slideshow_Item *prev = eina_list_data_get(eina_list_prev(item->l));
|
|
|
|
|
|
|
|
if ((!prev) && (sd->loop))
|
2012-05-02 18:19:05 -07:00
|
|
|
prev = eina_list_data_get(eina_list_last(item->l));
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2012-05-02 18:19:05 -07:00
|
|
|
return prev;
|
|
|
|
}
|
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
static Elm_Slideshow_Item *
|
|
|
|
_item_next_get(Elm_Slideshow_Item *item)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2012-05-03 15:42:43 -07:00
|
|
|
ELM_SLIDESHOW_DATA_GET(WIDGET(item), sd);
|
|
|
|
Elm_Slideshow_Item *next = eina_list_data_get(eina_list_next(item->l));
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
if ((!next) && (sd->loop))
|
|
|
|
next = eina_list_data_get(sd->items);
|
|
|
|
|
|
|
|
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
|
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);
|
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
|
|
|
{
|
2012-05-03 15:42:43 -07:00
|
|
|
VIEW(item) = item->itc->func.get(elm_widget_item_data_get(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(
|
|
|
|
elm_widget_item_data_get(_item_next), obj);
|
|
|
|
_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(
|
|
|
|
elm_widget_item_data_get(_item_prev), obj);
|
|
|
|
_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)
|
2011-12-08 23:08:49 -08:00
|
|
|
item->itc->func.del(elm_widget_item_data_get(item), VIEW(item));
|
2014-01-21 17:38:55 -08:00
|
|
|
ELM_SAFE_FREE(VIEW(item), evas_object_del);
|
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
|
|
|
{
|
2011-04-01 04:24:15 -07:00
|
|
|
Elm_Slideshow_Item *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)
|
2012-05-03 15:42:43 -07:00
|
|
|
evas_object_smart_callback_call(data, SIG_TRANSITION_END, 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
|
|
|
}
|
|
|
|
|
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;
|
2012-05-03 15:42:43 -07:00
|
|
|
ELM_SLIDESHOW_DATA_GET_OR_RETURN_VAL(WIDGET(item), sd, EINA_FALSE);
|
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
|
|
|
{
|
2012-05-03 15:42:43 -07:00
|
|
|
Eina_List *l = eina_list_data_find_list(sd->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
|
|
|
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))
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_slideshow_evas_smart_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
|
|
|
|
2013-09-24 21:33:39 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
|
|
|
|
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
|
|
|
|
_elm_slideshow_evas_smart_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
|
|
|
|
2013-03-18 09:07:38 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
|
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);
|
2012-11-25 22:32:53 -08:00
|
|
|
Evas_Object *obj = eo_add(MY_CLASS, parent);
|
|
|
|
eo_unref(obj);
|
|
|
|
return obj;
|
|
|
|
}
|
2012-05-02 09:59:25 -07:00
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_slideshow_eo_base_constructor(Eo *obj, Elm_Slideshow_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-03-18 09:07:38 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, eo_constructor());
|
2012-11-25 22:32:53 -08:00
|
|
|
eo_do(obj,
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_obj_type_set(MY_CLASS_NAME_LEGACY),
|
2014-04-03 08:53:52 -07:00
|
|
|
evas_obj_smart_callbacks_descriptions_set(_smart_callbacks));
|
2009-09-23 15:56:47 -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
|
|
|
{
|
2009-10-12 13:02:56 -07:00
|
|
|
Elm_Slideshow_Item *item;
|
2009-09-27 20:07:20 -07:00
|
|
|
|
2010-09-09 19:05:45 -07:00
|
|
|
item = elm_widget_item_new(obj, Elm_Slideshow_Item);
|
2014-03-26 02:53:31 -07:00
|
|
|
if (!item) return NULL;
|
2012-05-03 15:42:43 -07:00
|
|
|
|
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
|
|
|
|
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
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
if (!sd->current) elm_slideshow_item_show((Elm_Object_Item *)item);
|
2009-10-12 13:02:56 -07:00
|
|
|
|
2014-03-26 02:53:31 -07:00
|
|
|
return (Elm_Object_Item *)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
|
|
|
{
|
|
|
|
Elm_Slideshow_Item *item;
|
2012-05-03 15:42:43 -07:00
|
|
|
|
2011-05-06 03:22:32 -07:00
|
|
|
item = elm_widget_item_new(obj, Elm_Slideshow_Item);
|
2014-03-26 02:53:31 -07:00
|
|
|
if (!item) return NULL;
|
2012-05-03 15:42:43 -07:00
|
|
|
|
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
|
|
|
|
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
|
|
|
|
2012-05-03 15:42:43 -07:00
|
|
|
if (!sd->current) elm_slideshow_item_show((Elm_Object_Item *)item);
|
2011-05-06 03:22:32 -07:00
|
|
|
|
2014-03-26 02:53:31 -07: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
|
|
|
{
|
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;
|
2012-05-03 15:42:43 -07:00
|
|
|
|
|
|
|
ELM_SLIDESHOW_ITEM_CHECK(it);
|
|
|
|
|
2012-03-06 03:51:42 -08:00
|
|
|
item = (Elm_Slideshow_Item *)it;
|
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;
|
|
|
|
evas_object_smart_callback_call(WIDGET(item), SIG_CHANGED, 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];
|
2010-07-15 10:09:59 -07:00
|
|
|
Elm_Slideshow_Item *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;
|
|
|
|
evas_object_smart_callback_call(obj, SIG_CHANGED, 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];
|
2010-07-15 10:09:59 -07:00
|
|
|
Elm_Slideshow_Item *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;
|
|
|
|
evas_object_smart_callback_call(obj, SIG_CHANGED, 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
|
|
|
{
|
2011-04-01 04:24:15 -07:00
|
|
|
Elm_Slideshow_Item *item;
|
2012-05-03 15:42:43 -07:00
|
|
|
|
|
|
|
sd->previous = NULL;
|
|
|
|
sd->current = NULL;
|
2013-03-08 20:23:42 -08:00
|
|
|
EINA_LIST_FREE(sd->items_built, item)
|
2011-04-01 04:24:15 -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-04-01 04:24:15 -07:00
|
|
|
}
|
|
|
|
|
2013-03-08 20:23:42 -08:00
|
|
|
EINA_LIST_FREE(sd->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
|
|
|
}
|
|
|
|
|
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-03-26 02:53:31 -07:00
|
|
|
return (Elm_Object_Item *)sd->current;
|
2009-10-12 15:00:14 -07:00
|
|
|
}
|
|
|
|
|
2010-03-09 08:27:46 -08:00
|
|
|
EAPI Evas_Object *
|
2012-05-03 15:42:43 -07:00
|
|
|
elm_slideshow_item_object_get(const Elm_Object_Item *it)
|
2009-10-12 15:00:14 -07:00
|
|
|
{
|
2012-05-03 15:42:43 -07:00
|
|
|
ELM_SLIDESHOW_ITEM_CHECK_OR_RETURN(it, NULL);
|
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*
|
|
|
|
_elm_slideshow_item_nth_get(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
|
|
|
|
_elm_slideshow_class_constructor(Eo_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
|
|
|
|
|
|
|
#include "elm_slideshow.eo.c"
|