summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-09-02 10:26:40 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-09-02 14:14:13 +0200
commit88396dc80fb1f8283d33ba31790da300cc2117b9 (patch)
treefa285ed4c854101b4724917f5a144c6821585f15
parentbf58531dbaacb9ff78583278b04785e85a4c34cd (diff)
downloadefl-88396dc80fb1f8283d33ba31790da300cc2117b9.tar.gz
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 Differential Revision: https://phab.enlightenment.org/D9813
-rw-r--r--src/bin/elementary/test_ui_spotlight.c29
-rw-r--r--src/bin/elementary/test_ui_tab_pager.c30
-rw-r--r--src/examples/elementary/efl_ui_slideshow_example.c4
-rw-r--r--src/lib/elementary/efl_ui_spotlight_container.c123
-rw-r--r--src/lib/elementary/efl_ui_spotlight_container.eo10
-rw-r--r--src/lib/elementary/efl_ui_spotlight_indicator.eo16
-rw-r--r--src/lib/elementary/efl_ui_spotlight_manager.eo16
-rw-r--r--src/lib/elementary/efl_ui_spotlight_manager_plain.c36
-rw-r--r--src/lib/elementary/efl_ui_spotlight_manager_scroll.c7
-rw-r--r--src/lib/elementary/efl_ui_spotlight_manager_stack.c4
-rw-r--r--src/lib/elementary/efl_ui_tab_pager.c19
-rw-r--r--src/lib/elementary/efl_ui_tab_pager.eo2
-rw-r--r--src/tests/elementary/efl_ui_test_spotlight.c77
13 files changed, 183 insertions, 190 deletions
diff --git a/src/bin/elementary/test_ui_spotlight.c b/src/bin/elementary/test_ui_spotlight.c
index cdcaf65b1e..c2bc6b436c 100644
--- a/src/bin/elementary/test_ui_spotlight.c
+++ b/src/bin/elementary/test_ui_spotlight.c
@@ -124,20 +124,20 @@ static void
prev_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *spotlight = data;
- int active_index = efl_ui_spotlight_active_index_get(spotlight);
+ int active_index = efl_pack_index_get(spotlight, efl_ui_spotlight_active_element_get(spotlight));
if (active_index - 1 > -1)
- efl_ui_spotlight_active_index_set(spotlight, active_index - 1);
+ efl_ui_spotlight_active_element_set(spotlight, efl_pack_content_get(spotlight, active_index - 1));
}
static void
next_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *spotlight = data;
- int active_index = efl_ui_spotlight_active_index_get(spotlight);
+ int active_index = efl_pack_index_get(spotlight, efl_ui_spotlight_active_element_get(spotlight));
if (active_index + 1 < efl_content_count(spotlight))
- efl_ui_spotlight_active_index_set(spotlight, active_index + 1);
+ efl_ui_spotlight_active_element_set(spotlight, efl_pack_content_get(spotlight, active_index + 1));
}
static Eina_Value
@@ -280,7 +280,7 @@ pack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Pack_Params *param = data;
Eo *spotlight = param->spotlight;
- Eo *page = NULL, *curr_page;
+ Eo *page = NULL;
int index, cnt;
if ((param->type != UNPACK_AT) && (param->type != CLEAR))
@@ -318,15 +318,11 @@ pack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
break;
case PACK_BEFORE:
- index = efl_ui_spotlight_active_index_get(spotlight);
- curr_page = efl_pack_content_get(spotlight, index);
- efl_pack_before(spotlight, page, curr_page);
+ efl_pack_before(spotlight, page, efl_ui_spotlight_active_element_get(spotlight));
break;
case PACK_AFTER:
- index = efl_ui_spotlight_active_index_get(spotlight);
- curr_page = efl_pack_content_get(spotlight, index);
- efl_pack_after(spotlight, page, curr_page);
+ efl_pack_after(spotlight, page, efl_ui_spotlight_active_element_get(spotlight));
break;
case PACK_AT:
@@ -383,8 +379,9 @@ page_set_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Page_Set_Params *psp = data;
- efl_ui_spotlight_active_index_set(psp->spotlight,
- efl_ui_range_value_get(psp->spinner));
+ efl_ui_spotlight_active_element_set(psp->spotlight,
+ efl_pack_content_get(psp->spotlight,
+ efl_ui_range_value_get(psp->spinner)));
}
static void
@@ -609,7 +606,7 @@ pack_cb(void *data,
num = efl_content_count(spotlight);
if (num)
efl_ui_range_limits_set(sp1, 0, num);
- num = efl_ui_spotlight_active_index_get(spotlight);
+ num = efl_pack_index_get(spotlight, efl_ui_spotlight_active_element_get(spotlight));
if (num >= 0)
efl_ui_range_value_set(sp1, num);
@@ -735,7 +732,7 @@ pack_cb(void *data,
efl_ui_range_limits_set(sp2, 0,
(efl_content_count(spotlight) - 1));
efl_ui_range_value_set(sp2,
- efl_ui_spotlight_active_index_get(spotlight));
+ efl_pack_index_get(spotlight, efl_ui_spotlight_active_element_get(spotlight)));
}
else
{
@@ -801,7 +798,7 @@ active_index_cb(void *data,
efl_ui_range_limits_set(sp, 0,
(efl_content_count(spotlight) - 1));
efl_ui_range_value_set(sp,
- efl_ui_spotlight_active_index_get(spotlight));
+ efl_pack_index_get(spotlight, efl_ui_spotlight_active_element_get(spotlight)));
}
else
{
diff --git a/src/bin/elementary/test_ui_tab_pager.c b/src/bin/elementary/test_ui_tab_pager.c
index 93aaa12948..01ca807a2e 100644
--- a/src/bin/elementary/test_ui_tab_pager.c
+++ b/src/bin/elementary/test_ui_tab_pager.c
@@ -139,10 +139,10 @@ test_ui_tab_pager(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev
{
page = tab_page_add(tp);
efl_pack_end(tp, page);
+ if (i == 0)
+ efl_ui_spotlight_active_element_set(tp, page);
}
- efl_ui_spotlight_active_index_set(tp, 0);
-
ad = (App_Data*)calloc(1, sizeof(App_Data));
ad->navi = navi;
ad->tab_pager = tp;
@@ -175,7 +175,7 @@ static void
_tab_set_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Tab_Set_Data *tsd = data;
- efl_ui_spotlight_active_index_set(tsd->tab_pager, elm_spinner_value_get(tsd->spinner));
+ efl_ui_spotlight_active_element_set(tsd->tab_pager, efl_pack_content_get(tsd->tab_pager, elm_spinner_value_get(tsd->spinner)));
}
static void
@@ -206,7 +206,7 @@ _current_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, box,
efl_ui_range_limits_set(efl_added, 0, efl_content_count(tab_pager) - 1),
- efl_ui_range_value_set(efl_added, efl_ui_spotlight_active_index_get(tab_pager)),
+ efl_ui_range_value_set(efl_added, efl_content_count(tab_pager)),
efl_pack_end(box, efl_added));
tsd->tab_pager = tab_pager;
@@ -246,10 +246,8 @@ _pack_before_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *tab_pager = data;
Eo *tab_page, *cur_tab_page;
- int index;
- index = efl_ui_spotlight_active_index_get(tab_pager);
- cur_tab_page = efl_pack_content_get(tab_pager, index);
+ cur_tab_page = efl_ui_spotlight_active_element_get(tab_pager);
tab_page = tab_page_add(tab_pager);
@@ -261,10 +259,8 @@ _pack_after_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *tab_pager = data;
Eo *tab_page, *cur_tab_page;
- int index;
- index = efl_ui_spotlight_active_index_get(tab_pager);
- cur_tab_page = efl_pack_content_get(tab_pager, index);
+ cur_tab_page = efl_ui_spotlight_active_element_get(tab_pager);
tab_page = tab_page_add(tab_pager);
@@ -340,7 +336,7 @@ _pack_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, in_box,
efl_ui_range_limits_set(efl_added, 0, efl_content_count(tab_pager) - 1),
- efl_ui_range_value_set(efl_added, efl_ui_spotlight_active_index_get(tab_pager)),
+ efl_ui_range_value_set(efl_added, efl_content_count(tab_pager)),
efl_pack_end(in_box, efl_added));
tsd->tab_pager = tab_pager;
@@ -365,8 +361,9 @@ static void
_unpack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *tab_pager = data;
- int index = efl_ui_spotlight_active_index_get(tab_pager);
- Eo *tab_page = efl_pack_content_get(tab_pager, index);
+
+ Eo *tab_page = efl_ui_spotlight_active_element_get(tab_pager);
+
efl_pack_unpack(tab_pager, tab_page);
efl_del(tab_page);
}
@@ -440,7 +437,7 @@ _unpack_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, in_box,
efl_ui_range_limits_set(efl_added, 0, efl_content_count(tab_pager) - 1),
- efl_ui_range_value_set(efl_added, efl_ui_spotlight_active_index_get(tab_pager)),
+ efl_ui_range_value_set(efl_added, efl_content_count(tab_pager)),
efl_pack_end(in_box, efl_added));
tsd->tab_pager = tab_pager;
@@ -463,9 +460,8 @@ _change_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
Eo *tab_page, *content;
char *label = NULL;
char *icon = NULL;
- int cur;
- cur = efl_ui_spotlight_active_index_get(tcd->tab_pager);
- tab_page = efl_pack_content_get(tcd->tab_pager, cur);
+
+ tab_page = efl_ui_spotlight_active_element_get(tcd->tab_pager);
if (efl_ui_selectable_selected_get(tcd->label_check))
{
diff --git a/src/examples/elementary/efl_ui_slideshow_example.c b/src/examples/elementary/efl_ui_slideshow_example.c
index 55c1b66fab..6292f4390f 100644
--- a/src/examples/elementary/efl_ui_slideshow_example.c
+++ b/src/examples/elementary/efl_ui_slideshow_example.c
@@ -25,9 +25,9 @@ _show_next(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
efl_del(show_timer);
show_timer = NULL;
- int current_index = efl_ui_spotlight_active_index_get(container);
+ int current_index = efl_pack_index_get(container, efl_ui_spotlight_active_element_get(container));
int new_index = (current_index + 1) % efl_content_count(container);
- efl_ui_spotlight_active_index_set(container, new_index);
+ efl_ui_spotlight_active_element_set(container, efl_pack_content_get(container, new_index));
}
static void
diff --git a/src/lib/elementary/efl_ui_spotlight_container.c b/src/lib/elementary/efl_ui_spotlight_container.c
index 10c8125709..d7d46082a5 100644
--- a/src/lib/elementary/efl_ui_spotlight_container.c
+++ b/src/lib/elementary/efl_ui_spotlight_container.c
@@ -14,7 +14,7 @@ typedef struct _Efl_Ui_Spotlight_Container_Data
Eina_Size2D sz;
} page_spec;
struct {
- int page;
+ Efl_Ui_Widget *page;
double pos;
} curr;
struct {
@@ -37,6 +37,14 @@ typedef struct _Efl_Ui_Spotlight_Container_Data
#define MY_CLASS EFL_UI_SPOTLIGHT_CONTAINER_CLASS
+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));
+}
+
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);
@@ -73,10 +81,13 @@ _transition_end(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
if (pd->transition_done.content)
{
Eina_Value v = eina_value_object_init(pd->transition_done.content);
- efl_pack_unpack(obj, pd->transition_done.content);
- eina_promise_resolve(pd->transition_done.transition_done, v);
+ //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;
pd->transition_done.transition_done = NULL;
pd->transition_done.content = NULL;
+ efl_pack_unpack(obj, content);
+ eina_promise_resolve(p , v);
}
ev.from = pd->show_request.from;
@@ -176,7 +187,7 @@ _efl_ui_spotlight_container_efl_object_constructor(Eo *obj,
CRI("Failed to set layout!");
pd->position = -1;
- pd->curr.page = -1;
+ pd->curr.page = NULL;
pd->curr.pos = 0.0;
pd->transition = NULL;
@@ -267,24 +278,14 @@ _register_child(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, Efl_Gf
static void
_update_internals(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index)
{
- Eina_Bool curr_page_update = EINA_FALSE;
-
- if (pd->curr.page >= index)
- {
- pd->curr.page++;
- curr_page_update = EINA_TRUE;
- }
-
pd->prevent_transition_interaction = EINA_TRUE;
if (pd->transition)
efl_ui_spotlight_manager_content_add(pd->transition, subobj, index);
if (pd->indicator)
efl_ui_spotlight_indicator_content_add(pd->indicator, subobj, index);
- if (curr_page_update && !pd->transition && eina_list_count(pd->content_list) != 1)
- _position_set(obj, pd, pd->curr.page);
pd->prevent_transition_interaction = EINA_FALSE;
if (eina_list_count(pd->content_list) == 1)
- efl_ui_spotlight_active_index_set(obj, 0);
+ efl_ui_spotlight_active_element_set(obj, subobj);
}
EOLIAN static Eina_Bool
@@ -386,21 +387,21 @@ _efl_ui_spotlight_container_efl_pack_linear_pack_index_get(Eo *obj EINA_UNUSED,
}
EOLIAN static void
-_efl_ui_spotlight_container_active_index_set(Eo *obj EINA_UNUSED,
+_efl_ui_spotlight_container_active_element_set(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd,
- int index)
+ Efl_Ui_Widget *new_page)
{
- int before;
+ int before = -1;
+ int index;
- if ((index < 0) || (index > ((int)eina_list_count(pd->content_list) - 1)))
- {
- ERR("index %d out of range", index);
- return;
- }
+ 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);
- before = pd->curr.page;
- pd->show_request.last_pos = pd->curr.page;
- pd->show_request.from = pd->curr.page;
+ 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);
pd->show_request.to = index;
if (pd->show_request.active && pd->show_request.from == -1 && pd->show_request.to)
@@ -410,13 +411,12 @@ _efl_ui_spotlight_container_active_index_set(Eo *obj EINA_UNUSED,
_transition_start(obj, pd, before, index, before);
}
- int old_curr_page = pd->curr.page;
- pd->curr.page = index;
- efl_ui_spotlight_manager_switch_to(pd->transition, old_curr_page, pd->curr.page);
+ pd->curr.page = new_page;
+ efl_ui_spotlight_manager_switch_to(pd->transition, before, index);
}
-EOLIAN static int
-_efl_ui_spotlight_container_active_index_get(const Eo *obj EINA_UNUSED,
+EOLIAN static Efl_Ui_Widget*
+_efl_ui_spotlight_container_active_element_get(const Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd)
{
return pd->curr.page;
@@ -456,7 +456,7 @@ _unpack_all(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd,
Eina_Bool clear)
{
- pd->curr.page = -1;
+ pd->curr.page = NULL;
while(pd->content_list)
{
@@ -493,15 +493,15 @@ _unpack(Eo *obj,
Efl_Gfx_Entity *subobj,
int index)
{
- int early_curr_page = pd->curr.page;
- Eina_Bool deletion_of_active = (index == pd->curr.page);
+ 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;
+ _fetch_partners(pd->content_list, subobj, &next, &prev);
pd->content_list = eina_list_remove(pd->content_list, subobj);
_elm_widget_sub_object_redirect_to_top(obj, subobj);
if (!efl_alive_get(obj)) return;
- if (index < pd->curr.page)
- pd->curr.page--;
if (pd->transition)
efl_ui_spotlight_manager_content_del(pd->transition, subobj, index);
@@ -509,23 +509,33 @@ _unpack(Eo *obj,
efl_ui_spotlight_indicator_content_del(pd->indicator, subobj, index);
//we deleted the current index
- if (early_curr_page == index)
+ if (deletion_of_active)
{
- int new_curr_page = MIN(MAX(early_curr_page, 0), (int)eina_list_count(pd->content_list) - 1);
- //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 (deletion_of_active && new_curr_page == pd->curr.page)
- pd->curr.page = index -1;
- if (eina_list_count(pd->content_list) > 0 && efl_alive_get(obj))
- efl_ui_spotlight_active_index_set(obj, new_curr_page);
- else
- pd->curr.page = -1;
+ if (deletion_of_active)
+ {
+ if (eina_list_count(pd->content_list) == 0)
+ {
+ pd->curr.page = NULL;
+ }
+ else
+ {
+ //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);
+ }
+ }
}
//position has updated
- if (early_curr_page != pd->curr.page && early_curr_page != index &&
+ if (deletion_of_active &&
pd->indicator && !pd->transition)
- efl_ui_spotlight_indicator_position_update(pd->indicator, pd->curr.page);
+ efl_ui_spotlight_indicator_position_update(pd->indicator, efl_pack_index_get(obj, pd->curr.page));
efl_event_callback_del(subobj, EFL_EVENT_INVALIDATE, _child_inv, obj);
}
@@ -656,13 +666,8 @@ _efl_ui_spotlight_container_indicator_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spot
EOLIAN static void
_efl_ui_spotlight_container_push(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd EINA_UNUSED, Efl_Gfx_Entity *view)
{
- int old_active_index = efl_ui_spotlight_active_index_get(obj);
-
- if (old_active_index == -1)
- old_active_index = 0;
-
- efl_pack_at(obj, view, old_active_index);
- efl_ui_spotlight_active_index_set(obj, old_active_index);
+ efl_pack_before(obj, view, efl_ui_spotlight_active_element_get(obj));
+ efl_ui_spotlight_active_element_set(obj, view);
}
static Eina_Value
@@ -686,13 +691,13 @@ _efl_ui_spotlight_container_pop(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Ei
if (count == 0) return NULL;
- content = efl_pack_content_get(obj, efl_ui_spotlight_active_index_get(obj));
+ content = efl_ui_spotlight_active_element_get(obj);
//pop() unpacks content without transition if there is one content.
if (count == 1)
{
efl_pack_unpack(obj, content);
- pd->curr.page = -1;
+ pd->curr.page = NULL;
if (del)
{
@@ -706,7 +711,7 @@ _efl_ui_spotlight_container_pop(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Ei
return efl_loop_future_resolved(obj, v);
}
- new_index = efl_ui_spotlight_active_index_get(obj) + 1;
+ new_index = efl_pack_index_get(obj, efl_ui_spotlight_active_element_get(obj)) + 1;
if (new_index >= count)
new_index -= 2;
@@ -717,7 +722,7 @@ _efl_ui_spotlight_container_pop(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Ei
if (del)
transition_done = eina_future_then(transition_done, _delete_obj, NULL);
- efl_ui_spotlight_active_index_set(obj, new_index);
+ efl_ui_spotlight_active_element_set(obj, efl_pack_content_get(obj, new_index));
return transition_done;
}
diff --git a/src/lib/elementary/efl_ui_spotlight_container.eo b/src/lib/elementary/efl_ui_spotlight_container.eo
index 721304e27f..d64100c80a 100644
--- a/src/lib/elementary/efl_ui_spotlight_container.eo
+++ b/src/lib/elementary/efl_ui_spotlight_container.eo
@@ -8,7 +8,7 @@ class @beta Efl.Ui.Spotlight.Container extends Efl.Ui.Layout_Base implements Efl
{
[[The Spotlight widget is a container for other sub-widgets, where only one sub-widget is active at any given time.
- Sub-widgets are added using the @Efl.Pack_Linear interface and the active one (the one in the "spotlight") is selected using @.active_index.
+ Sub-widgets are added using the @Efl.Pack_Linear interface and the active one (the one in the "spotlight") is selected using @.active_element.
The way the different sub-widgets are rendered can be customized through the @.spotlight_manager object. For example, only the active sub-widget
might be shown, or it might be shown in a central position whereas the other sub-widgets are displayed on the sides, or grayed-out.
@@ -40,13 +40,13 @@ class @beta Efl.Ui.Spotlight.Container extends Efl.Ui.Layout_Base implements Efl
indicator : Efl.Ui.Spotlight.Indicator @owned; [[The Indicator object or $NULL.]]
}
}
- @property active_index {
+ @property active_element {
[[Currently active sub-widget (the one with the spotlight) among all the sub-widgets added to this widget
Changing this value might trigger an animation.
]]
values {
- index: int; [[Index of the sub-widget that has the spotlight, from 0 to the number of sub-widgets - 1 (@Efl.Container.content_count - 1).]]
+ element : Efl.Ui.Widget; [[Sub-widget that has the spotlight. The element has to be added prior to this call via the @Efl.Pack_Linear interface.]]
}
}
@property spotlight_size {
@@ -57,7 +57,7 @@ class @beta Efl.Ui.Spotlight.Container extends Efl.Ui.Layout_Base implements Efl
}
}
push @beta {
- [[Packs a new sub-widget at the position indicated by @.active_index (0 by default).
+ [[Packs a new sub-widget before @.active_element, and move the spotlight there.
This is the same behavior as a push operation on a stack.
@@ -71,7 +71,7 @@ class @beta Efl.Ui.Spotlight.Container extends Efl.Ui.Layout_Base implements Efl
[[Removes the sub-widget that has the spotlight from the widget.
The sub-widgets behind it naturally flow down so the next one gets the spotlight. This is the same behavior as a pop operation on a stack.
- When combined with @.push you don't have to worry about @.active_index since only the first sub-widget is manipulated.
+ When combined with @.push you don't have to worry about @.active_element since only the first sub-widget is manipulated.
An animation might be triggered to give the new sub-widget the spotlight, come into position and the old one disappear.
diff --git a/src/lib/elementary/efl_ui_spotlight_indicator.eo b/src/lib/elementary/efl_ui_spotlight_indicator.eo
index 230fb5b835..fa4b5eb4a0 100644
--- a/src/lib/elementary/efl_ui_spotlight_indicator.eo
+++ b/src/lib/elementary/efl_ui_spotlight_indicator.eo
@@ -1,7 +1,7 @@
abstract @beta Efl.Ui.Spotlight.Indicator extends Efl.Object {
[[Object used by @Efl.Ui.Spotlight.Container to render an indication of the active widgets's position among
the rest of the container's widgets.
-
+
An example would be Android's little dots in the home screen.
]]
methods {
@@ -17,29 +17,21 @@ abstract @beta Efl.Ui.Spotlight.Indicator extends Efl.Object {
}
}
content_add @pure_virtual {
- [[A $subobj has been added at position $index in the bound container.
-
- The manager should check the container's @Efl.Ui.Spotlight.Container.active_index since indices might have
- shifted due to the insertion of the new object.
- ]]
+ [[A $subobj has been added at position $index in the bound container.]]
params {
subobj : Efl.Gfx.Entity; [[The new object that has been added to the container.]]
index : int; [[The index of the new object in the container's list.]]
}
}
content_del @pure_virtual {
- [[The $subobj at position $index in the bound container has been removed.
-
- The manager should check the container's @Efl.Ui.Spotlight.Container.active_index since indices might have
- shifted due to the removal of the object.
- ]]
+ [[The $subobj at position $index in the bound container has been removed.]]
params {
subobj : Efl.Gfx.Entity; [[The object being removed from the container.]]
index : int; [[The index this object had in the container's list.]]
}
}
position_update @pure_virtual {
- [[This method tells the indicator that @Efl.Ui.Spotlight.Container.active_index has changed in the bound container.
+ [[This method tells the indicator that @Efl.Ui.Spotlight.Container.active_element has changed in the bound container.
$position ranges from -1 to the number of views in the bound container (@Efl.Container.content_count).
Notice this allows moving to a position before the first view or past the last view, which might happen if the view
diff --git a/src/lib/elementary/efl_ui_spotlight_manager.eo b/src/lib/elementary/efl_ui_spotlight_manager.eo
index 3b1d625a59..5cbaa9f004 100644
--- a/src/lib/elementary/efl_ui_spotlight_manager.eo
+++ b/src/lib/elementary/efl_ui_spotlight_manager.eo
@@ -1,9 +1,9 @@
abstract @beta Efl.Ui.Spotlight.Manager extends Efl.Object {
[[Manager object used by @Efl.Ui.Spotlight.Container to handle rendering and animation of its sub-widgets, and user interaction.
- For instance, changes to the current sub-widget in the spotlight (@Efl.Ui.Spotlight.Container.active_index) can be animated with a transition.
+ For instance, changes to the current sub-widget in the spotlight (@Efl.Ui.Spotlight.Container.active_element) can be animated with a transition.
This object can also handle user interaction. For example, dragging the sub-widget to one side to get to a different sub-widget (like an smartphone home screen).
- Such user interactions should end up setting a new @Efl.Ui.Spotlight.Container.active_index.
+ Such user interactions should end up setting a new @Efl.Ui.Spotlight.Container.active_element.
During a transition, the evolution of the current position should be exposed by emitting $pos_update events.
]]
methods {
@@ -17,22 +17,14 @@ abstract @beta Efl.Ui.Spotlight.Manager extends Efl.Object {
}
}
content_add @pure_virtual {
- [[A $subobj has been added at position $index in the bound container.
-
- The manager should check the container's @Efl.Ui.Spotlight.Container.active_index since indices might have
- shifted due to the insertion of the new object.
- ]]
+ [[A $subobj has been added at position $index in the bound container.]]
params {
subobj : Efl.Gfx.Entity; [[The new object that has been added to the container.]]
index : int; [[The index of the new object in the container's list.]]
}
}
content_del @pure_virtual {
- [[The $subobj at position $index in the bound container has been removed.
-
- The manager should check the container's @Efl.Ui.Spotlight.Container.active_index since indices might have
- shifted due to the removal of the object.
- ]]
+ [[The $subobj at position $index in the bound container has been removed.]]
params {
subobj : Efl.Gfx.Entity; [[The object being removed from the container.]]
index : int; [[The index this object had in the container's list.]]
diff --git a/src/lib/elementary/efl_ui_spotlight_manager_plain.c b/src/lib/elementary/efl_ui_spotlight_manager_plain.c
index 5bbb5238f4..ec7c3a2782 100644
--- a/src/lib/elementary/efl_ui_spotlight_manager_plain.c
+++ b/src/lib/elementary/efl_ui_spotlight_manager_plain.c
@@ -10,8 +10,9 @@ typedef struct {
Efl_Ui_Spotlight_Container * container;
Efl_Gfx_Entity *group;
Eina_Size2D page_size;
- int current_content;
+ Efl_Ui_Widget *current_content;
Eina_Bool animation;
+ double last_pos;
} Efl_Ui_Spotlight_Manager_Plain_Data;
#define MY_CLASS EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS
@@ -19,14 +20,17 @@ typedef struct {
static void
_emit_position(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd)
{
- double absolut_position = pd->current_content;
- efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &absolut_position);
+ double absolut_position = efl_pack_index_get(pd->container, pd->current_content);
+ if (pd->last_pos != absolut_position)
+ efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &absolut_position);
+
+ pd->last_pos = absolut_position;
}
static void
_geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd)
{
- Efl_Gfx_Entity *entity = efl_pack_content_get(pd->container, pd->current_content);
+ Efl_Gfx_Entity *entity = pd->current_content;
Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->group);
Eina_Rect goal = EINA_RECT_EMPTY();
@@ -58,7 +62,7 @@ _efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Sp
{
if (spotlight && group)
{
- int index;
+ Efl_Ui_Widget *index;
pd->container = spotlight;
pd->group = group;
@@ -70,11 +74,11 @@ _efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Sp
efl_canvas_group_member_add(pd->group, elem);
efl_gfx_entity_visible_set(elem, EINA_FALSE);
}
- index = efl_ui_spotlight_active_index_get(spotlight);
- if (index != -1)
+ index = efl_ui_spotlight_active_element_get(spotlight);
+ if (index)
{
pd->current_content = index;
- efl_gfx_entity_visible_set(efl_pack_content_get(pd->container, pd->current_content), EINA_TRUE);
+ efl_gfx_entity_visible_set(pd->current_content, EINA_TRUE);
_geom_sync(obj, pd);
_emit_position(obj, pd);
}
@@ -84,15 +88,15 @@ _efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Sp
static void
_content_changed(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd)
{
- if (efl_ui_spotlight_active_index_get(pd->container) != pd->current_content)
+ if (efl_ui_spotlight_active_element_get(pd->container) != pd->current_content)
{
- int old_current_content = pd->current_content;
- pd->current_content = efl_ui_spotlight_active_index_get(pd->container);
- efl_gfx_entity_visible_set(efl_pack_content_get(pd->container, old_current_content), EINA_FALSE);
- efl_gfx_entity_visible_set(efl_pack_content_get(pd->container, pd->current_content), EINA_TRUE);
+ Efl_Ui_Widget *old_current_content = pd->current_content;
+ pd->current_content = efl_ui_spotlight_active_element_get(pd->container);
+ efl_gfx_entity_visible_set(old_current_content, EINA_FALSE);
+ efl_gfx_entity_visible_set(pd->current_content, EINA_TRUE);
_geom_sync(obj, pd);
- _emit_position(obj, pd);
}
+ _emit_position(obj, pd);
}
EOLIAN static void
@@ -118,13 +122,13 @@ _efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl_
if (from_obj)
{
efl_gfx_entity_visible_set(from_obj, EINA_FALSE);
- pd->current_content = -1;
+ pd->current_content = NULL;
}
if (to_obj)
{
efl_gfx_entity_visible_set(to_obj, EINA_TRUE);
- pd->current_content = to;
+ pd->current_content = efl_pack_content_get(pd->container, to);
}
_emit_position(obj, pd);
diff --git a/src/lib/elementary/efl_ui_spotlight_manager_scroll.c b/src/lib/elementary/efl_ui_spotlight_manager_scroll.c
index bd0000faa8..e75c3f955f 100644
--- a/src/lib/elementary/efl_ui_spotlight_manager_scroll.c
+++ b/src/lib/elementary/efl_ui_spotlight_manager_scroll.c
@@ -45,7 +45,7 @@ _apply_box_properties(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd)
if (pd->transition.active)
current_pos = pd->transition.from + ((double)pd->transition.to - pd->transition.from)*pd->transition.progress;
else
- current_pos = efl_ui_spotlight_active_index_get(pd->container);
+ current_pos = efl_pack_index_get(pd->container, efl_ui_spotlight_active_element_get(pd->container));
efl_gfx_entity_geometry_set(pd->foreclip, group_pos);
//first calculate the size
@@ -106,7 +106,7 @@ _mouse_down_cb(void *data,
efl_event_callback_del(pd->container, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _page_set_animation, obj);
pd->mouse_move.active = EINA_TRUE;
- pd->mouse_move.from = efl_ui_spotlight_active_index_get(pd->container);
+ pd->mouse_move.from = efl_pack_index_get(pd->container, efl_ui_spotlight_active_element_get(pd->container));
pd->mouse_move.mouse_start = efl_input_pointer_position_get(ev);
pd->transition.from = pd->mouse_move.from;
@@ -158,7 +158,8 @@ _mouse_up_cb(void *data,
double absolut_current_position = (double)pd->transition.from + pd->transition.progress;
int result = round(absolut_current_position);
- efl_ui_spotlight_active_index_set(pd->container, MIN(MAX(result, 0), efl_content_count(pd->container) - 1));
+ Efl_Ui_Widget *new_content = efl_pack_content_get(pd->container, MIN(MAX(result, 0), efl_content_count(pd->container) - 1));
+ efl_ui_spotlight_active_element_set(pd->container, new_content);
}
EFL_CALLBACKS_ARRAY_DEFINE(mouse_listeners,
diff --git a/src/lib/elementary/efl_ui_spotlight_manager_stack.c b/src/lib/elementary/efl_ui_spotlight_manager_stack.c
index dbef2c200d..18756c0d5f 100644
--- a/src/lib/elementary/efl_ui_spotlight_manager_stack.c
+++ b/src/lib/elementary/efl_ui_spotlight_manager_stack.c
@@ -151,9 +151,9 @@ _efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Sp
efl_canvas_group_member_add(pd->group, elem);
efl_gfx_entity_visible_set(elem, EINA_FALSE);
}
- if (efl_ui_spotlight_active_index_get(spotlight) != -1)
+ if (efl_ui_spotlight_active_element_get(spotlight))
{
- pd->content = efl_pack_content_get(pd->container, efl_ui_spotlight_active_index_get(spotlight));
+ pd->content = efl_ui_spotlight_active_element_get(spotlight);
efl_gfx_entity_visible_set(pd->content, EINA_TRUE);
_geom_sync(obj, pd);
}
diff --git a/src/lib/elementary/efl_ui_tab_pager.c b/src/lib/elementary/efl_ui_tab_pager.c
index f1a3dc4059..745a1dcb72 100644
--- a/src/lib/elementary/efl_ui_tab_pager.c
+++ b/src/lib/elementary/efl_ui_tab_pager.c
@@ -12,24 +12,21 @@
#define MY_CLASS EFL_UI_TAB_PAGER_CLASS
static void
-_select(Eo *obj, int index)
+_select(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Page *page)
{
- Efl_Ui_Tab_Page *page = efl_pack_content_get(obj, index);
-
efl_ui_selectable_selected_set(efl_ui_tab_page_tab_bar_item_get(page), EINA_TRUE);
}
static void
_tab_select_cb(void *data, const Efl_Event *event)
{
- EFL_UI_TAB_PAGER_DATA_GET(data, sd);
Efl_Ui_Tab_Bar_Default_Item *selected;
- int i = 0;
+ Efl_Ui_Tab_Page *page;
selected = efl_ui_single_selectable_last_selected_get(event->object);
- i = efl_pack_index_get(sd->tab_bar, selected);
- if (efl_ui_spotlight_active_index_get(data) != i)
- efl_ui_spotlight_active_index_set(data, i);
+ page = efl_parent_get(selected);
+ if (efl_ui_spotlight_active_element_get(data))
+ efl_ui_spotlight_active_element_set(data, page);
}
EOLIAN static Efl_Canvas_Object *
@@ -39,10 +36,10 @@ _efl_ui_tab_pager_tab_bar_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *
}
EOLIAN static void
-_efl_ui_tab_pager_efl_ui_spotlight_container_active_index_set(Eo *obj, Efl_Ui_Tab_Pager_Data *sd EINA_UNUSED, int index)
+_efl_ui_tab_pager_efl_ui_spotlight_container_active_element_set(Eo *obj, Efl_Ui_Tab_Pager_Data *sd EINA_UNUSED, Efl_Ui_Widget *element)
{
- efl_ui_spotlight_active_index_set(efl_super(obj, MY_CLASS), index);
- _select(obj, index);
+ efl_ui_spotlight_active_element_set(efl_super(obj, MY_CLASS), element);
+ _select(obj, element);
}
EOLIAN static void
diff --git a/src/lib/elementary/efl_ui_tab_pager.eo b/src/lib/elementary/efl_ui_tab_pager.eo
index e6b10757e6..9efb40c753 100644
--- a/src/lib/elementary/efl_ui_tab_pager.eo
+++ b/src/lib/elementary/efl_ui_tab_pager.eo
@@ -24,6 +24,6 @@ class @beta Efl.Ui.Tab_Pager extends Efl.Ui.Spotlight.Container
Efl.Pack_Linear.pack_after;
Efl.Pack_Linear.pack_at;
Efl.Pack_Linear.pack_unpack_at;
- Efl.Ui.Spotlight.Container.active_index { set; }
+ Efl.Ui.Spotlight.Container.active_element { set; }
}
}
diff --git a/src/tests/elementary/efl_ui_test_spotlight.c b/src/tests/elementary/efl_ui_test_spotlight.c
index 0bad5c362f..9749258273 100644
--- a/src/tests/elementary/efl_ui_test_spotlight.c
+++ b/src/tests/elementary/efl_ui_test_spotlight.c
@@ -21,13 +21,13 @@ typedef struct {
int called;
Efl_Gfx_Entity *subobj;
int index;
- int current_page_at_call;
+ Efl_Ui_Widget *current_page_at_call;
} content_del;
struct {
int called;
Efl_Gfx_Entity *subobj;
int index;
- int current_page_at_call;
+ Efl_Ui_Widget *current_page_at_call;
} content_add;
struct {
int called;
@@ -43,7 +43,7 @@ _indicator_content_del(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Gfx_Entity
indicator_calls.content_del.called ++;
indicator_calls.content_del.subobj = subobj;
indicator_calls.content_del.index = index;
- indicator_calls.content_del.current_page_at_call = efl_ui_spotlight_active_index_get(container);
+ indicator_calls.content_del.current_page_at_call = efl_ui_spotlight_active_element_get(container);
}
static void
@@ -52,7 +52,7 @@ _indicator_content_add(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Gfx_Entity
indicator_calls.content_add.called ++;
indicator_calls.content_add.subobj = subobj;
indicator_calls.content_add.index = index;
- indicator_calls.content_add.current_page_at_call = efl_ui_spotlight_active_index_get(container);
+ indicator_calls.content_add.current_page_at_call = efl_ui_spotlight_active_element_get(container);
}
static void
@@ -92,13 +92,13 @@ typedef struct {
int called;
Efl_Gfx_Entity *subobj;
int index;
- int current_page_at_call;
+ Efl_Ui_Widget *current_page_at_call;
} content_del;
struct {
int called;
Efl_Gfx_Entity *subobj;
int index;
- int current_page_at_call;
+ Efl_Ui_Widget *current_page_at_call;
} content_add;
struct {
int called;
@@ -125,7 +125,9 @@ Transition_Calls transition_calls = { 0 };
static void
_emit_pos(Eo *obj, double d)
{
+ printf("EMITTING %f %f\n", d, transition_calls.last_position);
if (d == transition_calls.last_position) return;
+
efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &d);
transition_calls.last_position = d;
}
@@ -136,9 +138,9 @@ _transition_content_add(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Gfx_Entit
transition_calls.content_add.called ++;
transition_calls.content_add.subobj = subobj;
transition_calls.content_add.index = index;
- transition_calls.content_add.current_page_at_call = efl_ui_spotlight_active_index_get(container);
+ transition_calls.content_add.current_page_at_call = efl_ui_spotlight_active_element_get(container);
- int i = efl_ui_spotlight_active_index_get(container);
+ int i = efl_pack_index_get(container, efl_ui_spotlight_active_element_get(container));
if (i != -1)
_emit_pos(obj, i);
}
@@ -149,9 +151,9 @@ _transition_content_del(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Gfx_Entit
transition_calls.content_del.called ++;
transition_calls.content_del.subobj = subobj;
transition_calls.content_del.index = index;
- transition_calls.content_del.current_page_at_call = efl_ui_spotlight_active_index_get(container);
+ transition_calls.content_del.current_page_at_call = efl_ui_spotlight_active_element_get(container);
- int i = efl_ui_spotlight_active_index_get(container);
+ int i = efl_pack_index_get(container, efl_ui_spotlight_active_element_get(container));
if (i != -1)
_emit_pos(obj, i);
}
@@ -224,7 +226,7 @@ EFL_START_TEST (efl_ui_spotlight_init)
Eina_Size2D s = efl_ui_spotlight_size_get(container);
ck_assert_int_eq(s.w, 0); //FIXME
ck_assert_int_eq(s.h, 0); //FIXME
- ck_assert_int_eq(efl_ui_spotlight_active_index_get(container), -1);
+ ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), NULL);
}
EFL_END_TEST
@@ -232,17 +234,23 @@ EFL_START_TEST (efl_ui_spotlight_active_index)
{
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
efl_pack(container, w);
- ck_assert_int_eq(efl_ui_spotlight_active_index_get(container), 0);
- for (int i = -20; i < 20; ++i)
- {
- if (i == 0) continue;
- EXPECT_ERROR_START;
- efl_ui_spotlight_active_index_set(container, i);
- EXPECT_ERROR_END;
- }
+ ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
+ EXPECT_ERROR_START;
+ efl_ui_spotlight_active_element_set(container, 0x0);
+ EXPECT_ERROR_END;
+ ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
+ EXPECT_ERROR_START;
+ efl_ui_spotlight_active_element_set(container, (void*)0xAFFE);
+ EXPECT_ERROR_END;
+ ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
+ EXPECT_ERROR_START;
+ efl_ui_spotlight_active_element_set(container, efl_main_loop_get());
+ EXPECT_ERROR_END;
+ ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
+
efl_del(w);
- ck_assert_int_eq(efl_ui_spotlight_active_index_get(container), -1);
+ ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), NULL);
}
EFL_END_TEST
@@ -280,7 +288,7 @@ EFL_START_TEST (efl_ui_smart_transition_calls)
ck_assert_int_eq(transition_calls.content_add.called, 1);
ck_assert_int_eq(transition_calls.content_add.index, 0);
ck_assert_ptr_eq(transition_calls.content_add.subobj, w);
- ck_assert_int_eq(transition_calls.content_add.current_page_at_call, -1);
+ ck_assert_ptr_eq(transition_calls.content_add.current_page_at_call, NULL);
ck_assert_int_eq(transition_calls.content_del.called, 0);
transition_calls.content_add.called = 0;
transition_calls.request_switch.called = 0;
@@ -293,11 +301,11 @@ EFL_START_TEST (efl_ui_smart_transition_calls)
ck_assert_int_eq(transition_calls.content_add.called, 1);
ck_assert_int_eq(transition_calls.content_add.index, 0);
ck_assert_ptr_eq(transition_calls.content_add.subobj, w1);
- ck_assert_int_eq(transition_calls.content_add.current_page_at_call, 1);
+ ck_assert_ptr_eq(transition_calls.content_add.current_page_at_call, w);
ck_assert_int_eq(transition_calls.content_del.called, 0);
transition_calls.content_add.called = 0;
transition_calls.request_switch.called = 0;
- ck_assert_int_eq(efl_ui_spotlight_active_index_get(container), 1);
+ ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
//new object, must update the content and a not update current page
efl_pack_end(container, w2);
@@ -307,13 +315,13 @@ EFL_START_TEST (efl_ui_smart_transition_calls)
ck_assert_int_eq(transition_calls.content_add.called, 1);
ck_assert_int_eq(transition_calls.content_add.index, 2);
ck_assert_ptr_eq(transition_calls.content_add.subobj, w2);
- ck_assert_int_eq(transition_calls.content_add.current_page_at_call, 1);
+ ck_assert_ptr_eq(transition_calls.content_add.current_page_at_call, w);
ck_assert_int_eq(transition_calls.content_del.called, 0);
transition_calls.content_add.called = 0;
- ck_assert_int_eq(efl_ui_spotlight_active_index_get(container), 1);
+ ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
//page change must result in a call to request a switch
- efl_ui_spotlight_active_index_set(container, 2);
+ efl_ui_spotlight_active_element_set(container, w2);
ck_assert_int_eq(transition_calls.spotlight.called, 0);
ck_assert_int_eq(transition_calls.page_size.called, 0);
ck_assert_int_eq(transition_calls.request_switch.called, 1);
@@ -332,7 +340,7 @@ EFL_START_TEST (efl_ui_smart_transition_calls)
ck_assert_int_eq(transition_calls.content_del.called, 1);
ck_assert_int_eq(transition_calls.content_del.index, 1);
ck_assert_ptr_eq(transition_calls.content_del.subobj, w);
- ck_assert_int_eq(transition_calls.content_del.current_page_at_call, 1);
+ ck_assert_ptr_eq(transition_calls.content_del.current_page_at_call, w2);
transition_calls.content_del.called = 0;
}
EFL_END_TEST
@@ -486,7 +494,7 @@ _verify_transition_start_end_events(void)
ck_assert_int_eq(end.from, -8);
EV_RESET
- efl_ui_spotlight_active_index_set(container, 2);
+ efl_ui_spotlight_active_element_set(container, w2);
ck_assert_int_eq(start.to, 2);
ck_assert_int_eq(end.to, 2);
ck_assert_int_eq(start.from, 1);
@@ -511,7 +519,7 @@ EFL_START_TEST (efl_ui_spotlight_test_push1)
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
efl_ui_spotlight_push(container, w);
ck_assert_int_eq(efl_pack_index_get(container, w), 0);
- ck_assert_int_eq(efl_ui_spotlight_active_index_get(container), 0);
+ ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), efl_pack_content_get(container, 0));
}
EFL_END_TEST
@@ -521,13 +529,13 @@ EFL_START_TEST (efl_ui_spotlight_test_push2)
{
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
efl_pack_end(container, w);
+ if (i == 3)
+ efl_ui_spotlight_active_element_set(container, w);
}
- efl_ui_spotlight_active_index_set(container, 3);
-
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
efl_ui_spotlight_push(container, w);
ck_assert_int_eq(efl_pack_index_get(container, w), 3);
- ck_assert_int_eq(efl_ui_spotlight_active_index_get(container), 3);
+ ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
}
EFL_END_TEST
@@ -590,16 +598,17 @@ EFL_START_TEST (efl_ui_spotlight_test_pop3)
{
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
efl_pack_end(container, w);
+ if (i == 3)
+ efl_ui_spotlight_active_element_set(container, w);
}
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
- efl_ui_spotlight_active_index_set(container, 3);
efl_ui_spotlight_push(container, w);
Eina_Future *f = efl_ui_spotlight_pop(container, EINA_TRUE);
for (int i = 0; i < 10; ++i)
{
efl_loop_iterate(efl_provider_find(container, EFL_LOOP_CLASS));
}
- ck_assert_int_eq(efl_ui_spotlight_active_index_get(container), 3);
+ ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), efl_pack_content_get(container, 3));
ck_assert_int_eq(efl_ref_count(w), 0);
ck_assert_int_eq(efl_content_count(container), 5);
ck_assert_ptr_ne(f, NULL);