Compare commits

...

7 Commits

Author SHA1 Message Date
Marcel Hollerbach 014ee1e679 remove unused code file 2019-11-20 17:06:58 +01:00
Marcel Hollerbach 7b03abd12b theme: rename pager to spotlight
that mirrors the name of the widget.
2019-11-20 17:06:54 +01:00
Marcel Hollerbach ccd229985f theme: remove unused parts
they seem totally useless, no idea why they are there.
2019-11-20 17:02:37 +01:00
Marcel Hollerbach 9d38587af8 efl_ui_spotlight_manager_*: remove size and position events
there is no need to listen to them, they are already listent to by the
container, and new sizes are told via the size property.
2019-11-20 17:01:34 +01:00
Marcel Hollerbach 6cc9c560d7 elm_test: make spotlight test check boxes work again
when we refactored check boxes, cases that used unified events on legacy
obejcts broke, which is okay. So the usage needed fixing.
2019-11-20 17:01:34 +01:00
Marcel Hollerbach 643952497f efl_ui_spotlight_manager: remove the group object
i do not know why its there, it caused a bug in the past (in regards of
clippers and visibility). Now we can get rid of it completly, the state
of it is always compatible to the one of the widget itself, soooo ...
2019-11-20 17:01:34 +01:00
Marcel Hollerbach c41b282a0f efl_ui_spotligt: make it possible to freeze animations
this new API makes it possible to stop animations beeing executed in the
spotlight manager. (The logic in the spotlight managers itself are
already implemented).
The animation will also be frozen during construction time of the
spotlight.
2019-11-20 17:01:34 +01:00
12 changed files with 97 additions and 310 deletions

View File

