2019-04-28 03:28:55 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <Efl_Ui.h>
|
|
|
|
#include "elm_priv.h"
|
2019-07-04 16:02:43 -07:00
|
|
|
#include "efl_ui_spotlight_manager_plain.eo.h"
|
2019-04-28 03:28:55 -07:00
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
typedef struct _Efl_Ui_Spotlight_Container_Data
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
Eina_List *content_list;
|
2019-11-20 07:45:45 -08:00
|
|
|
Eo *event;
|
2019-04-28 03:28:55 -07:00
|
|
|
struct {
|
|
|
|
Eina_Size2D sz;
|
|
|
|
} page_spec;
|
|
|
|
struct {
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
Efl_Ui_Widget *page;
|
2019-04-28 03:28:55 -07:00
|
|
|
double pos;
|
|
|
|
} curr;
|
|
|
|
struct {
|
|
|
|
int from;
|
|
|
|
int to;
|
|
|
|
double last_pos;
|
|
|
|
Eina_Bool active;
|
|
|
|
} show_request;
|
2019-05-18 09:45:50 -07:00
|
|
|
struct {
|
|
|
|
Eina_Promise *transition_done;
|
|
|
|
Efl_Gfx_Entity *content;
|
|
|
|
} transition_done;
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Manager *transition;
|
|
|
|
Efl_Ui_Spotlight_Indicator *indicator;
|
2019-04-28 03:28:55 -07:00
|
|
|
double position;
|
|
|
|
Eina_Bool fill_width: 1;
|
|
|
|
Eina_Bool fill_height: 1;
|
|
|
|
Eina_Bool prevent_transition_interaction : 1;
|
2019-11-20 07:16:22 -08:00
|
|
|
Eina_Bool animation_enabled_internal : 1;
|
|
|
|
Eina_Bool animation_enabled : 1;
|
2019-07-04 16:02:43 -07:00
|
|
|
} Efl_Ui_Spotlight_Container_Data;
|
2019-04-28 03:28:55 -07:00
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
#define MY_CLASS EFL_UI_SPOTLIGHT_CONTAINER_CLASS
|
2019-04-28 03:28:55 -07:00
|
|
|
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
static void
|
|
|
|
_fetch_partners(Eina_List *list, Eo *subobj, Eo **next, Eo **prev)
|
|
|
|
{
|
|
|
|
Eina_List *node = eina_list_data_find_list(list, subobj);
|
|
|
|
*next = eina_list_data_get(eina_list_next(node));
|
|
|
|
*prev = eina_list_data_get(eina_list_prev(node));
|
|
|
|
}
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
static void _unpack(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Efl_Gfx_Entity *subobj, int index);
|
|
|
|
static void _unpack_all(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, Eina_Bool clear);
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
static int
|
2019-07-04 16:02:43 -07:00
|
|
|
clamp_index(Efl_Ui_Spotlight_Container_Data *pd, int index)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
if (index < ((int)eina_list_count(pd->content_list)) * -1)
|
|
|
|
return -1;
|
|
|
|
else if (index > (int)eina_list_count(pd->content_list) - 1)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2019-07-04 16:02:43 -07:00
|
|
|
index_rollover(Efl_Ui_Spotlight_Container_Data *pd, int index)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
int c = eina_list_count(pd->content_list);
|
|
|
|
if (index < c * -1)
|
|
|
|
return 0;
|
|
|
|
else if (index > c - 1)
|
|
|
|
return c - 1;
|
|
|
|
else if (index < 0)
|
|
|
|
return index + c;
|
|
|
|
return index;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-07-04 16:02:43 -07:00
|
|
|
_transition_end(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Transition_Event ev;
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
if (pd->prevent_transition_interaction) return;
|
|
|
|
|
2019-05-18 09:45:50 -07:00
|
|
|
if (pd->transition_done.content)
|
|
|
|
{
|
|
|
|
Eina_Value v = eina_value_object_init(pd->transition_done.content);
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
//first store the fields, then NULL them, then resolve the situation, otherwise we might get trapped in a endless recursion
|
|
|
|
Eina_Promise *p = pd->transition_done.transition_done;
|
|
|
|
Eo *content = pd->transition_done.content;
|
2019-05-18 09:45:50 -07:00
|
|
|
pd->transition_done.transition_done = NULL;
|
|
|
|
pd->transition_done.content = NULL;
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
efl_pack_unpack(obj, content);
|
|
|
|
eina_promise_resolve(p , v);
|
2019-05-18 09:45:50 -07:00
|
|
|
}
|
|
|
|
|
2019-04-28 03:28:55 -07:00
|
|
|
ev.from = pd->show_request.from;
|
|
|
|
ev.to = pd->show_request.to;
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_EVENT_TRANSITION_END, &ev);
|
2019-04-28 03:28:55 -07:00
|
|
|
pd->show_request.active = EINA_FALSE;
|
|
|
|
pd->show_request.from = -1;
|
|
|
|
pd->show_request.to = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-07-04 16:02:43 -07:00
|
|
|
_transition_start(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, int from, int to, double progress)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Transition_Event ev;
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
if (pd->prevent_transition_interaction) return;
|
|
|
|
|
|
|
|
if (pd->show_request.active)
|
|
|
|
_transition_end(obj, pd);
|
|
|
|
|
|
|
|
pd->show_request.active = EINA_TRUE;
|
|
|
|
pd->show_request.from = from;
|
|
|
|
pd->show_request.to = to;
|
|
|
|
pd->show_request.last_pos = progress;
|
|
|
|
ev.from = pd->show_request.from;
|
|
|
|
ev.to = pd->show_request.to;
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_EVENT_TRANSITION_START, &ev);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-07-04 16:02:43 -07:00
|
|
|
_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, double progress)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
if (progress < -1.0) progress = -1.0;
|
|
|
|
if (progress > eina_list_count(pd->content_list)) progress = eina_list_count(pd->content_list);
|
|
|
|
if (pd->indicator)
|
|
|
|
{
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_indicator_position_update(pd->indicator, progress);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
pd->position = progress;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-07-04 16:02:43 -07:00
|
|
|
_transition_event_emission(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
if (pd->show_request.active)
|
|
|
|
{
|
|
|
|
if ((pd->show_request.to != -1 || pd->show_request.from != -1) &&
|
|
|
|
fabs(pd->show_request.last_pos - pd->show_request.to) < fabs(pd->position - pd->show_request.to))
|
|
|
|
{
|
|
|
|
//abort event here, movement is not in the direction we request
|
|
|
|
pd->show_request.to = -1;
|
|
|
|
_transition_end(obj, pd);
|
|
|
|
}
|
|
|
|
if (pd->position == pd->show_request.to)
|
|
|
|
{
|
|
|
|
//successfully there
|
|
|
|
_transition_end(obj, pd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//the progress changed without a show_request beeing active. instaciate a new one
|
|
|
|
_transition_start(obj, pd, -1, -1, pd->position);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_resize_cb(void *data, const Efl_Event *ev)
|
|
|
|
{
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Container_Data *pd = data;
|
2019-04-28 03:28:55 -07:00
|
|
|
Eina_Size2D sz;
|
|
|
|
|
|
|
|
sz = efl_gfx_entity_size_get(ev->object);
|
|
|
|
|
|
|
|
if (pd->fill_width) pd->page_spec.sz.w = sz.w;
|
|
|
|
if (pd->fill_height) pd->page_spec.sz.h = sz.h;
|
|
|
|
|
|
|
|
if (pd->transition)
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_manager_size_set(pd->transition, pd->page_spec.sz);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
|
2019-11-27 07:29:37 -08:00
|
|
|
static void
|
|
|
|
_position_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd = data;
|
|
|
|
|
|
|
|
if (pd->transition)
|
|
|
|
efl_ui_spotlight_manager_size_set(pd->transition, pd->page_spec.sz);
|
|
|
|
}
|
|
|
|
|
|
|
|
EFL_CALLBACKS_ARRAY_DEFINE(spotlight_resized,
|
|
|
|
{EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb},
|
|
|
|
{EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _position_cb},
|
|
|
|
)
|
|
|
|
|
2019-04-28 03:28:55 -07:00
|
|
|
EOLIAN static Eo *
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_efl_object_constructor(Eo *obj,
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
|
|
|
|
|
|
|
if (!elm_widget_theme_klass_get(obj))
|
2019-11-20 08:05:10 -08:00
|
|
|
elm_widget_theme_klass_set(obj, "spotlight");
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
|
|
|
|
|
|
|
if (elm_widget_theme_object_set(obj, wd->resize_obj,
|
|
|
|
elm_widget_theme_klass_get(obj),
|
|
|
|
elm_widget_theme_element_get(obj),
|
|
|
|
elm_widget_theme_style_get(obj)) == EFL_UI_THEME_APPLY_ERROR_GENERIC)
|
|
|
|
CRI("Failed to set layout!");
|
|
|
|
|
2019-11-20 07:16:22 -08:00
|
|
|
pd->animation_enabled = EINA_TRUE;
|
2019-04-28 03:28:55 -07:00
|
|
|
pd->position = -1;
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
pd->curr.page = NULL;
|
2019-04-28 03:28:55 -07:00
|
|
|
pd->curr.pos = 0.0;
|
|
|
|
|
|
|
|
pd->transition = NULL;
|
|
|
|
pd->indicator = NULL;
|
|
|
|
|
|
|
|
pd->fill_width = EINA_TRUE;
|
|
|
|
pd->fill_height = EINA_TRUE;
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_size_set(obj, EINA_SIZE2D(-1, -1));
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
elm_widget_can_focus_set(obj, EINA_FALSE);
|
|
|
|
|
2019-11-27 07:29:37 -08:00
|
|
|
efl_event_callback_array_add(obj, spotlight_resized(), pd);
|
2019-04-28 03:28:55 -07:00
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2019-11-20 07:16:22 -08:00
|
|
|
static void
|
|
|
|
_animated_transition_manager_eval(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
|
|
|
|
{
|
|
|
|
efl_ui_spotlight_manager_animated_transition_set(pd->transition, pd->animation_enabled_internal && pd->animation_enabled);
|
|
|
|
}
|
|
|
|
|
2019-04-28 03:28:55 -07:00
|
|
|
EOLIAN static Efl_Object*
|
2019-11-20 07:16:22 -08:00
|
|
|
_efl_ui_spotlight_container_efl_object_finalize(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Manager *manager;
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
obj = efl_finalize(efl_super(obj, MY_CLASS));
|
2019-11-20 07:16:22 -08:00
|
|
|
pd->animation_enabled_internal = EINA_TRUE;
|
2019-07-04 16:02:43 -07:00
|
|
|
manager = efl_ui_spotlight_manager_get(obj);
|
2019-04-28 03:28:55 -07:00
|
|
|
//set a view manager in case nothing is here
|
|
|
|
if (!manager)
|
|
|
|
{
|
2019-07-12 09:39:07 -07:00
|
|
|
efl_ui_spotlight_manager_set(obj, efl_new(EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS));
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-11-20 07:16:22 -08:00
|
|
|
|
|
|
|
_animated_transition_manager_eval(obj, pd);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_efl_object_invalidate(Eo *obj,
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
_unpack_all(obj, pd, EINA_TRUE);
|
|
|
|
efl_invalidate(efl_super(obj, MY_CLASS));
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static int
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_efl_container_content_count(Eo *obj EINA_UNUSED,
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
return eina_list_count(pd->content_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_child_inv(void *data, const Efl_Event *ev)
|
|
|
|
{
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Container_Data *pd = efl_data_scope_get(data, MY_CLASS);
|
2019-04-28 03:28:55 -07:00
|
|
|
int index = eina_list_data_idx(pd->content_list, ev->object);
|
|
|
|
_unpack(data, pd, ev->object, index);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2019-07-04 16:02:43 -07:00
|
|
|
_register_child(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, Efl_Gfx_Entity *subobj)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(subobj, EINA_FALSE);
|
|
|
|
if (eina_list_data_find(pd->content_list, subobj))
|
|
|
|
{
|
|
|
|
ERR("Object %p is already part of this!", subobj);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
if (!efl_ui_widget_sub_object_add(obj, subobj))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
efl_event_callback_add(subobj, EFL_EVENT_INVALIDATE, _child_inv, obj);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-07-04 16:02:43 -07:00
|
|
|
_update_internals(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
pd->prevent_transition_interaction = EINA_TRUE;
|
|
|
|
if (pd->transition)
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_manager_content_add(pd->transition, subobj, index);
|
2019-04-28 03:28:55 -07:00
|
|
|
if (pd->indicator)
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_indicator_content_add(pd->indicator, subobj, index);
|
2019-04-28 03:28:55 -07:00
|
|
|
pd->prevent_transition_interaction = EINA_FALSE;
|
|
|
|
if (eina_list_count(pd->content_list) == 1)
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
efl_ui_spotlight_active_element_set(obj, subobj);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_efl_pack_linear_pack_begin(Eo *obj EINA_UNUSED,
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd,
|
2019-04-28 03:28:55 -07:00
|
|
|
Efl_Gfx_Entity *subobj)
|
|
|
|
{
|
|
|
|
if (!_register_child(obj, pd, subobj)) return EINA_FALSE;
|
|
|
|
pd->content_list = eina_list_prepend(pd->content_list, subobj);
|
|
|
|
_update_internals(obj, pd, subobj, 0);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_efl_pack_linear_pack_end(Eo *obj EINA_UNUSED,
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd,
|
2019-04-28 03:28:55 -07:00
|
|
|
Efl_Gfx_Entity *subobj)
|
|
|
|
{
|
|
|
|
if (!_register_child(obj, pd, subobj)) return EINA_FALSE;
|
|
|
|
pd->content_list = eina_list_append(pd->content_list, subobj);
|
|
|
|
_update_internals(obj, pd, subobj, eina_list_count(pd->content_list) - 1);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_efl_pack_linear_pack_before(Eo *obj EINA_UNUSED,
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd,
|
2019-04-28 03:28:55 -07:00
|
|
|
Efl_Gfx_Entity *subobj,
|
|
|
|
const Efl_Gfx_Entity *existing)
|
|
|
|
{
|
|
|
|
int index = eina_list_data_idx(pd->content_list, (void *)existing);
|
2019-09-23 13:03:26 -07:00
|
|
|
if (existing)
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(index >= 0, EINA_FALSE);
|
2019-09-06 04:58:19 -07:00
|
|
|
|
|
|
|
if (!_register_child(obj, pd, subobj)) return EINA_FALSE;
|
2019-04-28 03:28:55 -07:00
|
|
|
pd->content_list = eina_list_prepend_relative(pd->content_list, subobj, existing);
|
|
|
|
_update_internals(obj, pd, subobj, index);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_efl_pack_linear_pack_after(Eo *obj EINA_UNUSED,
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd,
|
2019-04-28 03:28:55 -07:00
|
|
|
Efl_Gfx_Entity *subobj,
|
|
|
|
const Efl_Gfx_Entity *existing)
|
|
|
|
{
|
|
|
|
int index = eina_list_data_idx(pd->content_list, (void *)existing);
|
2019-09-23 13:03:26 -07:00
|
|
|
if (existing)
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(index >= 0, EINA_FALSE);
|
2019-09-06 04:58:19 -07:00
|
|
|
|
|
|
|
if (!_register_child(obj, pd, subobj)) return EINA_FALSE;
|
2019-04-28 03:28:55 -07:00
|
|
|
pd->content_list = eina_list_append_relative(pd->content_list, subobj, existing);
|
|
|
|
_update_internals(obj, pd, subobj, index + 1);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_efl_pack_linear_pack_at(Eo *obj,
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd,
|
2019-04-28 03:28:55 -07:00
|
|
|
Efl_Gfx_Entity *subobj,
|
|
|
|
int index)
|
|
|
|
{
|
|
|
|
Efl_Gfx_Entity *existing = NULL;
|
|
|
|
|
|
|
|
if (!_register_child(obj, pd, subobj)) return EINA_FALSE;
|
|
|
|
int clamp = clamp_index(pd, index);
|
|
|
|
int pass_index = -1;
|
|
|
|
if (clamp == 0)
|
|
|
|
{
|
|
|
|
existing = eina_list_nth(pd->content_list, index_rollover(pd, index));
|
|
|
|
pd->content_list = eina_list_prepend_relative(
|
|
|
|
pd->content_list, subobj, existing);
|
|
|
|
}
|
|
|
|
else if (clamp == 1)
|
|
|
|
{
|
|
|
|
pd->content_list = eina_list_append(pd->content_list, subobj);
|
|
|
|
pass_index = eina_list_count(pd->content_list);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pd->content_list = eina_list_prepend(pd->content_list, subobj);
|
|
|
|
pass_index = 0;
|
|
|
|
}
|
|
|
|
_update_internals(obj, pd, subobj, pass_index);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Efl_Gfx_Entity *
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_efl_pack_linear_pack_content_get(Eo *obj EINA_UNUSED,
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd,
|
2019-04-28 03:28:55 -07:00
|
|
|
int index)
|
|
|
|
{
|
|
|
|
return eina_list_nth(pd->content_list, index_rollover(pd, index));
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static int
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_efl_pack_linear_pack_index_get(Eo *obj EINA_UNUSED,
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd,
|
2019-04-28 03:28:55 -07:00
|
|
|
const Efl_Gfx_Entity *subobj)
|
|
|
|
{
|
|
|
|
return eina_list_data_idx(pd->content_list, (void *)subobj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
_efl_ui_spotlight_container_active_element_set(Eo *obj EINA_UNUSED,
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Container_Data *pd,
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
Efl_Ui_Widget *new_page)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
int before = -1;
|
|
|
|
int index;
|
2019-04-28 03:28:55 -07:00
|
|
|
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
if (pd->curr.page)
|
|
|
|
before = efl_pack_index_get(obj, pd->curr.page);
|
|
|
|
index = efl_pack_index_get(obj, new_page);
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN(index != -1);
|
2019-04-28 03:28:55 -07:00
|
|
|
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
pd->show_request.last_pos = efl_pack_index_get(obj, pd->curr.page);
|
|
|
|
pd->show_request.from = efl_pack_index_get(obj, pd->curr.page);
|
2019-04-28 03:28:55 -07:00
|
|
|
pd->show_request.to = index;
|
|
|
|
|
|
|
|
if (pd->show_request.active && pd->show_request.from == -1 && pd->show_request.to)
|
|
|
|
pd->show_request.to = index; //we just edit this here, a user animation will end when the progress is at the goal.
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_transition_start(obj, pd, before, index, before);
|
|
|
|
}
|
|
|
|
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
pd->curr.page = new_page;
|
|
|
|
efl_ui_spotlight_manager_switch_to(pd->transition, before, index);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
EOLIAN static Efl_Ui_Widget*
|
|
|
|
_efl_ui_spotlight_container_active_element_get(const Eo *obj EINA_UNUSED,
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Container_Data *pd)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
return pd->curr.page;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Size2D
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_spotlight_size_get(const Eo *obj EINA_UNUSED,
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
return pd->page_spec.sz;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_spotlight_size_set(Eo *obj,
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd,
|
2019-04-28 03:28:55 -07:00
|
|
|
Eina_Size2D sz)
|
|
|
|
{
|
|
|
|
Eina_Size2D size;
|
|
|
|
if (sz.w < -1 || sz.h < -1) return;
|
|
|
|
|
|
|
|
pd->page_spec.sz = sz;
|
|
|
|
pd->fill_width = sz.w == -1 ? EINA_TRUE : EINA_FALSE;
|
|
|
|
pd->fill_height = sz.h == -1 ? EINA_TRUE : EINA_FALSE;
|
|
|
|
|
|
|
|
size = efl_gfx_entity_size_get(obj);
|
|
|
|
if (pd->fill_height)
|
|
|
|
pd->page_spec.sz.h = size.h;
|
|
|
|
if (pd->fill_width)
|
|
|
|
pd->page_spec.sz.w = size.w;
|
|
|
|
|
|
|
|
if (pd->transition)
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_manager_size_set(pd->transition, pd->page_spec.sz);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_unpack_all(Eo *obj EINA_UNUSED,
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Container_Data *pd,
|
2019-04-28 03:28:55 -07:00
|
|
|
Eina_Bool clear)
|
|
|
|
{
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
pd->curr.page = NULL;
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
while(pd->content_list)
|
|
|
|
{
|
|
|
|
Eo *content = eina_list_data_get(pd->content_list);
|
|
|
|
|
|
|
|
if (clear)
|
|
|
|
efl_del(content);
|
2019-06-19 11:05:55 -07:00
|
|
|
else
|
|
|
|
_unpack(obj, pd, content, 0);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_efl_pack_pack_clear(Eo *obj EINA_UNUSED,
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
_unpack_all(obj, pd, EINA_TRUE);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_efl_pack_unpack_all(Eo *obj EINA_UNUSED,
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
_unpack_all(obj, pd, EINA_FALSE);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_unpack(Eo *obj,
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Container_Data *pd,
|
2019-04-28 03:28:55 -07:00
|
|
|
Efl_Gfx_Entity *subobj,
|
|
|
|
int index)
|
|
|
|
{
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
int early_curr_page = efl_pack_index_get(obj, pd->curr.page);
|
|
|
|
Eina_Bool deletion_of_active = (subobj == pd->curr.page);
|
|
|
|
Efl_Ui_Widget *next, *prev;
|
2019-04-28 03:28:55 -07:00
|
|
|
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
_fetch_partners(pd->content_list, subobj, &next, &prev);
|
2019-04-28 03:28:55 -07:00
|
|
|
pd->content_list = eina_list_remove(pd->content_list, subobj);
|
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, subobj);
|
|
|
|
|
2019-06-19 11:05:55 -07:00
|
|
|
if (!efl_alive_get(obj)) return;
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
if (pd->transition)
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_manager_content_del(pd->transition, subobj, index);
|
2019-04-28 03:28:55 -07:00
|
|
|
if (pd->indicator)
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_indicator_content_del(pd->indicator, subobj, index);
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
//we deleted the current index
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
if (deletion_of_active)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
if (eina_list_count(pd->content_list) == 0)
|
|
|
|
{
|
|
|
|
pd->curr.page = NULL;
|
|
|
|
}
|
2019-05-30 10:02:12 -07:00
|
|
|
else
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
{
|
|
|
|
//when we delete the active index and we are not updating the index,
|
|
|
|
// then force a update, so the same sort of animation is triggered from the right direction
|
|
|
|
if (early_curr_page == efl_pack_index_get(obj, prev))
|
|
|
|
pd->curr.page = eina_list_nth(pd->content_list, early_curr_page - 1);
|
|
|
|
|
|
|
|
if (prev)
|
|
|
|
efl_ui_spotlight_active_element_set(obj, prev);
|
|
|
|
else
|
|
|
|
efl_ui_spotlight_active_element_set(obj, next);
|
|
|
|
}
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
2019-05-30 10:02:12 -07:00
|
|
|
|
2019-04-28 03:28:55 -07:00
|
|
|
//position has updated
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
if (deletion_of_active &&
|
2019-04-28 03:28:55 -07:00
|
|
|
pd->indicator && !pd->transition)
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
efl_ui_spotlight_indicator_position_update(pd->indicator, efl_pack_index_get(obj, pd->curr.page));
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
efl_event_callback_del(subobj, EFL_EVENT_INVALIDATE, _child_inv, obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_efl_pack_unpack(Eo *obj,
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd,
|
2019-04-28 03:28:55 -07:00
|
|
|
Efl_Gfx_Entity *subobj)
|
|
|
|
{
|
|
|
|
if (!subobj) return EINA_FALSE;
|
|
|
|
|
|
|
|
int index = eina_list_data_idx(pd->content_list, subobj);
|
|
|
|
if (index == -1)
|
|
|
|
{
|
|
|
|
ERR("Item %p is not part of this container", subobj);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
_unpack(obj, pd, subobj, index);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Efl_Gfx_Entity *
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_efl_pack_linear_pack_unpack_at(Eo *obj,
|
|
|
|
Efl_Ui_Spotlight_Container_Data *pd,
|
2019-04-28 03:28:55 -07:00
|
|
|
int index)
|
|
|
|
{
|
|
|
|
Efl_Gfx_Entity *subobj = eina_list_nth(pd->content_list, index_rollover(pd, index_rollover(pd, index)));
|
|
|
|
|
|
|
|
_unpack(obj, pd, subobj, index);
|
|
|
|
|
|
|
|
return subobj;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_efl_pack_pack(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd EINA_UNUSED, Efl_Gfx_Entity *subobj)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
return efl_pack_begin(obj, subobj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Iterator*
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_efl_container_content_iterate(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
return eina_list_iterator_new(pd->content_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_pos_updated(void *data, const Efl_Event *event)
|
|
|
|
{
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Container_Data *pd = efl_data_scope_get(data, MY_CLASS);
|
2019-04-28 03:28:55 -07:00
|
|
|
double progress = *((double*)event->info);
|
|
|
|
//ignore this here, this could result in unintendet transition,start / end calls
|
|
|
|
if (EINA_DBL_EQ(progress, pd->position))
|
|
|
|
return;
|
|
|
|
_position_set(data, pd, progress);
|
|
|
|
_transition_event_emission(data, pd);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_spotlight_manager_set(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Efl_Ui_Spotlight_Manager *transition)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
if (!transition)
|
2019-07-04 16:02:43 -07:00
|
|
|
pd->transition = efl_add(EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS, obj);
|
2019-04-28 03:28:55 -07:00
|
|
|
else
|
2019-07-04 16:02:43 -07:00
|
|
|
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(transition, EFL_UI_SPOTLIGHT_MANAGER_CLASS));
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
if (pd->transition)
|
|
|
|
{
|
2019-11-20 07:45:45 -08:00
|
|
|
efl_ui_spotlight_manager_bind(pd->transition, NULL);
|
2019-04-28 03:28:55 -07:00
|
|
|
efl_del(pd->transition);
|
|
|
|
}
|
|
|
|
|
|
|
|
pd->transition = transition;
|
|
|
|
|
|
|
|
if (pd->transition)
|
|
|
|
{
|
2019-07-12 09:39:07 -07:00
|
|
|
EINA_SAFETY_ON_FALSE_RETURN(efl_ownable_get(pd->transition));
|
2019-04-28 03:28:55 -07:00
|
|
|
efl_parent_set(pd->transition, obj);
|
2019-07-12 09:39:07 -07:00
|
|
|
//the api indicates that the caller passes ownership to this function, so we need to unref here
|
|
|
|
efl_unref(pd->transition);
|
2019-04-28 03:28:55 -07:00
|
|
|
//disable animation when not finalized yet, this help reducing the overhead of scheduling a animation that will not be displayed
|
2019-11-20 07:16:22 -08:00
|
|
|
_animated_transition_manager_eval(obj, pd);
|
2019-11-11 08:38:08 -08:00
|
|
|
efl_ui_spotlight_manager_animated_transition_set(pd->transition, efl_finalized_get(obj));
|
2019-11-20 07:45:45 -08:00
|
|
|
efl_ui_spotlight_manager_bind(pd->transition, obj);
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_manager_size_set(pd->transition, pd->page_spec.sz);
|
|
|
|
efl_event_callback_add(pd->transition, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, _pos_updated, obj);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
EOLIAN static Efl_Ui_Spotlight_Manager*
|
|
|
|
_efl_ui_spotlight_container_spotlight_manager_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
2019-07-04 16:02:43 -07:00
|
|
|
if (efl_isa(pd->transition, EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS))
|
2019-04-28 03:28:55 -07:00
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
return pd->transition;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_indicator_set(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Efl_Ui_Spotlight_Indicator *indicator)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
if (pd->indicator)
|
|
|
|
{
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_indicator_bind(pd->indicator, obj);
|
2019-04-28 03:28:55 -07:00
|
|
|
efl_del(pd->indicator);
|
|
|
|
}
|
|
|
|
pd->indicator = indicator;
|
|
|
|
if (pd->indicator)
|
|
|
|
{
|
2019-07-12 10:33:31 -07:00
|
|
|
EINA_SAFETY_ON_FALSE_RETURN(efl_ownable_get(pd->indicator));
|
|
|
|
efl_parent_set(pd->indicator, obj);
|
|
|
|
//the api indicates that the caller passes ownership to this function, so we need to unref here
|
|
|
|
efl_unref(pd->indicator);
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_indicator_bind(pd->indicator, obj);
|
2019-04-28 03:28:55 -07:00
|
|
|
if (pd->position != -1)
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_indicator_position_update(pd->indicator, pd->position);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
EOLIAN static Efl_Ui_Spotlight_Indicator*
|
|
|
|
_efl_ui_spotlight_container_indicator_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
return pd->indicator;
|
|
|
|
}
|
|
|
|
|
2019-05-18 09:45:50 -07:00
|
|
|
EOLIAN static void
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_push(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd EINA_UNUSED, Efl_Gfx_Entity *view)
|
2019-05-18 09:45:50 -07:00
|
|
|
{
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
if (efl_ui_spotlight_active_element_get(obj))
|
|
|
|
{
|
|
|
|
if (!efl_pack_before(obj, view, efl_ui_spotlight_active_element_get(obj)))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!efl_pack_begin(obj, view))
|
|
|
|
return;
|
|
|
|
}
|
2019-05-18 09:45:50 -07:00
|
|
|
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
efl_ui_spotlight_active_element_set(obj, view);
|
2019-05-18 09:45:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Value
|
|
|
|
_delete_obj(void *data EINA_UNUSED, const Eina_Value value, const Eina_Future *dead_future EINA_UNUSED)
|
|
|
|
{
|
|
|
|
efl_del(eina_value_object_get(&value));
|
|
|
|
|
|
|
|
return EINA_VALUE_EMPTY;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Future*
|
2019-07-04 16:02:43 -07:00
|
|
|
_efl_ui_spotlight_container_pop(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Eina_Bool del)
|
2019-05-18 09:45:50 -07:00
|
|
|
{
|
|
|
|
Eina_Future *transition_done;
|
2019-07-31 02:16:51 -07:00
|
|
|
Eina_Value v;
|
2019-05-18 09:45:50 -07:00
|
|
|
int new_index;
|
2019-07-31 02:16:51 -07:00
|
|
|
int count;
|
|
|
|
Eo *content;
|
2019-05-18 09:45:50 -07:00
|
|
|
|
2019-07-31 02:16:51 -07:00
|
|
|
count = (int)eina_list_count(pd->content_list);
|
|
|
|
|
|
|
|
if (count == 0) return NULL;
|
|
|
|
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
content = efl_ui_spotlight_active_element_get(obj);
|
2019-07-31 02:16:51 -07:00
|
|
|
|
|
|
|
//pop() unpacks content without transition if there is one content.
|
|
|
|
if (count == 1)
|
|
|
|
{
|
|
|
|
efl_pack_unpack(obj, content);
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
pd->curr.page = NULL;
|
2019-07-31 02:16:51 -07:00
|
|
|
|
|
|
|
if (del)
|
|
|
|
{
|
|
|
|
efl_del(content);
|
|
|
|
v = EINA_VALUE_EMPTY;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
v = eina_value_object_init(content);
|
|
|
|
}
|
|
|
|
return efl_loop_future_resolved(obj, v);
|
|
|
|
}
|
2019-05-18 09:45:50 -07:00
|
|
|
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
new_index = efl_pack_index_get(obj, efl_ui_spotlight_active_element_get(obj)) + 1;
|
2019-07-31 02:16:51 -07:00
|
|
|
if (new_index >= count)
|
2019-05-18 09:45:50 -07:00
|
|
|
new_index -= 2;
|
|
|
|
|
2019-07-31 02:16:51 -07:00
|
|
|
pd->transition_done.content = content;
|
2019-05-18 09:45:50 -07:00
|
|
|
pd->transition_done.transition_done = efl_loop_promise_new(obj);
|
|
|
|
|
|
|
|
transition_done = eina_future_new(pd->transition_done.transition_done);
|
|
|
|
if (del)
|
|
|
|
transition_done = eina_future_then(transition_done, _delete_obj, NULL);
|
|
|
|
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
efl_ui_spotlight_active_element_set(obj, efl_pack_content_get(obj, new_index));
|
2019-05-18 09:45:50 -07:00
|
|
|
|
|
|
|
return transition_done;
|
|
|
|
}
|
|
|
|
|
2019-11-20 07:16:22 -08:00
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_spotlight_container_animated_transition_set(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Eina_Bool enable)
|
|
|
|
{
|
|
|
|
pd->animation_enabled = enable;
|
|
|
|
_animated_transition_manager_eval(obj, pd);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_efl_ui_spotlight_container_animated_transition_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
|
|
|
|
{
|
|
|
|
return pd->animation_enabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-18 09:45:50 -07:00
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
#include "efl_ui_spotlight_container.eo.c"
|