@ -203,7 +203,7 @@ collections {
#include "edc/efl/textpath.edc"
#include "edc/efl/win.edc"
#include "edc/efl/uiclock.edc"
#include "edc/efl/pager.edc"
#include "edc/efl/spotlight.edc"
#include "edc/efl/tab_pager.edc"
#include "edc/efl/tab_bar.edc"
#include "edc/efl/tab_page.edc"

View File

@ -1,20 +1,5 @@
group { "efl/pager"; data.item: "version" "123";
group { "efl/spotlight"; data.item: "version" "123";
parts {
spacer { "base";
scale;
desc { "default";
}
}
swallow { "efl.background";
scale;
desc { "default";
}
}
swallow { "efl.page_root";
scale;
desc { "default";
}
}
swallow { "efl.indicator";
scale;
desc { "default";
@ -32,7 +17,7 @@ group { "efl/pager"; data.item: "version" "123";
}
}
group { "efl/pager/indicator"; data.item: "version" "123";
group { "efl/spotlight/indicator"; data.item: "version" "123";
images {
image: "ring_white_middle.png" COMP;
}

View File

@ -230,10 +230,10 @@ height_slider_cb(void *data, const Efl_Event *ev)
}
static void
width_check_cb(void *data, const Efl_Event *ev)
width_check_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Size_Params *params = data;
Eina_Bool ck = elm_check_selected_get(ev->object);
Eina_Bool ck = elm_check_selected_get(obj);
int w, h;
elm_object_disabled_set(params->slider, ck);
@ -250,10 +250,10 @@ width_check_cb(void *data, const Efl_Event *ev)
}
static void
height_check_cb(void *data, const Efl_Event *ev)
height_check_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Size_Params *params = data;
Eina_Bool ck = elm_check_selected_get(ev->object);
Eina_Bool ck = elm_check_selected_get(obj);
int w, h;
elm_object_disabled_set(params->slider, ck);
@ -456,8 +456,7 @@ spotlight_size(void *data,
size_params->spotlight = params->spotlight;
size_params->params = params;
efl_event_callback_add(ck, EFL_UI_EVENT_SELECTED_CHANGED, width_check_cb,
size_params);
evas_object_smart_callback_add(ck, "changed", width_check_cb, size_params);
efl_event_callback_add(ck, EFL_EVENT_DEL, check_del_cb, size_params);
if (params->wfill)
@ -497,8 +496,7 @@ spotlight_size(void *data,
size_params->spotlight = params->spotlight;
size_params->params = params;
efl_event_callback_add(ck, EFL_UI_EVENT_SELECTED_CHANGED, height_check_cb,
size_params);
evas_object_smart_callback_add(ck, "changed", height_check_cb, size_params);
efl_event_callback_add(ck, EFL_EVENT_DEL, check_del_cb, size_params);
if (params->hfill)

View File

@ -1,191 +0,0 @@
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#include <Elementary.h>
#include "elm_priv.h"
#include "efl_page_indicator_icon.h"
#include "efl_page_indicator.h"
#include "efl_ui_widget_pager.h"
#define MY_CLASS EFL_PAGE_INDICATOR_ICON_CLASS
EOLIAN static void
_efl_page_indicator_icon_update(Eo *obj,
Efl_Page_Indicator_Icon_Data *pd,
double pos)
{
EFL_PAGE_INDICATOR_DATA_GET(obj, spd);
double delta = fabs(pos);
if (pd->curr)
{
eina_value_set(pd->v, 0.0);
efl_layout_signal_message_send(pd->curr, 1, *(pd->v));
if (pd->adj) efl_layout_signal_message_send(pd->adj, 1, *(pd->v));
}
efl_page_indicator_update(efl_super(obj, MY_CLASS), pos);
pd->curr = eina_list_nth(pd->items, spd->curr_idx);
eina_value_set(pd->v, (1.0 - delta));
efl_layout_signal_message_send(pd->curr, 1, *(pd->v));
if (pos < 0)
pd->adj = eina_list_nth(pd->items, (spd->curr_idx - 1 + spd->cnt) % spd->cnt);
else if (pos > 0)
pd->adj = eina_list_nth(pd->items, (spd->curr_idx + 1 + spd->cnt) % spd->cnt);
else pd->adj = NULL;
if (pd->adj)
{
eina_value_set(pd->v, delta);
efl_layout_signal_message_send(pd->adj, 1, *(pd->v));
}
}
EOLIAN static void
_efl_page_indicator_icon_pack(Eo *obj,
Efl_Page_Indicator_Icon_Data *pd,
int index)
{
EFL_PAGE_INDICATOR_DATA_GET(obj, spd);
Eo *item, *existing;
item = efl_add(EFL_CANVAS_LAYOUT_CLASS, spd->idbox);
elm_widget_theme_object_set(spd->idbox, item,
"pager", "indicator", "default");
efl_gfx_hint_align_set(item, 0.5, 0.5);
efl_gfx_hint_weight_set(item, 0, 0);
efl_gfx_hint_fill_set(item, 0, 0);
if (index == spd->cnt)
{
pd->items = eina_list_append(pd->items, item);
efl_pack_end(spd->idbox, item);
}
else
{
existing = eina_list_nth(pd->items, index);
pd->items = eina_list_prepend_relative(pd->items, item, existing);
efl_pack_before(spd->idbox, item, existing);
}
efl_page_indicator_pack(efl_super(obj, MY_CLASS), index);
if (!pd->curr)
{
pd->curr = eina_list_nth(pd->items, spd->curr_idx);
eina_value_set(pd->v, 1.0);
efl_layout_signal_message_send(pd->curr, 1, *(pd->v));
}
}
EOLIAN static void
_efl_page_indicator_icon_unpack(Eo *obj,
Efl_Page_Indicator_Icon_Data *pd,
int index)
{
EFL_PAGE_INDICATOR_DATA_GET(obj, spd);
Eo *item;
item = eina_list_nth(pd->items, index);
pd->items = eina_list_remove(pd->items, item);
efl_pack_unpack(spd->idbox, item);
efl_del(item);
if (index == spd->curr_idx) pd->curr = NULL;
efl_page_indicator_unpack(efl_super(obj, MY_CLASS), index);
if ((pd->curr == NULL) && (spd->curr_idx != -1))
{
pd->curr = eina_list_nth(pd->items, spd->curr_idx);
eina_value_set(pd->v, 1.0);
efl_layout_signal_message_send(pd->curr, 1, *(pd->v));
}
}
EOLIAN static void
_efl_page_indicator_icon_unpack_all(Eo *obj,
Efl_Page_Indicator_Icon_Data *pd)
{
Eo *item;
EINA_LIST_FREE(pd->items, item)
{
efl_del(item);
}
pd->curr = NULL;
efl_page_indicator_unpack_all(efl_super(obj, MY_CLASS));
}
EOLIAN static void
_efl_page_indicator_icon_efl_page_indicator_bind(Eo *obj,
Efl_Page_Indicator_Icon_Data *pd,
Eo *pager,
Efl_Canvas_Group *idbox)
{
EFL_PAGE_INDICATOR_DATA_GET(obj, spd);
Eo *item;
int i, page;
if (spd->pager.obj)
{
EINA_LIST_FREE(pd->items, item)
{
efl_del(item);
}
}
efl_page_indicator_bind(efl_super(obj, MY_CLASS), pager, idbox);
if (spd->pager.obj)
{
efl_ui_layout_orientation_set(spd->idbox, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
efl_gfx_arrangement_content_padding_set(spd->idbox, 15, 15);
pd->v = eina_value_float_new(0.0);
if (spd->cnt != 0)
{
for (i = 0; i < spd->cnt; i++)
{
item = efl_add(EFL_CANVAS_LAYOUT_CLASS, spd->idbox);
pd->items = eina_list_append(pd->items, item);
elm_widget_theme_object_set(spd->idbox, item,
"pager", "indicator", "default");
efl_gfx_hint_align_set(item, 0.5, 0.5);
efl_gfx_hint_weight_set(item, 0, 0);
efl_gfx_hint_fill_set(item, 0, 0);
efl_pack_end(spd->idbox, item);
}
page = efl_ui_pager_current_page_get(spd->pager.obj);
item = eina_list_nth(pd->items, page);
eina_value_set(pd->v, 1.0);
efl_layout_signal_message_send(item, 1, *(pd->v));
pd->curr = item;
}
}
}
#define EFL_PAGE_INDICATOR_ICON_EXTRA_OPS \
EFL_OBJECT_OP_FUNC(efl_page_indicator_update, \
_efl_page_indicator_icon_update), \
EFL_OBJECT_OP_FUNC(efl_page_indicator_pack, \
_efl_page_indicator_icon_pack), \
EFL_OBJECT_OP_FUNC(efl_page_indicator_unpack, \
_efl_page_indicator_icon_unpack), \
EFL_OBJECT_OP_FUNC(efl_page_indicator_unpack_all, \
_efl_page_indicator_icon_unpack_all)
#include "efl_page_indicator_icon.eo.c"

View File

@ -9,7 +9,7 @@
typedef struct _Efl_Ui_Spotlight_Container_Data
{
Eina_List *content_list;
Eo *page_root, *event;
Eo *event;
struct {
Eina_Size2D sz;
} page_spec;
@ -33,6 +33,8 @@ typedef struct _Efl_Ui_Spotlight_Container_Data
Eina_Bool fill_width: 1;
Eina_Bool fill_height: 1;
Eina_Bool prevent_transition_interaction : 1;
Eina_Bool animation_enabled_internal : 1;
Eina_Bool animation_enabled : 1;
} Efl_Ui_Spotlight_Container_Data;
#define MY_CLASS EFL_UI_SPOTLIGHT_CONTAINER_CLASS
@ -176,7 +178,7 @@ _efl_ui_spotlight_container_efl_object_constructor(Eo *obj,
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
if (!elm_widget_theme_klass_get(obj))
elm_widget_theme_klass_set(obj, "pager");
elm_widget_theme_klass_set(obj, "spotlight");
obj = efl_constructor(efl_super(obj, MY_CLASS));
@ -186,6 +188,7 @@ _efl_ui_spotlight_container_efl_object_constructor(Eo *obj,
elm_widget_theme_style_get(obj)) == EFL_UI_THEME_APPLY_ERROR_GENERIC)
CRI("Failed to set layout!");
pd->animation_enabled = EINA_TRUE;
pd->position = -1;
pd->curr.page = NULL;
pd->curr.pos = 0.0;
@ -200,10 +203,7 @@ _efl_ui_spotlight_container_efl_object_constructor(Eo *obj,
elm_widget_can_focus_set(obj, EINA_FALSE);
pd->page_root = efl_add(EFL_CANVAS_GROUP_CLASS, evas_object_evas_get(obj));
efl_content_set(efl_part(obj, "efl.page_root"), pd->page_root);
efl_event_callback_add(pd->page_root, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb, pd);
efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb, pd);
pd->event = efl_add(EFL_CANVAS_RECTANGLE_CLASS,
evas_object_evas_get(obj));
@ -214,13 +214,19 @@ _efl_ui_spotlight_container_efl_object_constructor(Eo *obj,
return obj;
}
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);
}
EOLIAN static Efl_Object*
_efl_ui_spotlight_container_efl_object_finalize(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd EINA_UNUSED)
_efl_ui_spotlight_container_efl_object_finalize(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd)
{
Efl_Ui_Spotlight_Manager *manager;
obj = efl_finalize(efl_super(obj, MY_CLASS));
pd->animation_enabled_internal = EINA_TRUE;
manager = efl_ui_spotlight_manager_get(obj);
//set a view manager in case nothing is here
if (!manager)
@ -229,7 +235,8 @@ _efl_ui_spotlight_container_efl_object_finalize(Eo *obj, Efl_Ui_Spotlight_Contai
}
else
{
efl_ui_spotlight_manager_animated_transition_set(manager, EINA_TRUE);
_animated_transition_manager_eval(obj, pd);
}
return obj;
@ -606,7 +613,7 @@ _efl_ui_spotlight_container_spotlight_manager_set(Eo *obj, Efl_Ui_Spotlight_Cont
if (pd->transition)
{
efl_ui_spotlight_manager_bind(pd->transition, NULL, NULL);
efl_ui_spotlight_manager_bind(pd->transition, NULL);
efl_del(pd->transition);
}
@ -619,9 +626,9 @@ _efl_ui_spotlight_container_spotlight_manager_set(Eo *obj, Efl_Ui_Spotlight_Cont
//the api indicates that the caller passes ownership to this function, so we need to unref here
efl_unref(pd->transition);
//disable animation when not finalized yet, this help reducing the overhead of scheduling a animation that will not be displayed
_animated_transition_manager_eval(obj, pd);
efl_ui_spotlight_manager_animated_transition_set(pd->transition, efl_finalized_get(obj));
efl_ui_spotlight_manager_bind(pd->transition, obj,
pd->page_root);
efl_ui_spotlight_manager_bind(pd->transition, obj);
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);
}
@ -738,5 +745,19 @@ _efl_ui_spotlight_container_pop(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Ei
return transition_done;
}
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;
}
#include "efl_ui_spotlight_container.eo.c"

View File

@ -65,6 +65,12 @@ class @beta Efl.Ui.Spotlight.Container extends Efl.Ui.Layout_Base implements Efl
(-1, -1) means that all available space inside the container can be used.]]
}
}
@property animated_transition {
[[When this flag is $true the transitions caused by @.push, @.pop or @.active_element are animated (if the @.spotlight_manager supports that). $false means immidiate displaying at the final position.]]
values {
enable : bool; [[$true to enable animated transitions. If $false, then any transition is displayed at the final position immidiatly]]
}
}
push @beta {
[[Packs a new sub-widget before @.active_element, and move the spotlight there.

View File

@ -28,7 +28,7 @@ _add_item(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Indicator_Icon_Data *pd)
item = efl_add(EFL_CANVAS_LAYOUT_CLASS, pd->indicator);
elm_widget_theme_object_set(pd->indicator, item,
"pager", "indicator", "default");
"spotlight", "indicator", "default");
efl_gfx_hint_align_set(item, 0.5, 0.5);
efl_gfx_hint_weight_set(item, 0, 0);
efl_gfx_hint_fill_set(item, 0, 0);

View File

@ -18,9 +18,6 @@ abstract @beta Efl.Ui.Spotlight.Manager extends Efl.Object {
]]
params {
spotlight : Efl.Ui.Spotlight.Container; [[The container to bind the manager to.]]
group : Efl.Canvas.Group; [[The graphical group where the views should be added with
@Efl.Canvas.Group.group_member_add and removed with
@Efl.Canvas.Group.group_member_remove.]]
}
}
content_add @pure_virtual {

View File

@ -8,7 +8,6 @@
typedef struct {
Efl_Ui_Spotlight_Container * container;
Efl_Gfx_Entity *group;
Eina_Size2D page_size;
Efl_Ui_Widget *current_content;
Eina_Bool animation;
@ -31,7 +30,7 @@ static void
_geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd)
{
Efl_Gfx_Entity *entity = pd->current_content;
Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->group);
Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->container);
Eina_Rect goal = EINA_RECT_EMPTY();
goal.size = pd->page_size;
@ -40,34 +39,14 @@ _geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd)
efl_gfx_entity_geometry_set(entity, goal);
}
static void
_resize_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
_geom_sync(data, efl_data_scope_get(data, MY_CLASS));
}
static void
_move_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
_geom_sync(data, efl_data_scope_get(data, MY_CLASS));
}
EFL_CALLBACKS_ARRAY_DEFINE(group_callback,
{EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb},
{EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _move_cb},
)
EOLIAN static void
_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Efl_Ui_Spotlight_Container *spotlight, Efl_Canvas_Group *group)
_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Efl_Ui_Spotlight_Container *spotlight)
{
if (spotlight && group)
if (spotlight)
{
Efl_Ui_Widget *index;
pd->container = spotlight;
pd->group = group;
efl_event_callback_array_add(pd->group, group_callback(), obj);
for (int i = 0; i < efl_content_count(spotlight) ; ++i) {
Efl_Gfx_Entity *elem = efl_pack_content_get(spotlight, i);
@ -147,8 +126,6 @@ _efl_ui_spotlight_manager_plain_efl_object_destructor(Eo *obj, Efl_Ui_Spotlight_
{
efl_destructor(efl_super(obj, MY_CLASS));
efl_event_callback_array_del(pd->group, group_callback(), obj);
for (int i = 0; i < efl_content_count(pd->container); ++i)
{
Efl_Gfx_Stack *elem = efl_pack_content_get(pd->container, i);

View File

@ -7,7 +7,7 @@
typedef struct {
Efl_Ui_Spotlight_Container * container;
Efl_Gfx_Entity *group, *foreclip, *backclip;
Efl_Gfx_Entity *foreclip, *backclip;
Eina_Size2D page_size;
struct {
Eina_Bool active;
@ -39,7 +39,7 @@ static void
_apply_box_properties(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd)
{
Eina_Rect geometry = EINA_RECT_EMPTY();
Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->group);
Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->container);
double current_pos;
if (pd->transition.active)
@ -76,18 +76,6 @@ _apply_box_properties(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd)
_propagate_progress(obj, current_pos);
}
static void
_resize_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
_apply_box_properties(data, efl_data_scope_get(data, EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS));
}
static void
_move_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
_apply_box_properties(data, efl_data_scope_get(data, EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS));
}
static void
_mouse_down_cb(void *data,
const Efl_Event *event)
@ -169,22 +157,19 @@ EFL_CALLBACKS_ARRAY_DEFINE(mouse_listeners,
);
EOLIAN static void
_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Efl_Ui_Spotlight_Container *spotlight, Efl_Canvas_Group *group)
_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Efl_Ui_Spotlight_Container *spotlight)
{
if (spotlight && group)
if (spotlight)
{
pd->container = spotlight;
pd->group = group;
efl_event_callback_add(pd->group, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb, obj);
efl_event_callback_add(pd->group, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _move_cb, obj);
pd->foreclip = efl_add(EFL_CANVAS_RECTANGLE_CLASS,
evas_object_evas_get(group));
evas_object_evas_get(pd->container));
evas_object_static_clip_set(pd->foreclip, EINA_TRUE);
efl_canvas_group_member_add(spotlight, pd->foreclip);
pd->backclip = efl_add(EFL_CANVAS_RECTANGLE_CLASS,
evas_object_evas_get(group));
evas_object_evas_get(pd->container));
evas_object_static_clip_set(pd->backclip, EINA_TRUE);
efl_gfx_entity_visible_set(pd->backclip, EINA_FALSE);
efl_canvas_group_member_add(spotlight, pd->backclip);
@ -192,7 +177,7 @@ _efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_S
for (int i = 0; i < efl_content_count(spotlight) ; ++i) {
Efl_Gfx_Entity *elem = efl_pack_content_get(spotlight, i);
efl_canvas_object_clipper_set(elem, pd->backclip);
efl_canvas_group_member_add(pd->group, elem);
efl_canvas_group_member_add(pd->container, elem);
efl_gfx_entity_visible_set(elem, EINA_TRUE);
}
_apply_box_properties(obj, pd);
@ -207,7 +192,7 @@ _efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_content_add(Eo *obj EI
{
efl_gfx_entity_visible_set(subobj, EINA_TRUE);
efl_canvas_object_clipper_set(subobj, pd->backclip);
efl_canvas_group_member_add(pd->group, subobj);
efl_canvas_group_member_add(pd->container, subobj);
if (!pd->transition.active)
_apply_box_properties(obj, pd);
@ -218,7 +203,7 @@ EOLIAN static void
_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_content_del(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
{
efl_canvas_object_clipper_set(subobj, NULL);
efl_canvas_group_member_remove(pd->group, subobj);
efl_canvas_group_member_remove(pd->container, subobj);
if (!pd->transition.active)
_apply_box_properties(obj, pd);
@ -326,8 +311,6 @@ _efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_animated_transition_ge
EOLIAN static void
_efl_ui_spotlight_manager_scroll_efl_object_invalidate(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd EINA_UNUSED)
{
efl_event_callback_del(pd->group, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb, obj);
efl_event_callback_del(pd->group, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _move_cb, obj);
efl_event_callback_array_del(efl_content_get(efl_part(pd->container, "efl.event")), mouse_listeners(), obj);
efl_del(pd->backclip);
efl_del(pd->foreclip);

View File

@ -8,7 +8,6 @@
typedef struct {
Efl_Ui_Spotlight_Container * container;
Efl_Gfx_Entity *group;
Efl_Canvas_Animation_Player *alpha_anim;
Efl_Gfx_Entity *content[2];
int ids[2]; //only used when in animation
@ -21,7 +20,7 @@ typedef struct {
static void
_geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd)
{
Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->group);
Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->container);
Eina_Rect goal = EINA_RECT_EMPTY();
goal.size = pd->page_size;
goal.y = (group_pos.y + group_pos.h/2)-pd->page_size.h/2;
@ -33,18 +32,6 @@ _geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd)
}
}
static void
_resize_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
_geom_sync(data, efl_data_scope_get(data, MY_CLASS));
}
static void
_move_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
_geom_sync(data, efl_data_scope_get(data, MY_CLASS));
}
static void
_running_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
@ -69,15 +56,11 @@ _hide_object_cb(void *data, const Efl_Event *ev)
}
EOLIAN static void
_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Efl_Ui_Spotlight_Container *spotlight, Efl_Canvas_Group *group)
_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Efl_Ui_Spotlight_Container *spotlight)
{
if (spotlight && group)
if (spotlight)
{
pd->container = spotlight;
pd->group = group;
efl_event_callback_add(pd->group, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb, obj);
efl_event_callback_add(pd->group, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _move_cb, obj);
pd->alpha_anim = efl_add(EFL_CANVAS_ANIMATION_ALPHA_CLASS, obj);
efl_animation_alpha_set(pd->alpha_anim, 0.0, 1.0);
@ -167,9 +150,6 @@ _efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_size_set(Eo *obj, Efl_U
EOLIAN static void
_efl_ui_spotlight_manager_stack_efl_object_invalidate(Eo *obj, Efl_Ui_Spotlight_Manager_Stack_Data *pd EINA_UNUSED)
{
efl_event_callback_del(pd->group, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb, obj);
efl_event_callback_del(pd->group, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _move_cb, obj);
efl_invalidate(efl_super(obj, MY_CLASS));
for (int i = 0; i < efl_content_count(pd->container); ++i)

View File

@ -116,6 +116,7 @@ typedef struct {
} spotlight;
struct {
int called;
Eina_Bool value;
} animation;
double last_position;
} Transition_Calls;
@ -187,7 +188,7 @@ static void
_transition_animation_set(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Eina_Bool animation)
{
transition_calls.animation.called++;
ck_assert_int_eq(animation, EINA_TRUE);
transition_calls.animation.value = animation;
}
static Eina_Bool
@ -265,7 +266,8 @@ EFL_START_TEST (efl_ui_smart_transition_calls)
efl_ui_spotlight_manager_set(container, t);
transition_calls.last_position = -2.0;
ck_assert_int_eq(transition_calls.animation.called, 1);
ck_assert_int_eq(transition_calls.animation.called, 2);
ck_assert_int_eq(transition_calls.animation.value, EINA_TRUE);
ck_assert_int_eq(transition_calls.spotlight.called, 1);
ck_assert_ptr_eq(transition_calls.spotlight.spotlight, container);
//We cannot verify group
@ -618,6 +620,34 @@ EFL_START_TEST (efl_ui_spotlight_test_pop3)
}
EFL_END_TEST
EFL_START_TEST (efl_ui_spotlight_animated_transition)
{
//this checks animation handing with the plain manager, there is no animation that will be played, but the flag should be preserved
ck_assert_int_eq(efl_ui_spotlight_animated_transition_get(container), EINA_TRUE);
efl_ui_spotlight_animated_transition_set(container, EINA_FALSE);
ck_assert_int_eq(efl_ui_spotlight_manager_animated_transition_get(efl_ui_spotlight_manager_get(container)), EINA_FALSE);
//now check with a real spotlight manager
efl_ui_spotlight_manager_set(container, efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS));
efl_ui_spotlight_animated_transition_set(container, EINA_TRUE);
ck_assert_int_eq(efl_ui_spotlight_animated_transition_get(container), EINA_TRUE);
ck_assert_int_eq(efl_ui_spotlight_manager_animated_transition_get(efl_ui_spotlight_manager_get(container)), EINA_TRUE);
efl_ui_spotlight_animated_transition_set(container, EINA_FALSE);
ck_assert_int_eq(efl_ui_spotlight_animated_transition_get(container), EINA_FALSE);
ck_assert_int_eq(efl_ui_spotlight_manager_animated_transition_get(efl_ui_spotlight_manager_get(container)), EINA_FALSE);
Eo *manager2 = efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS);
Eina_Bool animated_transition_manager;
efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, win,
efl_ui_spotlight_manager_set(efl_added, manager2),
efl_ui_spotlight_animated_transition_set(efl_added, EINA_TRUE),
animated_transition_manager = efl_ui_spotlight_manager_animated_transition_get(manager2));
ck_assert_int_eq(animated_transition_manager, EINA_FALSE);
ck_assert_int_eq(efl_ui_spotlight_manager_animated_transition_get(manager2), EINA_TRUE);
}
EFL_END_TEST
static void
spotlight_setup()
{
@ -653,4 +683,5 @@ void efl_ui_test_spotlight(TCase *tc)
tcase_add_test(tc, efl_ui_spotlight_test_pop1);
tcase_add_test(tc, efl_ui_spotlight_test_pop2);
tcase_add_test(tc, efl_ui_spotlight_test_pop3);
tcase_add_test(tc, efl_ui_spotlight_animated_transition);
}