elementary: rename Activew_View to Spotlight.

View is something that is expected in the context of MVVM, so using it somewhere else is
going to lead to some confusion. Spotlight does descrive the objective of all of this
widget in actually a more explicit way as they all give the spotlight to one sub widget
at a time.

I have also renamed the View_Manager to be just Manager as the View there wasn't useful.
This commit is contained in:
Cedric BAIL 2019-07-04 16:02:43 -07:00 committed by Xavi Artigas
parent faaba156ab
commit 47c5736ef9
38 changed files with 698 additions and 698 deletions

View File

@ -98,7 +98,7 @@ elementary_test_src = [
'test_panes.c',
'test_ui_panes.c',
'test_ui_panel.c',
'test_ui_active_view.c',
'test_ui_spotlight.c',
'test_ui_radio.c',
'test_part_bg.c',
'test_part_shadow.c',

View File

@ -386,9 +386,9 @@ void test_efl_anim_interpolator(void *data, Evas_Object *obj, void *event_info);
void test_gesture_framework(void *data, Evas_Object *obj, void *event_info);
void test_ui_tab_pager(void *data, Evas_Object *obj, void *event_info);
void test_ui_active_view_stack(void *data, Evas_Object *obj, void *event_info);
void test_ui_active_view_plain(void *data, Evas_Object *obj, void *event_info);
void test_ui_active_view_scroll(void *data, Evas_Object *obj, void *event_info);
void test_ui_spotlight_stack(void *data, Evas_Object *obj, void *event_info);
void test_ui_spotlight_plain(void *data, Evas_Object *obj, void *event_info);
void test_ui_spotlight_scroll(void *data, Evas_Object *obj, void *event_info);
void test_ui_relative_layout(void *data, Evas_Object *obj, void *event_info);
void test_efl_ui_radio(void *data, Evas_Object *obj, void *event_info);
@ -1117,10 +1117,10 @@ add_tests:
//------------------------------//
ADD_TEST_EO(NULL, "Tab Pager", "Efl.Ui.Tab_Pager", test_ui_tab_pager);
ADD_TEST_EO(NULL, "Active View", "Efl.Ui.Active_View Plain", test_ui_active_view_plain);
ADD_TEST_EO(NULL, "Active View", "Efl.Ui.Active_View Scroll", test_ui_active_view_scroll);
ADD_TEST_EO(NULL, "Active View", "Efl.Ui.Active_View Stack", test_ui_active_view_stack);
ADD_TEST_EO(NULL, "Active View", "Navigation stack", test_ui_stack);
ADD_TEST_EO(NULL, "Spotlight", "Efl.Ui.Spotlight Plain", test_ui_spotlight_plain);
ADD_TEST_EO(NULL, "Spotlight", "Efl.Ui.Spotlight Scroll", test_ui_spotlight_scroll);
ADD_TEST_EO(NULL, "Spotlight", "Efl.Ui.Spotlight Stack", test_ui_spotlight_stack);
ADD_TEST_EO(NULL, "Spotlight", "Navigation stack", test_ui_stack);
//------------------------------//
ADD_TEST(NULL, "Popups", "Ctxpopup", test_ctxpopup);
ADD_TEST(NULL, "Popups", "Hover", test_hover);

View File

@ -28,7 +28,7 @@ typedef enum _Pack_Type
typedef struct _Params
{
Evas_Object *navi;
Eo *active_view;
Eo *spotlight;
Eo *indicator;
int w, h;
Eina_Bool wfill, hfill;
@ -36,14 +36,14 @@ typedef struct _Params
typedef struct _Page_Set_Params
{
Eo *active_view;
Eo *spotlight;
Eo *spinner;
} Page_Set_Params;
typedef struct _Pack_Params
{
Pack_Type type;
Eo *active_view;
Eo *spotlight;
Eo *pack_sp;
Eo *unpack_sp;
Eo *unpack_btn;
@ -51,7 +51,7 @@ typedef struct _Pack_Params
typedef struct _Size_Params
{
Eo *active_view;
Eo *spotlight;
Eo *slider;
Params *params;
} Size_Params;
@ -116,21 +116,21 @@ view_add(View_Type p, Eo *parent)
static void
prev_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *active_view = data;
int active_index = efl_ui_active_view_active_index_get(active_view);
Eo *spotlight = data;
int active_index = efl_ui_spotlight_active_index_get(spotlight);
if (active_index - 1 > -1)
efl_ui_active_view_active_index_set(active_view, active_index - 1);
efl_ui_spotlight_active_index_set(spotlight, active_index - 1);
}
static void
next_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *active_view = data;
int active_index = efl_ui_active_view_active_index_get(active_view);
Eo *spotlight = data;
int active_index = efl_ui_spotlight_active_index_get(spotlight);
if (active_index + 1 < efl_content_count(active_view))
efl_ui_active_view_active_index_set(active_view, active_index + 1);
if (active_index + 1 < efl_content_count(spotlight))
efl_ui_spotlight_active_index_set(spotlight, active_index + 1);
}
static void
@ -155,7 +155,7 @@ width_slider_cb(void *data, const Efl_Event *ev)
else h = params->h;
params->w = efl_ui_range_value_get(ev->object);
efl_ui_active_view_size_set(params->active_view, EINA_SIZE2D(params->w, h));
efl_ui_spotlight_size_set(params->spotlight, EINA_SIZE2D(params->w, h));
}
static void
@ -168,7 +168,7 @@ height_slider_cb(void *data, const Efl_Event *ev)
else w = params->w;
params->h = efl_ui_range_value_get(ev->object);
efl_ui_active_view_size_set(params->active_view, EINA_SIZE2D(w, params->h));
efl_ui_spotlight_size_set(params->spotlight, EINA_SIZE2D(w, params->h));
}
static void
@ -188,7 +188,7 @@ width_check_cb(void *data, const Efl_Event *ev)
if (params->params->hfill) h = -1;
else h = params->params->h;
efl_ui_active_view_size_set(params->active_view, EINA_SIZE2D(w, h));
efl_ui_spotlight_size_set(params->spotlight, EINA_SIZE2D(w, h));
}
static void
@ -208,7 +208,7 @@ height_check_cb(void *data, const Efl_Event *ev)
if (params->params->hfill) h = -1;
else h = params->params->h;
efl_ui_active_view_size_set(params->active_view, EINA_SIZE2D(w, h));
efl_ui_spotlight_size_set(params->spotlight, EINA_SIZE2D(w, h));
}
static void
@ -221,30 +221,30 @@ static void
pack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Pack_Params *param = data;
Eo *active_view = param->active_view;
Eo *spotlight = param->spotlight;
Eo *page = NULL, *curr_page;
int index, cnt;
if ((param->type != UNPACK_AT) && (param->type != CLEAR))
{
index = efl_content_count(active_view);
index = efl_content_count(spotlight);
switch (index % 3)
{
case 0:
page = view_add(LAYOUT, active_view);
page = view_add(LAYOUT, spotlight);
break;
case 1:
page = view_add(LIST, active_view);
page = view_add(LIST, spotlight);
break;
case 2:
page = view_add(BUTTON, active_view);
page = view_add(BUTTON, spotlight);
break;
default:
page = view_add(LAYOUT, active_view);
page = view_add(LAYOUT, spotlight);
break;
}
}
@ -252,42 +252,42 @@ pack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
switch (param->type)
{
case PACK_BEGIN:
efl_pack_begin(active_view, page);
efl_pack_begin(spotlight, page);
break;
case PACK_END:
efl_pack_end(active_view, page);
efl_pack_end(spotlight, page);
break;
case PACK_BEFORE:
index = efl_ui_active_view_active_index_get(active_view);
curr_page = efl_pack_content_get(active_view, index);
efl_pack_before(active_view, page, curr_page);
index = efl_ui_spotlight_active_index_get(spotlight);
curr_page = efl_pack_content_get(spotlight, index);
efl_pack_before(spotlight, page, curr_page);
break;
case PACK_AFTER:
index = efl_ui_active_view_active_index_get(active_view);
curr_page = efl_pack_content_get(active_view, index);
efl_pack_after(active_view, page, curr_page);
index = efl_ui_spotlight_active_index_get(spotlight);
curr_page = efl_pack_content_get(spotlight, index);
efl_pack_after(spotlight, page, curr_page);
break;
case PACK_AT:
index = efl_ui_range_value_get(param->pack_sp);
efl_pack_at(active_view, page, index);
efl_pack_at(spotlight, page, index);
break;
case UNPACK_AT:
index = efl_ui_range_value_get(param->unpack_sp);
page = efl_pack_unpack_at(active_view, index);
page = efl_pack_unpack_at(spotlight, index);
efl_del(page);
break;
case CLEAR:
efl_pack_clear(active_view);
efl_pack_clear(spotlight);
break;
}
cnt = efl_content_count(active_view);
cnt = efl_content_count(spotlight);
index = efl_ui_range_value_get(param->pack_sp);
if (index > cnt)
@ -323,7 +323,7 @@ page_set_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Page_Set_Params *psp = data;
efl_ui_active_view_active_index_set(psp->active_view,
efl_ui_spotlight_active_index_set(psp->spotlight,
efl_ui_range_value_get(psp->spinner));
}
@ -338,19 +338,19 @@ indicator_icon_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Params *params = data;
params->indicator = efl_add(EFL_UI_ACTIVE_VIEW_INDICATOR_ICON_CLASS, params->active_view);
efl_ui_active_view_indicator_set(params->active_view, params->indicator);
params->indicator = efl_add(EFL_UI_SPOTLIGHT_INDICATOR_ICON_CLASS, params->spotlight);
efl_ui_spotlight_indicator_set(params->spotlight, params->indicator);
}
static void
indicator_none_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Params *params = data;
efl_ui_active_view_indicator_set(params->active_view, NULL);
efl_ui_spotlight_indicator_set(params->spotlight, NULL);
}
static void
active_view_size(void *data,
spotlight_size(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
@ -396,7 +396,7 @@ active_view_size(void *data,
if (!size_params) return;
size_params->slider = sl;
size_params->active_view = params->active_view;
size_params->spotlight = params->spotlight;
size_params->params = params;
efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, width_check_cb,
@ -437,7 +437,7 @@ active_view_size(void *data,
if (!size_params) return;
size_params->slider = sl;
size_params->active_view = params->active_view;
size_params->spotlight = params->spotlight;
size_params->params = params;
efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, height_check_cb,
@ -456,7 +456,7 @@ _animation_cb(void *data, const Efl_Event *ev)
{
Params *params = data;
efl_ui_active_view_view_manager_animation_enabled_set(efl_ui_active_view_manager_get(params->active_view), efl_ui_check_selected_get(ev->object));
efl_ui_spotlight_manager_animation_enabled_set(efl_ui_spotlight_manager_get(params->spotlight), efl_ui_check_selected_get(ev->object));
}
static void
@ -479,7 +479,7 @@ view_animation_cb(void *data,
ck = efl_add(EFL_UI_CHECK_CLASS, box);
efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _animation_cb, params);
efl_ui_check_selected_set(ck, efl_ui_active_view_view_manager_animation_enabled_get(efl_ui_active_view_manager_get(params->active_view)));
efl_ui_check_selected_set(ck, efl_ui_spotlight_manager_animation_enabled_get(efl_ui_spotlight_manager_get(params->spotlight)));
efl_text_set(ck, "Animation");
efl_pack_end(box, ck);
efl_gfx_entity_visible_set(ck, 1);
@ -492,7 +492,7 @@ pack_cb(void *data,
{
Params *params = (Params *)data;
Evas_Object *navi = params->navi;
Eo *active_view = params->active_view;
Eo *spotlight = params->spotlight;
Eo *btn, *box, *in_box1, *in_box2, *sp1, *sp2;
Pack_Params *pack_param;
@ -512,9 +512,9 @@ pack_cb(void *data,
sp1 = efl_add(EFL_UI_SPIN_BUTTON_CLASS, in_box1,
efl_ui_range_limits_set(efl_added, 0,
efl_content_count(active_view)),
efl_content_count(spotlight)),
efl_ui_range_value_set(efl_added,
efl_ui_active_view_active_index_get(active_view)));
efl_ui_spotlight_active_index_get(spotlight)));
in_box2 = efl_add(EFL_UI_BOX_CLASS, box,
efl_gfx_arrangement_content_padding_set(efl_added, 10, 10, EINA_TRUE),
@ -529,7 +529,7 @@ pack_cb(void *data,
pack_param = calloc(1, sizeof(Pack_Params));
if (!pack_param) return;
pack_param->active_view = active_view;
pack_param->spotlight = spotlight;
pack_param->pack_sp = sp1;
pack_param->unpack_sp = sp2;
pack_param->unpack_btn = btn;
@ -547,7 +547,7 @@ pack_cb(void *data,
pack_param = calloc(1, sizeof(Pack_Params));
if (!pack_param) return;
pack_param->active_view = active_view;
pack_param->spotlight = spotlight;
pack_param->pack_sp = sp1;
pack_param->unpack_sp = sp2;
pack_param->unpack_btn = btn;
@ -565,7 +565,7 @@ pack_cb(void *data,
pack_param = calloc(1, sizeof(Pack_Params));
if (!pack_param) return;
pack_param->active_view = active_view;
pack_param->spotlight = spotlight;
pack_param->pack_sp = sp1;
pack_param->unpack_sp = sp2;
pack_param->unpack_btn = btn;
@ -583,7 +583,7 @@ pack_cb(void *data,
pack_param = calloc(1, sizeof(Pack_Params));
if (!pack_param) return;
pack_param->active_view = active_view;
pack_param->spotlight = spotlight;
pack_param->pack_sp = sp1;
pack_param->unpack_sp = sp2;
pack_param->unpack_btn = btn;
@ -601,7 +601,7 @@ pack_cb(void *data,
pack_param = calloc(1, sizeof(Pack_Params));
if (!pack_param) return;
pack_param->active_view = active_view;
pack_param->spotlight = spotlight;
pack_param->pack_sp = sp1;
pack_param->unpack_sp = sp2;
pack_param->unpack_btn = btn;
@ -622,7 +622,7 @@ pack_cb(void *data,
pack_param = calloc(1, sizeof(Pack_Params));
if (!pack_param) return;
pack_param->active_view = active_view;
pack_param->spotlight = spotlight;
pack_param->pack_sp = sp1;
pack_param->unpack_sp = sp2;
pack_param->unpack_btn = btn;
@ -633,12 +633,12 @@ pack_cb(void *data,
efl_event_callback_add(btn, EFL_EVENT_DEL,
pack_btn_del_cb, pack_param);
if (efl_content_count(active_view) > 0)
if (efl_content_count(spotlight) > 0)
{
efl_ui_range_limits_set(sp2, 0,
(efl_content_count(active_view) - 1));
(efl_content_count(spotlight) - 1));
efl_ui_range_value_set(sp2,
efl_ui_active_view_active_index_get(active_view));
efl_ui_spotlight_active_index_get(spotlight));
}
else
{
@ -654,7 +654,7 @@ pack_cb(void *data,
pack_param = calloc(1, sizeof(Pack_Params));
if (!pack_param) return;
pack_param->active_view = active_view;
pack_param->spotlight = spotlight;
pack_param->pack_sp = sp1;
pack_param->unpack_sp = sp2;
pack_param->unpack_btn = btn;
@ -676,7 +676,7 @@ active_index_cb(void *data,
{
Params *params = (Params *)data;
Evas_Object *navi = params->navi;
Eo *active_view = params->active_view;
Eo *spotlight = params->spotlight;
Eo *btn, *box, *sp;
Page_Set_Params *psp = calloc(1, sizeof(Page_Set_Params));
if (!psp) return;
@ -699,12 +699,12 @@ active_index_cb(void *data,
efl_gfx_hint_align_set(efl_added, -1, -1),
efl_pack_end(box, efl_added));
if (efl_content_count(active_view) > 0)
if (efl_content_count(spotlight) > 0)
{
efl_ui_range_limits_set(sp, 0,
(efl_content_count(active_view) - 1));
(efl_content_count(spotlight) - 1));
efl_ui_range_value_set(sp,
efl_ui_active_view_active_index_get(active_view));
efl_ui_spotlight_active_index_get(spotlight));
}
else
{
@ -712,7 +712,7 @@ active_index_cb(void *data,
elm_object_disabled_set(sp, EINA_TRUE);
}
psp->active_view = active_view;
psp->spotlight = spotlight;
psp->spinner = sp;
efl_event_callback_add(btn, EFL_UI_EVENT_CLICKED, page_set_btn_cb, psp);
@ -752,18 +752,18 @@ indicator_cb(void *data,
}
void
test_ui_active_view_stack(void *data EINA_UNUSED,
test_ui_spotlight_stack(void *data EINA_UNUSED,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Eo *win, *panes, *navi, *list, *layout, *active_view, *view;
Eo *win, *panes, *navi, *list, *layout, *spotlight, *view;
Params *params = NULL;
char buf[PATH_MAX];
int i;
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
efl_text_set(efl_added, "Efl.Ui.Active_View Stack"),
efl_text_set(efl_added, "Efl.Ui.Spotlight Stack"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
panes = efl_add(EFL_UI_PANES_CLASS, win,
@ -789,36 +789,36 @@ test_ui_active_view_stack(void *data EINA_UNUSED,
efl_file_load(efl_added),
efl_content_set(efl_part(panes, "second"), efl_added));
active_view = efl_add(EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS, layout,
spotlight = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, layout,
efl_content_set(efl_part(layout, "pager"), efl_added),
efl_ui_active_view_size_set(efl_added, EINA_SIZE2D(200, 300)));
efl_ui_spotlight_size_set(efl_added, EINA_SIZE2D(200, 300)));
efl_ui_active_view_manager_set(active_view, efl_new(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_STACK_CLASS));
efl_ui_spotlight_manager_set(spotlight, efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS));
efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "Prev"),
efl_event_callback_add(efl_added,
EFL_UI_EVENT_CLICKED, prev_btn_cb, active_view),
EFL_UI_EVENT_CLICKED, prev_btn_cb, spotlight),
efl_content_set(efl_part(layout, "prev_btn"), efl_added));
efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "Next"),
efl_event_callback_add(efl_added,
EFL_UI_EVENT_CLICKED, next_btn_cb, active_view),
EFL_UI_EVENT_CLICKED, next_btn_cb, spotlight),
efl_content_set(efl_part(layout, "next_btn"), efl_added));
params = calloc(1, sizeof(Params));
if (!params) return;
params->navi = navi;
params->active_view = active_view;
params->spotlight = spotlight;
params->indicator = NULL;
params->w = 200;
params->h = 300;
params->wfill = EINA_FALSE;
params->hfill = EINA_FALSE;
elm_list_item_append(list, "View Size", NULL, NULL, active_view_size, params);
elm_list_item_append(list, "View Size", NULL, NULL, spotlight_size, params);
elm_list_item_append(list, "Pack / Unpack", NULL, NULL, pack_cb, params);
elm_list_item_append(list, "Active Index", NULL, NULL, active_index_cb, params);
elm_list_item_append(list, "Indicator", NULL, NULL, indicator_cb, params);
@ -832,40 +832,40 @@ test_ui_active_view_stack(void *data EINA_UNUSED,
switch (i % 3)
{
case 0:
view = view_add(LAYOUT, active_view);
view = view_add(LAYOUT, spotlight);
break;
case 1:
view = view_add(LIST, active_view);
view = view_add(LIST, spotlight);
break;
case 2:
view = view_add(BUTTON, active_view);
view = view_add(BUTTON, spotlight);
break;
default:
view = view_add(LAYOUT, active_view);
view = view_add(LAYOUT, spotlight);
break;
}
efl_pack_end(active_view, view);
efl_pack_end(spotlight, view);
}
efl_gfx_entity_size_set(win, EINA_SIZE2D(580, 320));
}
void
test_ui_active_view_plain(void *data EINA_UNUSED,
test_ui_spotlight_plain(void *data EINA_UNUSED,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Eo *win, *panes, *navi, *list, *layout, *active_view, *view;
Eo *win, *panes, *navi, *list, *layout, *spotlight, *view;
Params *params = NULL;
char buf[PATH_MAX];
int i;
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
efl_text_set(efl_added, "Efl.Ui.Active_View Plain"),
efl_text_set(efl_added, "Efl.Ui.Spotlight Plain"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
panes = efl_add(EFL_UI_PANES_CLASS, win,
@ -891,34 +891,34 @@ test_ui_active_view_plain(void *data EINA_UNUSED,
efl_file_load(efl_added),
efl_content_set(efl_part(panes, "second"), efl_added));
active_view = efl_add(EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS, layout,
spotlight = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, layout,
efl_content_set(efl_part(layout, "pager"), efl_added),
efl_ui_active_view_size_set(efl_added, EINA_SIZE2D(200, 300)));
efl_ui_spotlight_size_set(efl_added, EINA_SIZE2D(200, 300)));
efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "Prev"),
efl_event_callback_add(efl_added,
EFL_UI_EVENT_CLICKED, prev_btn_cb, active_view),
EFL_UI_EVENT_CLICKED, prev_btn_cb, spotlight),
efl_content_set(efl_part(layout, "prev_btn"), efl_added));
efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "Next"),
efl_event_callback_add(efl_added,
EFL_UI_EVENT_CLICKED, next_btn_cb, active_view),
EFL_UI_EVENT_CLICKED, next_btn_cb, spotlight),
efl_content_set(efl_part(layout, "next_btn"), efl_added));
params = calloc(1, sizeof(Params));
if (!params) return;
params->navi = navi;
params->active_view = active_view;
params->spotlight = spotlight;
params->indicator = NULL;
params->w = 200;
params->h = 300;
params->wfill = EINA_FALSE;
params->hfill = EINA_FALSE;
elm_list_item_append(list, "View Size", NULL, NULL, active_view_size, params);
elm_list_item_append(list, "View Size", NULL, NULL, spotlight_size, params);
elm_list_item_append(list, "Pack / Unpack", NULL, NULL, pack_cb, params);
elm_list_item_append(list, "Active Index", NULL, NULL, active_index_cb, params);
elm_list_item_append(list, "Indicator", NULL, NULL, indicator_cb, params);
@ -931,40 +931,40 @@ test_ui_active_view_plain(void *data EINA_UNUSED,
switch (i % 3)
{
case 0:
view = view_add(LAYOUT, active_view);
view = view_add(LAYOUT, spotlight);
break;
case 1:
view = view_add(LIST, active_view);
view = view_add(LIST, spotlight);
break;
case 2:
view = view_add(BUTTON, active_view);
view = view_add(BUTTON, spotlight);
break;
default:
view = view_add(LAYOUT, active_view);
view = view_add(LAYOUT, spotlight);
break;
}
efl_pack_end(active_view, view);
efl_pack_end(spotlight, view);
}
efl_gfx_entity_size_set(win, EINA_SIZE2D(580, 320));
}
void
test_ui_active_view_scroll(void *data EINA_UNUSED,
test_ui_spotlight_scroll(void *data EINA_UNUSED,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Eo *win, *panes, *navi, *list, *layout, *active_view, *view;
Eo *win, *panes, *navi, *list, *layout, *spotlight, *view;
Params *params = NULL;
char buf[PATH_MAX];
int i;
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
efl_text_set(efl_added, "Efl.Ui.Active_View Scroll"),
efl_text_set(efl_added, "Efl.Ui.Spotlight Scroll"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
panes = efl_add(EFL_UI_PANES_CLASS, win,
@ -990,36 +990,36 @@ test_ui_active_view_scroll(void *data EINA_UNUSED,
efl_file_load(efl_added),
efl_content_set(efl_part(panes, "second"), efl_added));
active_view = efl_add(EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS, layout,
spotlight = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, layout,
efl_content_set(efl_part(layout, "pager"), efl_added),
efl_ui_active_view_size_set(efl_added, EINA_SIZE2D(200, 300)));
efl_ui_spotlight_size_set(efl_added, EINA_SIZE2D(200, 300)));
efl_ui_active_view_manager_set(active_view, efl_new(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_SCROLL_CLASS));
efl_ui_spotlight_manager_set(spotlight, efl_new(EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS));
efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "Prev"),
efl_event_callback_add(efl_added,
EFL_UI_EVENT_CLICKED, prev_btn_cb, active_view),
EFL_UI_EVENT_CLICKED, prev_btn_cb, spotlight),
efl_content_set(efl_part(layout, "prev_btn"), efl_added));
efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "Next"),
efl_event_callback_add(efl_added,
EFL_UI_EVENT_CLICKED, next_btn_cb, active_view),
EFL_UI_EVENT_CLICKED, next_btn_cb, spotlight),
efl_content_set(efl_part(layout, "next_btn"), efl_added));
params = calloc(1, sizeof(Params));
if (!params) return;
params->navi = navi;
params->active_view = active_view;
params->spotlight = spotlight;
params->indicator = NULL;
params->w = 200;
params->h = 300;
params->wfill = EINA_FALSE;
params->hfill = EINA_FALSE;
elm_list_item_append(list, "View Size", NULL, NULL, active_view_size, params);
elm_list_item_append(list, "View Size", NULL, NULL, spotlight_size, params);
elm_list_item_append(list, "Pack / Unpack", NULL, NULL, pack_cb, params);
elm_list_item_append(list, "Active Index", NULL, NULL, active_index_cb, params);
elm_list_item_append(list, "Indicator", NULL, NULL, indicator_cb, params);
@ -1032,22 +1032,22 @@ test_ui_active_view_scroll(void *data EINA_UNUSED,
switch (i % 3)
{
case 0:
view = view_add(LAYOUT, active_view);
view = view_add(LAYOUT, spotlight);
break;
case 1:
view = view_add(LIST, active_view);
view = view_add(LIST, spotlight);
break;
case 2:
view = view_add(BUTTON, active_view);
view = view_add(BUTTON, spotlight);
break;
default:
view = view_add(LAYOUT, active_view);
view = view_add(LAYOUT, spotlight);
break;
}
efl_pack_end(active_view, view);
efl_pack_end(spotlight, view);
}
efl_gfx_entity_size_set(win, EINA_SIZE2D(580, 320));

View File

@ -19,7 +19,7 @@ static void
_stack_pop(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *stack = data;
efl_ui_active_view_pop(stack, EINA_TRUE);
efl_ui_spotlight_pop(stack, EINA_TRUE);
}
static void
@ -99,7 +99,7 @@ _fifth_layout_insert(void *data, const Efl_Event *ev EINA_UNUSED)
Eo *nl = _navigation_layout_create(stack, "5th layout", btn);
efl_ui_active_view_push(stack, nl);
efl_ui_spotlight_push(stack, nl);
}
static void
@ -115,7 +115,7 @@ _third_layout_push(void *data, const Efl_Event *ev EINA_UNUSED)
_bar_right_btn_set(nl, _fifth_layout_insert, stack);
efl_ui_active_view_push(stack, nl);
efl_ui_spotlight_push(stack, nl);
}
static void
@ -131,7 +131,7 @@ _second_layout_push(void *data, const Efl_Event *ev EINA_UNUSED)
_bar_right_btn_set(nl, _third_layout_push, stack);
efl_ui_active_view_push(stack, nl);
efl_ui_spotlight_push(stack, nl);
}
static void
@ -146,7 +146,7 @@ _first_layout_push(Eo *win, Eo *stack)
_bar_left_btn_set(nl, _win_del, win);
_bar_right_btn_set(nl, _second_layout_push, stack);
efl_ui_active_view_push(stack, nl);
efl_ui_spotlight_push(stack, nl);
}
void
@ -158,7 +158,7 @@ test_ui_stack(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
efl_gfx_entity_size_set(win, EINA_SIZE2D(500, 500));
Eo *stack = efl_ui_active_view_util_stack_gen(win);
Eo *stack = efl_ui_spotlight_util_stack_gen(win);
efl_content_set(win, stack);

View File

@ -165,7 +165,7 @@ test_ui_tab_pager(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev
efl_pack_end(tp, page);
}
efl_ui_active_view_active_index_set(tp, 0);
efl_ui_spotlight_active_index_set(tp, 0);
ad = (App_Data*)calloc(1, sizeof(App_Data));
ad->navi = navi;
@ -199,7 +199,7 @@ static void
_tab_set_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Tab_Set_Data *tsd = data;
efl_ui_active_view_active_index_set(tsd->tab_pager, elm_spinner_value_get(tsd->spinner));
efl_ui_spotlight_active_index_set(tsd->tab_pager, elm_spinner_value_get(tsd->spinner));
}
static void
@ -230,7 +230,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_active_view_active_index_get(tab_pager)),
efl_ui_range_value_set(efl_added, efl_ui_spotlight_active_index_get(tab_pager)),
efl_pack_end(box, efl_added));
tsd->tab_pager = tab_pager;
@ -272,7 +272,7 @@ _pack_before_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
Eo *tab_page, *cur_tab_page;
int index;
index = efl_ui_active_view_active_index_get(tab_pager);
index = efl_ui_spotlight_active_index_get(tab_pager);
cur_tab_page = efl_pack_content_get(tab_pager, index);
tab_page = tab_page_add(tab_pager);
@ -287,7 +287,7 @@ _pack_after_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
Eo *tab_page, *cur_tab_page;
int index;
index = efl_ui_active_view_active_index_get(tab_pager);
index = efl_ui_spotlight_active_index_get(tab_pager);
cur_tab_page = efl_pack_content_get(tab_pager, index);
tab_page = tab_page_add(tab_pager);
@ -364,7 +364,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_active_view_active_index_get(tab_pager)),
efl_ui_range_value_set(efl_added, efl_ui_spotlight_active_index_get(tab_pager)),
efl_pack_end(in_box, efl_added));
tsd->tab_pager = tab_pager;
@ -389,7 +389,7 @@ static void
_unpack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *tab_pager = data;
int index = efl_ui_active_view_active_index_get(tab_pager);
int index = efl_ui_spotlight_active_index_get(tab_pager);
Eo *tab_page = efl_pack_content_get(tab_pager, index);
efl_pack_unpack(tab_pager, tab_page);
efl_del(tab_page);
@ -464,7 +464,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_active_view_active_index_get(tab_pager)),
efl_ui_range_value_set(efl_added, efl_ui_spotlight_active_index_get(tab_pager)),
efl_pack_end(in_box, efl_added));
tsd->tab_pager = tab_pager;
@ -488,7 +488,7 @@ _change_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
char *label = NULL;
char *icon = NULL;
int cur;
cur = efl_ui_active_view_active_index_get(tcd->tab_pager);
cur = efl_ui_spotlight_active_index_get(tcd->tab_pager);
tab_page = efl_pack_content_get(tcd->tab_pager, cur);
if (efl_ui_check_selected_get(tcd->label_check))
@ -556,23 +556,23 @@ _tab_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
static void
_tran_set_btn_scroll_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Efl_Ui_Active_View_View_Manager_Scroll *scroll = efl_new(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_SCROLL_CLASS);
efl_ui_active_view_manager_set(data, scroll);
Efl_Ui_Spotlight_Manager_Scroll *scroll = efl_new(EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS);
efl_ui_spotlight_manager_set(data, scroll);
efl_unref(scroll);
}
static void
_tran_set_btn_stack_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Efl_Ui_Active_View_View_Manager_Scroll *stack = efl_new(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_STACK_CLASS);
efl_ui_active_view_manager_set(data, stack);
Efl_Ui_Spotlight_Manager_Scroll *stack = efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS);
efl_ui_spotlight_manager_set(data, stack);
efl_unref(stack);
}
static void
_tran_unset_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
efl_ui_active_view_manager_set(data, NULL);
efl_ui_spotlight_manager_set(data, NULL);
}
static void

View File

@ -2,7 +2,7 @@
#include <Elementary.h>
static Efl_Ui_Active_View_Container *container;
static Efl_Ui_Spotlight_Container *container;
static Eina_Bool play_state = EINA_FALSE;
static Efl_Loop_Timer *show_timer = NULL;
@ -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_active_view_active_index_get(container);
int current_index = efl_ui_spotlight_active_index_get(container);
int new_index = (current_index + 1) % efl_content_count(container);
efl_ui_active_view_active_index_set(container, new_index);
efl_ui_spotlight_active_index_set(container, new_index);
}
static void
@ -90,11 +90,11 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
table = efl_add(EFL_UI_TABLE_CLASS, win);
efl_content_set(win, table);
container = efl_add(EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS, win,
efl_event_callback_add(efl_added, EFL_UI_ACTIVE_VIEW_EVENT_TRANSITION_END, _container_end, NULL),
container = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, win,
efl_event_callback_add(efl_added, EFL_UI_SPOTLIGHT_EVENT_TRANSITION_END, _container_end, NULL),
efl_pack_table(table, efl_added, 0, 0, 1, 1));
efl_ui_active_view_indicator_set(container, efl_new(EFL_UI_ACTIVE_VIEW_INDICATOR_ICON_CLASS));
efl_ui_active_view_manager_set(container, efl_new(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_STACK_CLASS));
efl_ui_spotlight_indicator_set(container, efl_new(EFL_UI_SPOTLIGHT_INDICATOR_ICON_CLASS));
efl_ui_spotlight_manager_set(container, efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS));
for (int i = 0; i < IMG_NUM; i++)
{

View File

@ -227,18 +227,18 @@ EAPI void efl_ui_focus_relation_free(Efl_Ui_Focus_Relations *rel);
# include <efl_ui_panes_eo.h>
# include <efl_ui_panes_part.eo.h>
#define _EFL_UI_ACTIVE_VIEW_VIEW_MANAGEREO_CLASS_TYPE
typedef Eo Efl_Ui_Active_View_View_Manager;
#define _EFL_UI_ACTIVE_VIEW_INDICATOR_EO_CLASS_TYPE
typedef Eo Efl_Ui_Active_View_Indicator;
#define _EFL_UI_SPOTLIGHT_MANAGEREO_EO_CLASS_TYPE
typedef Eo Efl_Ui_Spotlight_Manager;
#define _EFL_UI_SPOTLIGHT_INDICATOR_EO_CLASS_TYPE
typedef Eo Efl_Ui_Spotlight_Indicator;
# include <efl_ui_active_view_container.eo.h>
# include <efl_ui_active_view_view_manager.eo.h>
# include <efl_ui_active_view_indicator.eo.h>
# include <efl_ui_active_view_indicator_icon.eo.h>
# include <efl_ui_active_view_view_manager_scroll.eo.h>
# include <efl_ui_active_view_view_manager_stack.eo.h>
# include <efl_ui_active_view_util.eo.h>
# include <efl_ui_spotlight_container.eo.h>
# include <efl_ui_spotlight_manager.eo.h>
# include <efl_ui_spotlight_indicator.eo.h>
# include <efl_ui_spotlight_indicator_icon.eo.h>
# include <efl_ui_spotlight_manager_scroll.eo.h>
# include <efl_ui_spotlight_manager_stack.eo.h>
# include <efl_ui_spotlight_util.eo.h>
# include <efl_ui_navigation_bar.eo.h>
# include <efl_ui_navigation_bar_part.eo.h>

View File

@ -1,111 +0,0 @@
struct @beta Efl.Ui.Active_View.Transition_Event {
[[Information regarding transition events.]]
from : int; [[The view index from where the transition started, -1 if not known.]]
to : int; [[The view index to where the transition is headed, -1 if not known.]]
}
class @beta Efl.Ui.Active_View.Container extends Efl.Ui.Layout_Base implements Efl.Pack_Linear
{
[[The Active View widget is a container for other sub-widgets (views), where only one sub-widget is active at any given time.
Views are added using the @Efl.Pack_Linear interface and the active view is selected using @.active_index.
The way the different views are rendered can be customized through the @.view_manager object. For example, only the active view
might be shown, or it might be shown in a central position whereas the other views are displayed on the sides, or grayed-out.
All views are displayed with the same size, selected with @.active_view_size.
Additionally, the transition from one view to another can be animated. This animation is also controlled by the @.view_manager object.
Also, an indicator widget can be used to show a visual cue of how many views are there and which one is the active one.
This class can be used to create other widgets like Pagers, Tabbed pagers or Stacks, where each view represents a "page" full
of other widgets. All these cases can be implemented with a different @.view_manager and use the same @Efl.Ui.Active_View.Container.
]]
c_prefix: efl_ui_active_view;
methods {
@property view_manager {
[[This object defines how views are rendered and animated.
If it is not set, only the active view is shown and transitions are instantaneous (not animated).
]]
values {
view_manager : Efl.Ui.Active_View.View_Manager @owned; [[The View Manager object or $NULL.]]
}
}
@property indicator {
[[An indicator object to use, which will display the current state of the Active View (number of views and active one).
When this object is set, it is immediately updated to reflect the current state of the widget.
Its location inside the container is controlled by the @.view_manager.
]]
values {
indicator : Efl.Ui.Active_View.Indicator @owned; [[The Indicator object or $NULL.]]
}
}
@property active_index {
[[Currently active view among all the views added to this widget.
Changing this value might trigger an animation.
]]
values {
index: int; [[Index of the active view, from 0 to the number of views - 1 (@Efl.Container.content_count - 1).]]
}
}
@property active_view_size {
[[The size to use when displaying the Active View. This is used by the @.view_manager to perform the rendering.
Views other than the Active one may or may not use this size.]]
values {
size: Eina.Size2D; [[Render size for the Active View. (-1, -1) means that all available space inside the container is used.]]
}
}
push @beta {
[[Packs a new view at the position indicated by @.active_index (0 by default).
This is the same behavior as a push operation on a stack.
An animation might be triggered to make the new active view come into position.
]]
params {
view : Efl.Gfx.Entity; [[View to add and set to be the active view.]]
}
}
pop @beta {
[[Removes the active view from the widget.
The views behind it naturally flow down so the next one becomes the active view. 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 view is manipulated.
An animation might be triggered to make the new active view come into position and the old one disappear.
The removed view can be returned to the caller or deleted (depending on $delete_on_transition_end).
]]
params {
deletion_on_transition_end : bool; [[ if $true, then the object will be deleted before resolving the future, and a NULL pointer is the value of the future. $false if no operation should be applied to it]]
}
return : future<Efl.Gfx.Entity>; [[ This Future gets resolved when any transition animation finishes and the popped view is ready for collection.
If there is no animation, the Future resolves immediately.
If $deletion_on_transition_end is $true then this widget will destroy the popped view and the Future will contain no Value. Otherwise, the caller becomes the owner of the view contained in the Future and must dispose of it appropriately. ]]
}
}
events {
transition,start : Efl.Ui.Active_View.Transition_Event; [[A transition animation has started.]]
transition,end : Efl.Ui.Active_View.Transition_Event; [[A transition animation has ended.]]
}
implements {
Efl.Object.constructor;
Efl.Object.finalize;
Efl.Object.invalidate;
Efl.Container.content_count;
Efl.Container.content_iterate;
Efl.Pack.pack_clear;
Efl.Pack.unpack_all;
Efl.Pack.unpack;
Efl.Pack.pack;
Efl.Pack_Linear.pack_begin;
Efl.Pack_Linear.pack_end;
Efl.Pack_Linear.pack_before;
Efl.Pack_Linear.pack_after;
Efl.Pack_Linear.pack_at;
Efl.Pack_Linear.pack_content_get;
Efl.Pack_Linear.pack_index_get;
Efl.Pack_Linear.pack_unpack_at;
}
}

View File

@ -1,8 +0,0 @@
class @beta Efl.Ui.Active_View.Indicator_Icon extends Efl.Ui.Active_View.Indicator {
implements {
Efl.Ui.Active_View.Indicator.bind;
Efl.Ui.Active_View.Indicator.content_del;
Efl.Ui.Active_View.Indicator.content_add;
Efl.Ui.Active_View.Indicator.position_update;
}
}

View File

@ -1,21 +0,0 @@
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#include <Efl_Ui.h>
#include "elm_priv.h"
typedef struct {
} Efl_Ui_Active_View_Util_Data;
EOLIAN static Efl_Ui_Active_View_Container*
_efl_ui_active_view_util_stack_gen(Efl_Ui_Widget *parent)
{
Efl_Ui_Active_View_View_Manager *manager = efl_add(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_STACK_CLASS, parent);
return efl_add(EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS, parent,
efl_ui_active_view_manager_set(efl_added, manager));
}
#include "efl_ui_active_view_util.eo.c"

View File

@ -1,12 +0,0 @@
class @beta Efl.Ui.Active_View.View_Manager_Plain extends Efl.Ui.Active_View.View_Manager
{
implements {
Efl.Ui.Active_View.View_Manager.bind;
Efl.Ui.Active_View.View_Manager.content_add;
Efl.Ui.Active_View.View_Manager.content_del;
Efl.Ui.Active_View.View_Manager.switch_to;
Efl.Ui.Active_View.View_Manager.view_size {set;}
Efl.Ui.Active_View.View_Manager.animation_enabled {set; get;}
Efl.Object.destructor;
}
}

View File

@ -1,12 +0,0 @@
class @beta Efl.Ui.Active_View.View_Manager_Scroll extends Efl.Ui.Active_View.View_Manager
{
implements {
Efl.Ui.Active_View.View_Manager.bind;
Efl.Ui.Active_View.View_Manager.content_add;
Efl.Ui.Active_View.View_Manager.content_del;
Efl.Ui.Active_View.View_Manager.switch_to;
Efl.Ui.Active_View.View_Manager.view_size {set;}
Efl.Ui.Active_View.View_Manager.animation_enabled {set; get;}
Efl.Object.destructor;
}
}

View File

@ -1,12 +0,0 @@
class @beta Efl.Ui.Active_View.View_Manager_Stack extends Efl.Ui.Active_View.View_Manager
{
implements {
Efl.Ui.Active_View.View_Manager.bind;
Efl.Ui.Active_View.View_Manager.content_add;
Efl.Ui.Active_View.View_Manager.content_del;
Efl.Ui.Active_View.View_Manager.switch_to;
Efl.Ui.Active_View.View_Manager.view_size {set;}
Efl.Ui.Active_View.View_Manager.animation_enabled {set; get;}
Efl.Object.destructor;
}
}

View File

@ -19,14 +19,14 @@ _back_button_clicked_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *navigation_bar = data;
Eo *active_view = efl_provider_find(navigation_bar, EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS);
if (!active_view)
Eo *spotlight = efl_provider_find(navigation_bar, EFL_UI_SPOTLIGHT_CONTAINER_CLASS);
if (!spotlight)
{
ERR("Cannot find EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS instance!");
ERR("Cannot find EFL_UI_SPOTLIGHT_CONTAINER_CLASS instance!");
return;
}
efl_ui_active_view_pop(active_view, EINA_TRUE);
efl_ui_spotlight_pop(spotlight, EINA_TRUE);
}
EOLIAN static Eo *

View File

@ -4,9 +4,9 @@
#include <Efl_Ui.h>
#include "elm_priv.h"
#include "efl_ui_active_view_view_manager_plain.eo.h"
#include "efl_ui_spotlight_manager_plain.eo.h"
typedef struct _Efl_Ui_Active_View_Container_Data
typedef struct _Efl_Ui_Spotlight_Container_Data
{
Eina_List *content_list;
Eo *page_root, *event;
@ -27,21 +27,21 @@ typedef struct _Efl_Ui_Active_View_Container_Data
Eina_Promise *transition_done;
Efl_Gfx_Entity *content;
} transition_done;
Efl_Ui_Active_View_View_Manager *transition;
Efl_Ui_Active_View_Indicator *indicator;
Efl_Ui_Spotlight_Manager *transition;
Efl_Ui_Spotlight_Indicator *indicator;
double position;
Eina_Bool fill_width: 1;
Eina_Bool fill_height: 1;
Eina_Bool prevent_transition_interaction : 1;
} Efl_Ui_Active_View_Container_Data;
} Efl_Ui_Spotlight_Container_Data;
#define MY_CLASS EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS
#define MY_CLASS EFL_UI_SPOTLIGHT_CONTAINER_CLASS
static void _unpack(Eo *obj, Efl_Ui_Active_View_Container_Data *pd, Efl_Gfx_Entity *subobj, int index);
static void _unpack_all(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd, Eina_Bool clear);
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);
static int
clamp_index(Efl_Ui_Active_View_Container_Data *pd, int index)
clamp_index(Efl_Ui_Spotlight_Container_Data *pd, int index)
{
if (index < ((int)eina_list_count(pd->content_list)) * -1)
return -1;
@ -51,7 +51,7 @@ clamp_index(Efl_Ui_Active_View_Container_Data *pd, int index)
}
static int
index_rollover(Efl_Ui_Active_View_Container_Data *pd, int index)
index_rollover(Efl_Ui_Spotlight_Container_Data *pd, int index)
{
int c = eina_list_count(pd->content_list);
if (index < c * -1)
@ -64,9 +64,9 @@ index_rollover(Efl_Ui_Active_View_Container_Data *pd, int index)
}
static void
_transition_end(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd)
_transition_end(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
{
Efl_Ui_Active_View_Transition_Event ev;
Efl_Ui_Spotlight_Transition_Event ev;
if (pd->prevent_transition_interaction) return;
@ -81,16 +81,16 @@ _transition_end(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd)
ev.from = pd->show_request.from;
ev.to = pd->show_request.to;
efl_event_callback_call(obj, EFL_UI_ACTIVE_VIEW_EVENT_TRANSITION_END, &ev);
efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_EVENT_TRANSITION_END, &ev);
pd->show_request.active = EINA_FALSE;
pd->show_request.from = -1;
pd->show_request.to = -1;
}
static void
_transition_start(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd, int from, int to, double progress)
_transition_start(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, int from, int to, double progress)
{
Efl_Ui_Active_View_Transition_Event ev;
Efl_Ui_Spotlight_Transition_Event ev;
if (pd->prevent_transition_interaction) return;
@ -103,23 +103,23 @@ _transition_start(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd, in
pd->show_request.last_pos = progress;
ev.from = pd->show_request.from;
ev.to = pd->show_request.to;
efl_event_callback_call(obj, EFL_UI_ACTIVE_VIEW_EVENT_TRANSITION_START, &ev);
efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_EVENT_TRANSITION_START, &ev);
}
static void
_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd, double progress)
_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, double progress)
{
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)
{
efl_ui_active_view_indicator_position_update(pd->indicator, progress);
efl_ui_spotlight_indicator_position_update(pd->indicator, progress);
}
pd->position = progress;
}
static void
_transition_event_emission(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd)
_transition_event_emission(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
{
if (pd->show_request.active)
{
@ -146,7 +146,7 @@ _transition_event_emission(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Dat
static void
_resize_cb(void *data, const Efl_Event *ev)
{
Efl_Ui_Active_View_Container_Data *pd = data;
Efl_Ui_Spotlight_Container_Data *pd = data;
Eina_Size2D sz;
sz = efl_gfx_entity_size_get(ev->object);
@ -155,12 +155,12 @@ _resize_cb(void *data, const Efl_Event *ev)
if (pd->fill_height) pd->page_spec.sz.h = sz.h;
if (pd->transition)
efl_ui_active_view_view_manager_view_size_set(pd->transition, pd->page_spec.sz);
efl_ui_spotlight_manager_size_set(pd->transition, pd->page_spec.sz);
}
EOLIAN static Eo *
_efl_ui_active_view_container_efl_object_constructor(Eo *obj,
Efl_Ui_Active_View_Container_Data *pd)
_efl_ui_spotlight_container_efl_object_constructor(Eo *obj,
Efl_Ui_Spotlight_Container_Data *pd)
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
@ -185,7 +185,7 @@ _efl_ui_active_view_container_efl_object_constructor(Eo *obj,
pd->fill_width = EINA_TRUE;
pd->fill_height = EINA_TRUE;
efl_ui_active_view_size_set(obj, EINA_SIZE2D(-1, -1));
efl_ui_spotlight_size_set(obj, EINA_SIZE2D(-1, -1));
elm_widget_can_focus_set(obj, EINA_FALSE);
@ -204,39 +204,39 @@ _efl_ui_active_view_container_efl_object_constructor(Eo *obj,
}
EOLIAN static Efl_Object*
_efl_ui_active_view_container_efl_object_finalize(Eo *obj, Efl_Ui_Active_View_Container_Data *pd EINA_UNUSED)
_efl_ui_spotlight_container_efl_object_finalize(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd EINA_UNUSED)
{
Efl_Ui_Active_View_View_Manager *manager;
Efl_Ui_Spotlight_Manager *manager;
obj = efl_finalize(efl_super(obj, MY_CLASS));
manager = efl_ui_active_view_manager_get(obj);
manager = efl_ui_spotlight_manager_get(obj);
//set a view manager in case nothing is here
if (!manager)
{
Eo *plain;
plain = efl_add(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_PLAIN_CLASS, obj);
efl_ui_active_view_manager_set(obj, plain);
plain = efl_add(EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS, obj);
efl_ui_spotlight_manager_set(obj, plain);
}
else
{
efl_ui_active_view_view_manager_animation_enabled_set(manager, EINA_TRUE);
efl_ui_spotlight_manager_animation_enabled_set(manager, EINA_TRUE);
}
return obj;
}
EOLIAN static void
_efl_ui_active_view_container_efl_object_invalidate(Eo *obj,
Efl_Ui_Active_View_Container_Data *pd)
_efl_ui_spotlight_container_efl_object_invalidate(Eo *obj,
Efl_Ui_Spotlight_Container_Data *pd)
{
_unpack_all(obj, pd, EINA_TRUE);
efl_invalidate(efl_super(obj, MY_CLASS));
}
EOLIAN static int
_efl_ui_active_view_container_efl_container_content_count(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd)
_efl_ui_spotlight_container_efl_container_content_count(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd)
{
return eina_list_count(pd->content_list);
}
@ -244,13 +244,13 @@ _efl_ui_active_view_container_efl_container_content_count(Eo *obj EINA_UNUSED,
static void
_child_inv(void *data, const Efl_Event *ev)
{
Efl_Ui_Active_View_Container_Data *pd = efl_data_scope_get(data, MY_CLASS);
Efl_Ui_Spotlight_Container_Data *pd = efl_data_scope_get(data, MY_CLASS);
int index = eina_list_data_idx(pd->content_list, ev->object);
_unpack(data, pd, ev->object, index);
}
static Eina_Bool
_register_child(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd, Efl_Gfx_Entity *subobj)
_register_child(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, Efl_Gfx_Entity *subobj)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(subobj, EINA_FALSE);
if (eina_list_data_find(pd->content_list, subobj))
@ -267,7 +267,7 @@ _register_child(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd, Efl_
}
static void
_update_internals(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index)
_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;
@ -279,19 +279,19 @@ _update_internals(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd, Ef
pd->prevent_transition_interaction = EINA_TRUE;
if (pd->transition)
efl_ui_active_view_view_manager_content_add(pd->transition, subobj, index);
efl_ui_spotlight_manager_content_add(pd->transition, subobj, index);
if (pd->indicator)
efl_ui_active_view_indicator_content_add(pd->indicator, subobj, index);
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_active_view_active_index_set(obj, 0);
efl_ui_spotlight_active_index_set(obj, 0);
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_linear_pack_begin(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_linear_pack_begin(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd,
Efl_Gfx_Entity *subobj)
{
if (!_register_child(obj, pd, subobj)) return EINA_FALSE;
@ -301,8 +301,8 @@ _efl_ui_active_view_container_efl_pack_linear_pack_begin(Eo *obj EINA_UNUSED,
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_linear_pack_end(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_linear_pack_end(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd,
Efl_Gfx_Entity *subobj)
{
if (!_register_child(obj, pd, subobj)) return EINA_FALSE;
@ -312,8 +312,8 @@ _efl_ui_active_view_container_efl_pack_linear_pack_end(Eo *obj EINA_UNUSED,
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_linear_pack_before(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_linear_pack_before(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd,
Efl_Gfx_Entity *subobj,
const Efl_Gfx_Entity *existing)
{
@ -326,8 +326,8 @@ _efl_ui_active_view_container_efl_pack_linear_pack_before(Eo *obj EINA_UNUSED,
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_linear_pack_after(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_linear_pack_after(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd,
Efl_Gfx_Entity *subobj,
const Efl_Gfx_Entity *existing)
{
@ -340,8 +340,8 @@ _efl_ui_active_view_container_efl_pack_linear_pack_after(Eo *obj EINA_UNUSED,
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_linear_pack_at(Eo *obj,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_linear_pack_at(Eo *obj,
Efl_Ui_Spotlight_Container_Data *pd,
Efl_Gfx_Entity *subobj,
int index)
{
@ -372,24 +372,24 @@ _efl_ui_active_view_container_efl_pack_linear_pack_at(Eo *obj,
}
EOLIAN static Efl_Gfx_Entity *
_efl_ui_active_view_container_efl_pack_linear_pack_content_get(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_linear_pack_content_get(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd,
int index)
{
return eina_list_nth(pd->content_list, index_rollover(pd, index));
}
EOLIAN static int
_efl_ui_active_view_container_efl_pack_linear_pack_index_get(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_linear_pack_index_get(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd,
const Efl_Gfx_Entity *subobj)
{
return eina_list_data_idx(pd->content_list, (void *)subobj);
}
EOLIAN static void
_efl_ui_active_view_container_active_index_set(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_active_index_set(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd,
int index)
{
int before;
@ -414,26 +414,26 @@ _efl_ui_active_view_container_active_index_set(Eo *obj EINA_UNUSED,
int old_curr_page = pd->curr.page;
pd->curr.page = index;
efl_ui_active_view_view_manager_switch_to(pd->transition, old_curr_page, pd->curr.page);
efl_ui_spotlight_manager_switch_to(pd->transition, old_curr_page, pd->curr.page);
}
EOLIAN static int
_efl_ui_active_view_container_active_index_get(const Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd)
_efl_ui_spotlight_container_active_index_get(const Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd)
{
return pd->curr.page;
}
EOLIAN Eina_Size2D
_efl_ui_active_view_container_active_view_size_get(const Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd)
_efl_ui_spotlight_container_spotlight_size_get(const Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd)
{
return pd->page_spec.sz;
}
EOLIAN static void
_efl_ui_active_view_container_active_view_size_set(Eo *obj,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_spotlight_size_set(Eo *obj,
Efl_Ui_Spotlight_Container_Data *pd,
Eina_Size2D sz)
{
Eina_Size2D size;
@ -450,12 +450,12 @@ _efl_ui_active_view_container_active_view_size_set(Eo *obj,
pd->page_spec.sz.w = size.w;
if (pd->transition)
efl_ui_active_view_view_manager_view_size_set(pd->transition, pd->page_spec.sz);
efl_ui_spotlight_manager_size_set(pd->transition, pd->page_spec.sz);
}
static void
_unpack_all(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd,
Efl_Ui_Spotlight_Container_Data *pd,
Eina_Bool clear)
{
pd->curr.page = -1;
@ -472,8 +472,8 @@ _unpack_all(Eo *obj EINA_UNUSED,
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_pack_clear(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd)
_efl_ui_spotlight_container_efl_pack_pack_clear(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd)
{
_unpack_all(obj, pd, EINA_TRUE);
@ -481,8 +481,8 @@ _efl_ui_active_view_container_efl_pack_pack_clear(Eo *obj EINA_UNUSED,
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_unpack_all(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd)
_efl_ui_spotlight_container_efl_pack_unpack_all(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd)
{
_unpack_all(obj, pd, EINA_FALSE);
@ -491,7 +491,7 @@ _efl_ui_active_view_container_efl_pack_unpack_all(Eo *obj EINA_UNUSED,
static void
_unpack(Eo *obj,
Efl_Ui_Active_View_Container_Data *pd,
Efl_Ui_Spotlight_Container_Data *pd,
Efl_Gfx_Entity *subobj,
int index)
{
@ -506,9 +506,9 @@ _unpack(Eo *obj,
pd->curr.page--;
if (pd->transition)
efl_ui_active_view_view_manager_content_del(pd->transition, subobj, index);
efl_ui_spotlight_manager_content_del(pd->transition, subobj, index);
if (pd->indicator)
efl_ui_active_view_indicator_content_del(pd->indicator, subobj, index);
efl_ui_spotlight_indicator_content_del(pd->indicator, subobj, index);
//we deleted the current index
if (early_curr_page == index)
@ -519,7 +519,7 @@ _unpack(Eo *obj,
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_active_view_active_index_set(obj, new_curr_page);
efl_ui_spotlight_active_index_set(obj, new_curr_page);
else
pd->curr.page = -1;
}
@ -527,14 +527,14 @@ _unpack(Eo *obj,
//position has updated
if (early_curr_page != pd->curr.page && early_curr_page != index &&
pd->indicator && !pd->transition)
efl_ui_active_view_indicator_position_update(pd->indicator, pd->curr.page);
efl_ui_spotlight_indicator_position_update(pd->indicator, pd->curr.page);
efl_event_callback_del(subobj, EFL_EVENT_INVALIDATE, _child_inv, obj);
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_unpack(Eo *obj,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_unpack(Eo *obj,
Efl_Ui_Spotlight_Container_Data *pd,
Efl_Gfx_Entity *subobj)
{
if (!subobj) return EINA_FALSE;
@ -552,8 +552,8 @@ _efl_ui_active_view_container_efl_pack_unpack(Eo *obj,
}
EOLIAN static Efl_Gfx_Entity *
_efl_ui_active_view_container_efl_pack_linear_pack_unpack_at(Eo *obj,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_linear_pack_unpack_at(Eo *obj,
Efl_Ui_Spotlight_Container_Data *pd,
int index)
{
Efl_Gfx_Entity *subobj = eina_list_nth(pd->content_list, index_rollover(pd, index_rollover(pd, index)));
@ -564,13 +564,13 @@ _efl_ui_active_view_container_efl_pack_linear_pack_unpack_at(Eo *obj,
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_pack(Eo *obj, Efl_Ui_Active_View_Container_Data *pd EINA_UNUSED, Efl_Gfx_Entity *subobj)
_efl_ui_spotlight_container_efl_pack_pack(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd EINA_UNUSED, Efl_Gfx_Entity *subobj)
{
return efl_pack_begin(obj, subobj);
}
EOLIAN static Eina_Iterator*
_efl_ui_active_view_container_efl_container_content_iterate(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd)
_efl_ui_spotlight_container_efl_container_content_iterate(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
{
return eina_list_iterator_new(pd->content_list);
}
@ -578,7 +578,7 @@ _efl_ui_active_view_container_efl_container_content_iterate(Eo *obj EINA_UNUSED,
static void
_pos_updated(void *data, const Efl_Event *event)
{
Efl_Ui_Active_View_Container_Data *pd = efl_data_scope_get(data, MY_CLASS);
Efl_Ui_Spotlight_Container_Data *pd = efl_data_scope_get(data, MY_CLASS);
double progress = *((double*)event->info);
//ignore this here, this could result in unintendet transition,start / end calls
if (EINA_DBL_EQ(progress, pd->position))
@ -588,16 +588,16 @@ _pos_updated(void *data, const Efl_Event *event)
}
EOLIAN static void
_efl_ui_active_view_container_view_manager_set(Eo *obj, Efl_Ui_Active_View_Container_Data *pd, Efl_Ui_Active_View_View_Manager *transition)
_efl_ui_spotlight_container_spotlight_manager_set(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Efl_Ui_Spotlight_Manager *transition)
{
if (!transition)
pd->transition = efl_add(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_PLAIN_CLASS, obj);
pd->transition = efl_add(EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS, obj);
else
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(transition, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_CLASS));
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(transition, EFL_UI_SPOTLIGHT_MANAGER_CLASS));
if (pd->transition)
{
efl_ui_active_view_view_manager_bind(pd->transition, NULL, NULL);
efl_ui_spotlight_manager_bind(pd->transition, NULL, NULL);
efl_del(pd->transition);
}
@ -607,57 +607,57 @@ _efl_ui_active_view_container_view_manager_set(Eo *obj, Efl_Ui_Active_View_Conta
{
efl_parent_set(pd->transition, obj);
//disable animation when not finalized yet, this help reducing the overhead of scheduling a animation that will not be displayed
efl_ui_active_view_view_manager_animation_enabled_set(pd->transition, efl_finalized_get(obj));
efl_ui_active_view_view_manager_bind(pd->transition, obj,
efl_ui_spotlight_manager_animation_enabled_set(pd->transition, efl_finalized_get(obj));
efl_ui_spotlight_manager_bind(pd->transition, obj,
pd->page_root);
efl_ui_active_view_view_manager_view_size_set(pd->transition, pd->page_spec.sz);
efl_event_callback_add(pd->transition, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_EVENT_POS_UPDATE, _pos_updated, 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);
}
}
EOLIAN static Efl_Ui_Active_View_View_Manager*
_efl_ui_active_view_container_view_manager_get(const Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd)
EOLIAN static Efl_Ui_Spotlight_Manager*
_efl_ui_spotlight_container_spotlight_manager_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
{
if (efl_isa(pd->transition, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_PLAIN_CLASS))
if (efl_isa(pd->transition, EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS))
return NULL;
else
return pd->transition;
}
EOLIAN static void
_efl_ui_active_view_container_indicator_set(Eo *obj, Efl_Ui_Active_View_Container_Data *pd, Efl_Ui_Active_View_Indicator *indicator)
_efl_ui_spotlight_container_indicator_set(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Efl_Ui_Spotlight_Indicator *indicator)
{
if (pd->indicator)
{
efl_ui_active_view_indicator_bind(pd->indicator, obj);
efl_ui_spotlight_indicator_bind(pd->indicator, obj);
efl_del(pd->indicator);
}
pd->indicator = indicator;
if (pd->indicator)
{
efl_ui_active_view_indicator_bind(pd->indicator, obj);
efl_ui_spotlight_indicator_bind(pd->indicator, obj);
if (pd->position != -1)
efl_ui_active_view_indicator_position_update(pd->indicator, pd->position);
efl_ui_spotlight_indicator_position_update(pd->indicator, pd->position);
}
}
EOLIAN static Efl_Ui_Active_View_Indicator*
_efl_ui_active_view_container_indicator_get(const Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd)
EOLIAN static Efl_Ui_Spotlight_Indicator*
_efl_ui_spotlight_container_indicator_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
{
return pd->indicator;
}
EOLIAN static void
_efl_ui_active_view_container_push(Eo *obj, Efl_Ui_Active_View_Container_Data *pd EINA_UNUSED, Efl_Gfx_Entity *view)
_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_active_view_active_index_get(obj);
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_active_view_active_index_set(obj, old_active_index);
efl_ui_spotlight_active_index_set(obj, old_active_index);
}
static Eina_Value
@ -669,7 +669,7 @@ _delete_obj(void *data EINA_UNUSED, const Eina_Value value, const Eina_Future *d
}
EOLIAN static Eina_Future*
_efl_ui_active_view_container_pop(Eo *obj, Efl_Ui_Active_View_Container_Data *pd, Eina_Bool del)
_efl_ui_spotlight_container_pop(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Eina_Bool del)
{
Eina_Future *transition_done;
int new_index;
@ -677,21 +677,21 @@ _efl_ui_active_view_container_pop(Eo *obj, Efl_Ui_Active_View_Container_Data *pd
if (eina_list_count(pd->content_list) < 2)
new_index = -1;
new_index = efl_ui_active_view_active_index_get(obj) + 1;
new_index = efl_ui_spotlight_active_index_get(obj) + 1;
if (new_index >= (int)eina_list_count(pd->content_list))
new_index -= 2;
pd->transition_done.content = efl_pack_content_get(obj, efl_ui_active_view_active_index_get(obj));
pd->transition_done.content = efl_pack_content_get(obj, efl_ui_spotlight_active_index_get(obj));
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_active_view_active_index_set(obj, new_index);
efl_ui_spotlight_active_index_set(obj, new_index);
return transition_done;
}
#include "efl_ui_active_view_container.eo.c"
#include "efl_ui_spotlight_container.eo.c"

View File

@ -0,0 +1,111 @@
struct @beta Efl.Ui.Spotlight.Transition_Event {
[[Information regarding transition events.]]
from : int; [[The index from where the transition started, -1 if not known.]]
to : int; [[The index to where the transition is headed, -1 if not known.]]
}
class @beta Efl.Ui.Spotlight.Container extends Efl.Ui.Layout_Base implements Efl.Pack_Linear
{
[[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.
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.
All sub-widgets are displayed with the same size, selected with @.spotlight_size.
Additionally, the transition from one sub-widget to another can be animated. This animation is also controlled by the @.spotlight_manager object.
Also, an indicator widget can be used to show a visual cue of how many sub-widgets are there and which one is the active one.
This class can be used to create other widgets like Pagers, Tabbed pagers or Stacks, where each sub-widget represents a "page" full
of other widgets. All these cases can be implemented with a different @.spotlight_manager and use the same @Efl.Ui.Spotlight.Container.
]]
c_prefix: efl_ui_spotlight;
methods {
@property spotlight_manager {
[[This object defines how sub-widgets are rendered and animated.
If it is not set, only the active sub-widget is shown and transitions are instantaneous (not animated).
]]
values {
spotlight_manager : Efl.Ui.Spotlight.Manager @owned; [[The Spotlight Manager object or $NULL.]]
}
}
@property indicator {
[[An indicator object to use, which will display the current state of the spotlight (number of sub-widgets and active one).
When this object is set, it is immediately updated to reflect the current state of the widget.
Its location inside the container is controlled by the @.spotlight_manager.
]]
values {
indicator : Efl.Ui.Spotlight.Indicator @owned; [[The Indicator object or $NULL.]]
}
}
@property active_index {
[[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).]]
}
}
@property spotlight_size {
[[The size to use when displaying the Sub-Widget which has the spotlight. This is used by the @.spotlight_manager to perform the rendering.
Sub-Widgets other than the Active one may or may not use this size.]]
values {
size: Eina.Size2D; [[Render size for the spotlight. (-1, -1) means that all available space inside the container is used.]]
}
}
push @beta {
[[Packs a new sub-widget at the position indicated by @.active_index (0 by default).
This is the same behavior as a push operation on a stack.
An animation might be triggered to give the new sub-widget the spotlight and come into position.
]]
params {
widget : Efl.Gfx.Entity; [[Sub-Widget to add and set to be the spotlight sub-widget.]]
}
}
pop @beta {
[[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.
An animation might be triggered to give the new sub-widget the spotlight, come into position and the old one disappear.
The removed sub-widget can be returned to the caller or deleted (depending on $delete_on_transition_end).
]]
params {
deletion_on_transition_end : bool; [[ if $true, then the object will be deleted before resolving the future, and a NULL pointer is the value of the future. $false if no operation should be applied to it]]
}
return : future<Efl.Gfx.Entity>; [[ This Future gets resolved when any transition animation finishes and the popped sub-widget is ready for collection.
If there is no animation, the Future resolves immediately.
If $deletion_on_transition_end is $true then this widget will destroy the popped sub-widget and the Future will contain no Value. Otherwise, the caller becomes the owner of the sub-widget contained in the Future and must dispose of it appropriately. ]]
}
}
events {
transition,start : Efl.Ui.Spotlight.Transition_Event; [[A transition animation has started.]]
transition,end : Efl.Ui.Spotlight.Transition_Event; [[A transition animation has ended.]]
}
implements {
Efl.Object.constructor;
Efl.Object.finalize;
Efl.Object.invalidate;
Efl.Container.content_count;
Efl.Container.content_iterate;
Efl.Pack.pack_clear;
Efl.Pack.unpack_all;
Efl.Pack.unpack;
Efl.Pack.pack;
Efl.Pack_Linear.pack_begin;
Efl.Pack_Linear.pack_end;
Efl.Pack_Linear.pack_before;
Efl.Pack_Linear.pack_after;
Efl.Pack_Linear.pack_at;
Efl.Pack_Linear.pack_content_get;
Efl.Pack_Linear.pack_index_get;
Efl.Pack_Linear.pack_unpack_at;
}
}

View File

@ -9,7 +9,7 @@
typedef struct {
} Efl_Ui_Active_View_Indicator_Data;
} Efl_Ui_Spotlight_Indicator_Data;
#include "efl_ui_active_view_indicator.eo.c"
#include "efl_ui_spotlight_indicator.eo.c"

View File

@ -1,25 +1,25 @@
abstract @beta Efl.Ui.Active_View.Indicator extends Efl.Object {
[[Object used by @Efl.Ui.Active_View.Container to render an indication of the active view's position among
the rest of the container's views.
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 {
bind @pure_virtual {
[[This method is called the first time an @Efl.Ui.Active_View.Indicator is assigned to an @Efl.Ui.Active_View.Container, binding them together.
[[This method is called the first time an @Efl.Ui.Spotlight.Indicator is assigned to an @Efl.Ui.Spotlight.Container, binding them together.
This call can be used to setup the indicator part of the $active_view.
This call can be used to setup the indicator part of the $spotlight.
The Active View of the container (if there is any) will be informed to the indicator by a later call to @.position_update.
]]
params {
active_view : Efl.Ui.Active_View.Container; [[The container to bind this indicator to.]]
spotlight : Efl.Ui.Spotlight.Container; [[The container to bind this indicator to.]]
}
}
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.Active_View.Container.active_index since indices might have
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.
]]
params {
@ -30,7 +30,7 @@ abstract @beta Efl.Ui.Active_View.Indicator extends Efl.Object {
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.Active_View.Container.active_index since indices might have
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.
]]
params {
@ -39,7 +39,7 @@ abstract @beta Efl.Ui.Active_View.Indicator extends Efl.Object {
}
}
position_update @pure_virtual {
[[This method tells the indicator that @Efl.Ui.Active_View.Container.active_index has changed in the bound container.
[[This method tells the indicator that @Efl.Ui.Spotlight.Container.active_index 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

View File

@ -9,9 +9,9 @@
typedef struct {
Efl_Ui_Box *indicator;
Efl_Ui_Active_View_Container *container;
Efl_Ui_Spotlight_Container *container;
double last_position;
} Efl_Ui_Active_View_Indicator_Icon_Data;
} Efl_Ui_Spotlight_Indicator_Icon_Data;
static void
_flush_state(Eo *item, double val)
@ -22,7 +22,7 @@ _flush_state(Eo *item, double val)
}
static void
_add_item(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Indicator_Icon_Data *pd)
_add_item(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Indicator_Icon_Data *pd)
{
Efl_Canvas_Layout *item;
@ -37,7 +37,7 @@ _add_item(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Indicator_Icon_Data *pd)
}
static void
_flush_position(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Indicator_Icon_Data *pd)
_flush_position(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Indicator_Icon_Data *pd)
{
int next = -1, closer;
double closer_val;
@ -71,12 +71,12 @@ _flush_position(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Indicator_Icon_Data *pd)
}
EOLIAN static void
_efl_ui_active_view_indicator_icon_efl_ui_active_view_indicator_bind(Eo *obj, Efl_Ui_Active_View_Indicator_Icon_Data *pd, Efl_Ui_Active_View_Container *active_view)
_efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_bind(Eo *obj, Efl_Ui_Spotlight_Indicator_Icon_Data *pd, Efl_Ui_Spotlight_Container *spotlight)
{
if (active_view)
if (spotlight)
{
pd->container = active_view;
pd->indicator = efl_add(EFL_UI_BOX_CLASS, active_view);
pd->container = spotlight;
pd->indicator = efl_add(EFL_UI_BOX_CLASS, spotlight);
efl_ui_widget_internal_set(pd->indicator, EINA_TRUE);
efl_content_set(efl_part(pd->container, "efl.indicator"), pd->indicator);
efl_gfx_entity_visible_set(pd->indicator, EINA_TRUE);
@ -91,24 +91,24 @@ _efl_ui_active_view_indicator_icon_efl_ui_active_view_indicator_bind(Eo *obj, Ef
}
EOLIAN static void
_efl_ui_active_view_indicator_icon_efl_ui_active_view_indicator_content_add(Eo *obj, Efl_Ui_Active_View_Indicator_Icon_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index EINA_UNUSED)
_efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_content_add(Eo *obj, Efl_Ui_Spotlight_Indicator_Icon_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index EINA_UNUSED)
{
_add_item(obj, pd);
_flush_position(obj, pd);
}
EOLIAN static void
_efl_ui_active_view_indicator_icon_efl_ui_active_view_indicator_content_del(Eo *obj, Efl_Ui_Active_View_Indicator_Icon_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index EINA_UNUSED)
_efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_content_del(Eo *obj, Efl_Ui_Spotlight_Indicator_Icon_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index EINA_UNUSED)
{
efl_del(efl_pack_content_get(pd->indicator, 0));
_flush_position(obj, pd);
}
EOLIAN static void
_efl_ui_active_view_indicator_icon_efl_ui_active_view_indicator_position_update(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Indicator_Icon_Data *pd, double position)
_efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_position_update(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Indicator_Icon_Data *pd, double position)
{
pd->last_position = position;
_flush_position(obj, pd);
}
#include "efl_ui_active_view_indicator_icon.eo.c"
#include "efl_ui_spotlight_indicator_icon.eo.c"

View File

@ -0,0 +1,8 @@
class @beta Efl.Ui.Spotlight.Indicator_Icon extends Efl.Ui.Spotlight.Indicator {
implements {
Efl.Ui.Spotlight.Indicator.bind;
Efl.Ui.Spotlight.Indicator.content_del;
Efl.Ui.Spotlight.Indicator.content_add;
Efl.Ui.Spotlight.Indicator.position_update;
}
}

View File

@ -9,7 +9,7 @@
typedef struct {
} Efl_Ui_Active_View_View_Manager_Data;
} Efl_Ui_Spotlight_Manager_Data;
#include "efl_ui_active_view_view_manager.eo.c"
#include "efl_ui_spotlight_manager.eo.c"

View File

@ -1,25 +1,25 @@
abstract @beta Efl.Ui.Active_View.View_Manager extends Efl.Object {
[[Manager object used by @Efl.Ui.Active_View.Container to handle rendering and animation of its views, and user interaction.
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 currently active view (@Efl.Ui.Active_View.Container.active_index) can be animated with a transition.
This object can also handle user interaction. For example, dragging the active view to one side to get to a different view (like an Android home screen).
Such user interactions should end up setting a new @Efl.Ui.Active_View.Container.active_index.
For instance, changes to the current sub-widget in the spotlight (@Efl.Ui.Spotlight.Container.active_index) 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.
During a transition, the evolution of the current position should be exposed by emitting $pos_update events.
]]
methods {
bind @pure_virtual {
[[This method is called the first time an @Efl.Ui.Active_View.View_Manager is assigned to an @Efl.Ui.Active_View.Container, binding them together.
[[This method is called the first time an @Efl.Ui.Spotlight.Manager is assigned to an @Efl.Ui.Spotlight.Container, binding them together.
The manager can read the current content of the container, subscribe to events, or do any initialization it requires.
]]
params {
active_view : Efl.Ui.Active_View.Container; [[The container to bind the view manager to.]]
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 {
[[A $subobj has been added at position $index in the bound container.
The manager should check the container's @Efl.Ui.Active_View.Container.active_index since indices might have
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.
]]
params {
@ -30,7 +30,7 @@ abstract @beta Efl.Ui.Active_View.View_Manager extends Efl.Object {
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.Active_View.Container.active_index since indices might have
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.
]]
params {
@ -39,20 +39,20 @@ abstract @beta Efl.Ui.Active_View.View_Manager extends Efl.Object {
}
}
switch_to @pure_virtual {
[[Switch from one view to another. If there was no previous view, $from might be -1.
This function should display an animation if the @Efl.Ui.Active_View.View_Manager supports them.
[[Switch from one sub-widget to another. If there was no previous sub-widget, $from might be -1.
This function should display an animation if the @Efl.Ui.Spotlight.Manager supports them.
]]
params {
from : int; [[Index of the starting view in the container's list. Might be -1 if unknown.]]
to : int; [[Index of the target view in the container's list.]]
from : int; [[Index of the starting sub-widget in the container's list. Might be -1 if unknown.]]
to : int; [[Index of the target sub-widget in the container's list.]]
}
}
@property view_size @pure_virtual {
[[Will be called whenever the @Efl.Ui.Active_View.Container.active_view_size changes so the @Efl.Ui.Active_View.View_Manager can update itself.]]
@property size @pure_virtual {
[[Will be called whenever the @Efl.Ui.Spotlight.Container.spotlight_size changes so the @Efl.Ui.Spotlight.Manager can update itself.]]
set {
}
values {
size : Eina.Size2D; [[The new size of the views.]]
size : Eina.Size2D; [[The new size of the sub-widgets.]]
}
}
@property animation_enabled @pure_virtual {
@ -63,8 +63,8 @@ abstract @beta Efl.Ui.Active_View.View_Manager extends Efl.Object {
}
}
events {
pos_update : double; [[Index of the view currently being displayed. Fractional values indicate a position in-between views.
For instance, when transitioning from view 2 to view 3, this event should be emitted with monotonically
pos_update : double; [[Index of the sub-widget currently being displayed. Fractional values indicate a position in-between sub-widgets.
For instance, when transitioning from sub-widget 2 to sub-widget 3, this event should be emitted with monotonically
increasing values ranging from 2.0 to 3.0.
Animations can perform any movement they want, but the reported $pos_update must move in the same direction.]]
}

View File

@ -4,27 +4,27 @@
#include <Efl_Ui.h>
#include "elm_priv.h"
#include "efl_ui_active_view_view_manager_plain.eo.h"
#include "efl_ui_spotlight_manager_plain.eo.h"
typedef struct {
Efl_Ui_Active_View_Container * container;
Efl_Ui_Spotlight_Container * container;
Efl_Gfx_Entity *group;
Eina_Size2D page_size;
int current_content;
Eina_Bool animation;
} Efl_Ui_Active_View_View_Manager_Plain_Data;
} Efl_Ui_Spotlight_Manager_Plain_Data;
#define MY_CLASS EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_PLAIN_CLASS
#define MY_CLASS EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS
static void
_emit_position(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Plain_Data *pd)
_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_ACTIVE_VIEW_VIEW_MANAGER_EVENT_POS_UPDATE, &absolut_position);
efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &absolut_position);
}
static void
_geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Plain_Data *pd)
_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);
Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->group);
@ -54,23 +54,23 @@ EFL_CALLBACKS_ARRAY_DEFINE(group_callback,
)
EOLIAN static void
_efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_bind(Eo *obj, Efl_Ui_Active_View_View_Manager_Plain_Data *pd, Efl_Ui_Active_View_Container *active_view, 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, Efl_Canvas_Group *group)
{
if (active_view && group)
if (spotlight && group)
{
int index;
pd->container = active_view;
pd->container = spotlight;
pd->group = group;
efl_event_callback_array_add(pd->group, group_callback(), obj);
for (int i = 0; i < efl_content_count(active_view) ; ++i) {
Efl_Gfx_Entity *elem = efl_pack_content_get(active_view, i);
for (int i = 0; i < efl_content_count(spotlight) ; ++i) {
Efl_Gfx_Entity *elem = efl_pack_content_get(spotlight, i);
efl_canvas_group_member_add(pd->group, elem);
efl_gfx_entity_visible_set(elem, EINA_FALSE);
}
index = efl_ui_active_view_active_index_get(active_view);
index = efl_ui_spotlight_active_index_get(spotlight);
if (index != -1)
{
pd->current_content = index;
@ -82,12 +82,12 @@ _efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_bind(Eo *
}
static void
_content_changed(Eo *obj, Efl_Ui_Active_View_View_Manager_Plain_Data *pd)
_content_changed(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd)
{
if (efl_ui_active_view_active_index_get(pd->container) != pd->current_content)
if (efl_ui_spotlight_active_index_get(pd->container) != pd->current_content)
{
int old_current_content = pd->current_content;
pd->current_content = efl_ui_active_view_active_index_get(pd->container);
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);
_geom_sync(obj, pd);
@ -96,7 +96,7 @@ _content_changed(Eo *obj, Efl_Ui_Active_View_View_Manager_Plain_Data *pd)
}
EOLIAN static void
_efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_content_add(Eo *obj, Efl_Ui_Active_View_View_Manager_Plain_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_content_add(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
{
efl_canvas_group_member_add(pd->group, subobj);
efl_gfx_entity_visible_set(subobj, EINA_FALSE);
@ -104,13 +104,13 @@ _efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_content_a
}
EOLIAN static void
_efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_content_del(Eo *obj, Efl_Ui_Active_View_View_Manager_Plain_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_content_del(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
{
efl_canvas_group_member_remove(pd->group, subobj);
_content_changed(obj, pd);
}
EOLIAN static void
_efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_switch_to(Eo *obj, Efl_Ui_Active_View_View_Manager_Plain_Data *pd, int from EINA_UNUSED, int to)
_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, int from EINA_UNUSED, int to)
{
Efl_Gfx_Entity *to_obj, *from_obj;
to_obj = efl_pack_content_get(pd->container, to);
@ -132,14 +132,14 @@ _efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_switch_to
}
EOLIAN static void
_efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_view_size_set(Eo *obj, Efl_Ui_Active_View_View_Manager_Plain_Data *pd, Eina_Size2D size)
_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_size_set(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Eina_Size2D size)
{
pd->page_size = size;
_geom_sync(obj, pd);
}
EOLIAN static void
_efl_ui_active_view_view_manager_plain_efl_object_destructor(Eo *obj, Efl_Ui_Active_View_View_Manager_Plain_Data *pd EINA_UNUSED)
_efl_ui_spotlight_manager_plain_efl_object_destructor(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd EINA_UNUSED)
{
efl_destructor(efl_super(obj, MY_CLASS));
@ -153,16 +153,16 @@ _efl_ui_active_view_view_manager_plain_efl_object_destructor(Eo *obj, Efl_Ui_Act
}
EOLIAN static void
_efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_animation_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Plain_Data *pd, Eina_Bool animation)
_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_animation_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Eina_Bool animation)
{
pd->animation = animation;
}
EOLIAN static Eina_Bool
_efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_animation_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Plain_Data *pd)
_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_animation_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd)
{
return pd->animation;
}
#include "efl_ui_active_view_view_manager_plain.eo.c"
#include "efl_ui_spotlight_manager_plain.eo.c"

View File

@ -0,0 +1,12 @@
class @beta Efl.Ui.Spotlight.Manager_Plain extends Efl.Ui.Spotlight.Manager
{
implements {
Efl.Ui.Spotlight.Manager.bind;
Efl.Ui.Spotlight.Manager.content_add;
Efl.Ui.Spotlight.Manager.content_del;
Efl.Ui.Spotlight.Manager.switch_to;
Efl.Ui.Spotlight.Manager.size {set;}
Efl.Ui.Spotlight.Manager.animation_enabled {set; get;}
Efl.Object.destructor;
}
}

View File

@ -6,7 +6,7 @@
#include "elm_priv.h"
typedef struct {
Efl_Ui_Active_View_Container * container;
Efl_Ui_Spotlight_Container * container;
Efl_Gfx_Entity *group, *foreclip, *backclip;
Eina_Size2D page_size;
struct {
@ -22,20 +22,20 @@ typedef struct {
Eina_Position2D mouse_start;
} mouse_move;
Eina_Bool animation;
} Efl_Ui_Active_View_View_Manager_Scroll_Data;
} Efl_Ui_Spotlight_Manager_Scroll_Data;
#define MY_CLASS EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_SCROLL_CLASS
#define MY_CLASS EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS
static void _page_set_animation(void *data, const Efl_Event *event);
static void
_propagate_progress(Eo *obj, double pos)
{
efl_event_callback_call(obj, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_EVENT_POS_UPDATE, &pos);
efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &pos);
}
static void
_apply_box_properties(Eo *obj, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd)
_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);
@ -44,7 +44,7 @@ _apply_box_properties(Eo *obj, Efl_Ui_Active_View_View_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_active_view_active_index_get(pd->container);
current_pos = efl_ui_spotlight_active_index_get(pd->container);
efl_gfx_entity_geometry_set(pd->foreclip, group_pos);
//first calculate the size
@ -78,13 +78,13 @@ _apply_box_properties(Eo *obj, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd)
static void
_resize_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
_apply_box_properties(data, efl_data_scope_get(data, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_SCROLL_CLASS));
_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_ACTIVE_VIEW_VIEW_MANAGER_SCROLL_CLASS));
_apply_box_properties(data, efl_data_scope_get(data, EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS));
}
static void
@ -93,7 +93,7 @@ _mouse_down_cb(void *data,
{
Efl_Input_Pointer *ev = event->info;
Eo *obj = data;
Efl_Ui_Active_View_View_Manager_Scroll_Data *pd = efl_data_scope_get(obj, MY_CLASS);
Efl_Ui_Spotlight_Manager_Scroll_Data *pd = efl_data_scope_get(obj, MY_CLASS);
if (efl_input_pointer_button_get(ev) != 1) return;
if (efl_input_event_flags_get(ev) & EFL_INPUT_FLAGS_PROCESSED) return;
@ -103,7 +103,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_active_view_active_index_get(pd->container);
pd->mouse_move.from = efl_ui_spotlight_active_index_get(pd->container);
pd->mouse_move.mouse_start = efl_input_pointer_position_get(ev);
pd->transition.from = pd->mouse_move.from;
@ -117,7 +117,7 @@ _mouse_move_cb(void *data,
{
Efl_Input_Pointer *ev = event->info;
Eo *obj = data;
Efl_Ui_Active_View_View_Manager_Scroll_Data *pd = efl_data_scope_get(obj, MY_CLASS);
Efl_Ui_Spotlight_Manager_Scroll_Data *pd = efl_data_scope_get(obj, MY_CLASS);
Eina_Position2D pos;
int pos_y_diff;
@ -141,7 +141,7 @@ _mouse_up_cb(void *data,
{
Efl_Input_Pointer *ev = event->info;
Eo *obj = data;
Efl_Ui_Active_View_View_Manager_Scroll_Data *pd = efl_data_scope_get(obj, MY_CLASS);
Efl_Ui_Spotlight_Manager_Scroll_Data *pd = efl_data_scope_get(obj, MY_CLASS);
if (efl_input_event_flags_get(ev) & EFL_INPUT_FLAGS_PROCESSED) return;
if (!pd->mouse_move.active) return;
@ -149,7 +149,7 @@ _mouse_up_cb(void *data,
double absolut_current_position = (double)pd->transition.from + pd->transition.progress;
int result = round(absolut_current_position);
efl_ui_active_view_active_index_set(pd->container, MIN(MAX(result, 0), efl_content_count(pd->container) - 1));
efl_ui_spotlight_active_index_set(pd->container, MIN(MAX(result, 0), efl_content_count(pd->container) - 1));
}
EFL_CALLBACKS_ARRAY_DEFINE(mouse_listeners,
@ -159,11 +159,11 @@ EFL_CALLBACKS_ARRAY_DEFINE(mouse_listeners,
);
EOLIAN static void
_efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_bind(Eo *obj, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd, Efl_Ui_Active_View_Container *active_view, 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, Efl_Canvas_Group *group)
{
if (active_view && group)
if (spotlight && group)
{
pd->container = active_view;
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);
@ -177,8 +177,8 @@ _efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_bind(Eo
evas_object_static_clip_set(pd->backclip, EINA_TRUE);
efl_gfx_entity_visible_set(pd->backclip, EINA_FALSE);
for (int i = 0; i < efl_content_count(active_view) ; ++i) {
Efl_Gfx_Entity *elem = efl_pack_content_get(active_view, i);
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_gfx_entity_visible_set(elem, EINA_TRUE);
@ -191,7 +191,7 @@ _efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_bind(Eo
}
EOLIAN static void
_efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_content_add(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_content_add(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
{
efl_gfx_entity_visible_set(subobj, EINA_TRUE);
efl_canvas_object_clipper_set(subobj, pd->backclip);
@ -203,7 +203,7 @@ _efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_content_
EOLIAN static void
_efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_content_del(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
_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);
@ -215,7 +215,7 @@ _efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_content_
static void
_page_set_animation(void *data, const Efl_Event *event EINA_UNUSED)
{
Efl_Ui_Active_View_View_Manager_Scroll_Data *pd = efl_data_scope_get(data, MY_CLASS);
Efl_Ui_Spotlight_Manager_Scroll_Data *pd = efl_data_scope_get(data, MY_CLASS);
double p = (ecore_loop_time_get() - pd->transition.start_time) / pd->transition.max_time;
if (p >= 1.0) p = 1.0;
@ -234,7 +234,7 @@ _page_set_animation(void *data, const Efl_Event *event EINA_UNUSED)
}
static void
_animation_request_switch(Eo *obj, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd, int from, int to)
_animation_request_switch(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, int from, int to)
{
//if there is already a transition ongoing, which is no mouse transition, but goes to the same position, then do nothing
if (pd->transition.active && !pd->mouse_move.active && pd->transition.to == to)
@ -269,7 +269,7 @@ _animation_request_switch(Eo *obj, Efl_Ui_Active_View_View_Manager_Scroll_Data *
}
EOLIAN static void
_efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_switch_to(Eo *obj, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd, int from, int to)
_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, int from, int to)
{
if (pd->animation)
{
@ -285,7 +285,7 @@ _efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_switch_t
}
EOLIAN static void
_efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_view_size_set(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd, Eina_Size2D size)
_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_size_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Eina_Size2D size)
{
pd->page_size = size;
if (!pd->transition.active)
@ -293,7 +293,7 @@ _efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_view_siz
}
EOLIAN static void
_efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_animation_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd, Eina_Bool animation)
_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_animation_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Eina_Bool animation)
{
pd->animation = animation;
if (pd->transition.active && !animation)
@ -305,14 +305,14 @@ _efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_animatio
}
EOLIAN static Eina_Bool
_efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_animation_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd)
_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_animation_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd)
{
return pd->animation;
}
EOLIAN static void
_efl_ui_active_view_view_manager_scroll_efl_object_destructor(Eo *obj, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd EINA_UNUSED)
_efl_ui_spotlight_manager_scroll_efl_object_destructor(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);
@ -329,4 +329,4 @@ _efl_ui_active_view_view_manager_scroll_efl_object_destructor(Eo *obj, Efl_Ui_Ac
}
#include "efl_ui_active_view_view_manager_scroll.eo.c"
#include "efl_ui_spotlight_manager_scroll.eo.c"

View File

@ -0,0 +1,12 @@
class @beta Efl.Ui.Spotlight.Manager_Scroll extends Efl.Ui.Spotlight.Manager
{
implements {
Efl.Ui.Spotlight.Manager.bind;
Efl.Ui.Spotlight.Manager.content_add;
Efl.Ui.Spotlight.Manager.content_del;
Efl.Ui.Spotlight.Manager.switch_to;
Efl.Ui.Spotlight.Manager.size {set;}
Efl.Ui.Spotlight.Manager.animation_enabled {set; get;}
Efl.Object.destructor;
}
}

View File

@ -7,19 +7,19 @@
typedef struct {
Efl_Ui_Active_View_Container * container;
Efl_Ui_Spotlight_Container * container;
Efl_Gfx_Entity *group;
Efl_Canvas_Animation_Player *hide, *show;
int from, to;
Efl_Gfx_Entity *content;
Eina_Size2D page_size;
Eina_Bool animation;
} Efl_Ui_Active_View_View_Manager_Stack_Data;
} Efl_Ui_Spotlight_Manager_Stack_Data;
#define MY_CLASS EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_STACK_CLASS
#define MY_CLASS EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS
static void
_geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Stack_Data *pd)
_geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd)
{
Eina_Array *array = eina_array_new(2);
Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->group);
@ -61,11 +61,11 @@ _move_cb(void *data, const Efl_Event *ev EINA_UNUSED)
static void
_running_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Efl_Ui_Active_View_View_Manager_Stack_Data *pd = efl_data_scope_safe_get(data, MY_CLASS);
Efl_Ui_Spotlight_Manager_Stack_Data *pd = efl_data_scope_safe_get(data, MY_CLASS);
//calculate absolut position, multiply pos with 2.0 because duration is only 0.5)
double absolut_position = pd->from + (pd->to - pd->from)*(efl_player_pos_get(pd->show)*2.0);
efl_event_callback_call(data, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_EVENT_POS_UPDATE, &absolut_position);
efl_event_callback_call(data, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &absolut_position);
}
static void
@ -80,7 +80,7 @@ _anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event)
static void
_hide_anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
{
Efl_Ui_Active_View_View_Manager_Stack_Data *pd = efl_data_scope_safe_get(data, MY_CLASS);
Efl_Ui_Spotlight_Manager_Stack_Data *pd = efl_data_scope_safe_get(data, MY_CLASS);
Efl_Canvas_Object *content;
EINA_SAFETY_ON_NULL_RETURN(pd);
@ -91,7 +91,7 @@ _hide_anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
static void
_show_anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
{
Efl_Ui_Active_View_View_Manager_Stack_Data *pd = efl_data_scope_safe_get(data, MY_CLASS);
Efl_Ui_Spotlight_Manager_Stack_Data *pd = efl_data_scope_safe_get(data, MY_CLASS);
Efl_Canvas_Object *content;
EINA_SAFETY_ON_NULL_RETURN(pd);
@ -112,12 +112,12 @@ EFL_CALLBACKS_ARRAY_DEFINE(_anim_hide_event_cb,
)
EOLIAN static void
_efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_bind(Eo *obj, Efl_Ui_Active_View_View_Manager_Stack_Data *pd, Efl_Ui_Active_View_Container *active_view, 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, Efl_Canvas_Group *group)
{
if (active_view && group)
if (spotlight && group)
{
Efl_Canvas_Animation_Alpha *show_anim, *hide_anim;
pd->container = active_view;
pd->container = spotlight;
pd->group = group;
efl_event_callback_add(pd->group, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb, obj);
@ -144,14 +144,14 @@ _efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_bind(Eo *
efl_player_play_set(pd->hide, EINA_FALSE);
efl_event_callback_array_add(pd->hide, _anim_hide_event_cb(), obj);
for (int i = 0; i < efl_content_count(active_view) ; ++i) {
Efl_Gfx_Entity *elem = efl_pack_content_get(active_view, i);
for (int i = 0; i < efl_content_count(spotlight) ; ++i) {
Efl_Gfx_Entity *elem = efl_pack_content_get(spotlight, i);
efl_canvas_group_member_add(pd->group, elem);
efl_gfx_entity_visible_set(elem, EINA_FALSE);
}
if (efl_ui_active_view_active_index_get(active_view) != -1)
if (efl_ui_spotlight_active_index_get(spotlight) != -1)
{
pd->content = efl_pack_content_get(pd->container, efl_ui_active_view_active_index_get(active_view));
pd->content = efl_pack_content_get(pd->container, efl_ui_spotlight_active_index_get(spotlight));
efl_gfx_entity_visible_set(pd->content, EINA_TRUE);
_geom_sync(obj, pd);
}
@ -159,14 +159,14 @@ _efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_bind(Eo *
}
EOLIAN static void
_efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_content_add(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Stack_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_content_add(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
{
efl_canvas_group_member_add(pd->group, subobj);
efl_gfx_entity_visible_set(subobj, EINA_FALSE);
}
EOLIAN static void
_efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_content_del(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Stack_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_content_del(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
{
efl_canvas_group_member_remove(pd->group, subobj);
}
@ -189,7 +189,7 @@ is_valid(Eo *obj, int index)
}
EOLIAN static void
_efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_switch_to(Eo *obj, Efl_Ui_Active_View_View_Manager_Stack_Data *pd, int from, int to)
_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl_Ui_Spotlight_Manager_Stack_Data *pd, int from, int to)
{
if (efl_pack_content_get(pd->container, to) == pd->content)
return;
@ -217,21 +217,21 @@ _efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_switch_to
pd->content = efl_pack_content_get(pd->container, to);
efl_gfx_entity_visible_set(pd->content, EINA_TRUE);
efl_event_callback_call(obj, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_EVENT_POS_UPDATE, &pos);
efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &pos);
}
_geom_sync(obj, pd);
}
EOLIAN static void
_efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_view_size_set(Eo *obj, Efl_Ui_Active_View_View_Manager_Stack_Data *pd, Eina_Size2D size)
_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_size_set(Eo *obj, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Eina_Size2D size)
{
pd->page_size = size;
_geom_sync(obj, pd);
}
EOLIAN static void
_efl_ui_active_view_view_manager_stack_efl_object_destructor(Eo *obj, Efl_Ui_Active_View_View_Manager_Stack_Data *pd EINA_UNUSED)
_efl_ui_spotlight_manager_stack_efl_object_destructor(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);
@ -260,7 +260,7 @@ _reset_player(Efl_Animation_Player *player, Eina_Bool vis)
}
EOLIAN static void
_efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_animation_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Stack_Data *pd, Eina_Bool animation)
_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_animation_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Eina_Bool animation)
{
_reset_player(pd->hide, EINA_FALSE);
_reset_player(pd->show, EINA_TRUE);
@ -268,10 +268,10 @@ _efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_animation
}
EOLIAN static Eina_Bool
_efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_animation_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Stack_Data *pd)
_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_animation_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd)
{
return pd->animation;
}
#include "efl_ui_active_view_view_manager_stack.eo.c"
#include "efl_ui_spotlight_manager_stack.eo.c"

View File

@ -0,0 +1,12 @@
class @beta Efl.Ui.Spotlight.Manager_Stack extends Efl.Ui.Spotlight.Manager
{
implements {
Efl.Ui.Spotlight.Manager.bind;
Efl.Ui.Spotlight.Manager.content_add;
Efl.Ui.Spotlight.Manager.content_del;
Efl.Ui.Spotlight.Manager.switch_to;
Efl.Ui.Spotlight.Manager.size {set;}
Efl.Ui.Spotlight.Manager.animation_enabled {set; get;}
Efl.Object.destructor;
}
}

View File

@ -0,0 +1,21 @@
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#include <Efl_Ui.h>
#include "elm_priv.h"
typedef struct {
} Efl_Ui_Spotlight_Util_Data;
EOLIAN static Efl_Ui_Spotlight_Container*
_efl_ui_spotlight_util_stack_gen(Efl_Ui_Widget *parent)
{
Efl_Ui_Spotlight_Manager *manager = efl_add(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS, parent);
return efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, parent,
efl_ui_spotlight_manager_set(efl_added, manager));
}
#include "efl_ui_spotlight_util.eo.c"

View File

@ -1,11 +1,11 @@
class @beta Efl.Ui.Active_View.Util {
class @beta Efl.Ui.Spotlight.Util {
methods {
stack_gen @class {
[[Get a preconfigured stack obejct]]
params {
parent : Efl.Ui.Widget;
}
return : Efl.Ui.Active_View.Container;
return : Efl.Ui.Spotlight.Container;
}
}
}

View File

@ -25,8 +25,8 @@ static void
_tab_select_cb(void *data, const Efl_Event *event)
{
int index = efl_ui_tab_bar_current_tab_get(event->object);
if (efl_ui_active_view_active_index_get(data) != index)
efl_ui_active_view_active_index_set(data, index);
if (efl_ui_spotlight_active_index_get(data) != index)
efl_ui_spotlight_active_index_set(data, index);
}
static void
@ -77,9 +77,9 @@ _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_active_view_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_index_set(Eo *obj, Efl_Ui_Tab_Pager_Data *sd EINA_UNUSED, int index)
{
efl_ui_active_view_active_index_set(efl_super(obj, MY_CLASS), index);
efl_ui_spotlight_active_index_set(efl_super(obj, MY_CLASS), index);
_select(obj, index);
}

View File

@ -1,4 +1,4 @@
class @beta Efl.Ui.Tab_Pager extends Efl.Ui.Active_View.Container
class @beta Efl.Ui.Tab_Pager extends Efl.Ui.Spotlight.Container
{
[[Tab Pager class]]
methods {
@ -23,6 +23,6 @@ class @beta Efl.Ui.Tab_Pager extends Efl.Ui.Active_View.Container
Efl.Pack_Linear.pack_content_get;
Efl.Pack_Linear.pack_index_get;
Efl.Pack_Linear.pack_unpack_at; // TODO
Efl.Ui.Active_View.Container.active_index { set; }
Efl.Ui.Spotlight.Container.active_index { set; }
}
}

View File

@ -154,13 +154,13 @@ pub_eo_files = [
'efl_ui_dnd.eo',
'efl_ui_dnd_container.eo',
'efl_ui_focus_manager_window_root.eo',
'efl_ui_active_view_container.eo',
'efl_ui_active_view_view_manager.eo',
'efl_ui_active_view_view_manager_scroll.eo',
'efl_ui_active_view_view_manager_stack.eo',
'efl_ui_active_view_indicator.eo',
'efl_ui_active_view_indicator_icon.eo',
'efl_ui_active_view_util.eo',
'efl_ui_spotlight_container.eo',
'efl_ui_spotlight_manager.eo',
'efl_ui_spotlight_manager_scroll.eo',
'efl_ui_spotlight_manager_stack.eo',
'efl_ui_spotlight_indicator.eo',
'efl_ui_spotlight_indicator_icon.eo',
'efl_ui_spotlight_util.eo',
'efl_ui_tab_pager.eo',
'efl_ui_tab_bar.eo',
'efl_ui_tab_page.eo',
@ -234,7 +234,7 @@ priv_eo_files = [
'efl_ui_homogeneous_model.eo',
'efl_ui_exact_model.eo',
'efl_ui_average_model.eo',
'efl_ui_active_view_view_manager_plain.eo',
'efl_ui_spotlight_manager_plain.eo',
]
priv_eo_file_target = []
@ -913,14 +913,14 @@ elementary_src = [
'efl_datetime_manager.c',
'efl_ui_dnd.c',
'elm_focus_legacy.c',
'efl_ui_active_view_container.c',
'efl_ui_active_view_view_manager.c',
'efl_ui_active_view_view_manager_plain.c',
'efl_ui_active_view_view_manager_scroll.c',
'efl_ui_active_view_view_manager_stack.c',
'efl_ui_active_view_indicator.c',
'efl_ui_active_view_indicator_icon.c',
'efl_ui_active_view_util.c',
'efl_ui_spotlight_container.c',
'efl_ui_spotlight_manager.c',
'efl_ui_spotlight_manager_plain.c',
'efl_ui_spotlight_manager_scroll.c',
'efl_ui_spotlight_manager_stack.c',
'efl_ui_spotlight_indicator.c',
'efl_ui_spotlight_indicator_icon.c',
'efl_ui_spotlight_util.c',
'efl_ui_focus_graph.h',
'efl_ui_focus_graph.c',
'efl_ui_tab_pager.c',

View File

@ -24,7 +24,7 @@ static const Efl_Test_Case etc[] = {
{ "efl_ui_layout", efl_ui_test_layout},
{ "Efl_Ui_Model", efl_ui_model },
{ "efl_ui_widget", efl_ui_test_widget },
{ "efl_ui_active_view", efl_ui_test_active_view},
{ "efl_ui_spotlight", efl_ui_test_spotlight},
{ "efl_ui_check", efl_ui_test_check },
{ "efl_ui_progressbar", efl_ui_test_progressbar },
{ "efl_ui_radio_group", efl_ui_test_radio_group },

View File

@ -35,7 +35,7 @@ void efl_ui_test_focus(TCase *tc);
void efl_ui_test_focus_sub(TCase *tc);
void efl_ui_model(TCase *tc);
void efl_ui_test_widget(TCase *tc);
void efl_ui_test_active_view(TCase *tc);
void efl_ui_test_spotlight(TCase *tc);
void efl_ui_test_check(TCase *tc);
void efl_ui_test_progressbar(TCase *tc);
void efl_ui_test_radio_group(TCase *tc);

View File

@ -6,11 +6,11 @@
#include "efl_ui_suite.h"
#include "eo_internal.h"
EFL_CLASS_SIMPLE_CLASS(efl_ui_active_view_view_manager, "efl_ui_active_view_view_manager", EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_CLASS);
EFL_CLASS_SIMPLE_CLASS(efl_ui_active_view_indicator, "efl_ui_active_view_indicator", EFL_UI_ACTIVE_VIEW_INDICATOR_CLASS);
EFL_CLASS_SIMPLE_CLASS(efl_ui_spotlight_manager, "efl_ui_spotlight_manager", EFL_UI_SPOTLIGHT_MANAGER_CLASS);
EFL_CLASS_SIMPLE_CLASS(efl_ui_spotlight_indicator, "efl_ui_spotlight_indicator", EFL_UI_SPOTLIGHT_INDICATOR_CLASS);
static Efl_Ui_Win *win;
static Efl_Ui_Active_View_Container *container;
static Efl_Ui_Spotlight_Container *container;
typedef struct {
struct {
@ -31,8 +31,8 @@ typedef struct {
} content_add;
struct {
int called;
Efl_Ui_Active_View_Container *active_view;
} active_view;
Efl_Ui_Spotlight_Container *spotlight;
} spotlight;
} Indicator_Calls;
Indicator_Calls indicator_calls = { 0 };
@ -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_active_view_active_index_get(container);
indicator_calls.content_del.current_page_at_call = efl_ui_spotlight_active_index_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_active_view_active_index_get(container);
indicator_calls.content_add.current_page_at_call = efl_ui_spotlight_active_index_get(container);
}
static void
@ -63,25 +63,25 @@ _indicator_position_update(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, double pos
}
static void
_indicator_bind(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Ui_Active_View_Container *active_view)
_indicator_bind(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Ui_Spotlight_Container *spotlight)
{
indicator_calls.active_view.called++;
indicator_calls.active_view.active_view = active_view;
indicator_calls.spotlight.called++;
indicator_calls.spotlight.spotlight = spotlight;
}
EFL_OPS_DEFINE(indicator_tracker,
EFL_OBJECT_OP_FUNC(efl_ui_active_view_indicator_content_add, _indicator_content_add),
EFL_OBJECT_OP_FUNC(efl_ui_active_view_indicator_content_del, _indicator_content_del),
EFL_OBJECT_OP_FUNC(efl_ui_active_view_indicator_position_update, _indicator_position_update),
EFL_OBJECT_OP_FUNC(efl_ui_active_view_indicator_bind, _indicator_bind),
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_indicator_content_add, _indicator_content_add),
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_indicator_content_del, _indicator_content_del),
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_indicator_position_update, _indicator_position_update),
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_indicator_bind, _indicator_bind),
);
static Efl_Ui_Active_View_View_Manager*
static Efl_Ui_Spotlight_Manager*
_create_indicator(void)
{
Eo *obj;
obj = efl_add(efl_ui_active_view_indicator_realized_class_get(), win);
obj = efl_add(efl_ui_spotlight_indicator_realized_class_get(), win);
efl_object_override(obj, &indicator_tracker);
return obj;
@ -111,9 +111,9 @@ typedef struct {
} page_size;
struct {
int called;
Efl_Ui_Active_View_Container *active_view;
Efl_Ui_Spotlight_Container *spotlight;
Efl_Canvas_Group *group;
} active_view;
} spotlight;
struct {
int called;
} animation;
@ -126,7 +126,7 @@ static void
_emit_pos(Eo *obj, double d)
{
if (d == transition_calls.last_position) return;
efl_event_callback_call(obj, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_EVENT_POS_UPDATE, &d);
efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &d);
transition_calls.last_position = d;
}
@ -136,9 +136,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_active_view_active_index_get(container);
transition_calls.content_add.current_page_at_call = efl_ui_spotlight_active_index_get(container);
int i = efl_ui_active_view_active_index_get(container);
int i = efl_ui_spotlight_active_index_get(container);
if (i != -1)
_emit_pos(obj, i);
}
@ -149,9 +149,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_active_view_active_index_get(container);
transition_calls.content_del.current_page_at_call = efl_ui_spotlight_active_index_get(container);
int i = efl_ui_active_view_active_index_get(container);
int i = efl_ui_spotlight_active_index_get(container);
if (i != -1)
_emit_pos(obj, i);
}
@ -174,11 +174,11 @@ _transition_page_size_set(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Eina_Size2D
}
static void
_transition_bind(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Ui_Active_View_Container *active_view, Efl_Canvas_Group *group)
_transition_bind(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Ui_Spotlight_Container *spotlight, Efl_Canvas_Group *group)
{
transition_calls.active_view.called++;
transition_calls.active_view.active_view = active_view;
transition_calls.active_view.group = group;
transition_calls.spotlight.called++;
transition_calls.spotlight.spotlight = spotlight;
transition_calls.spotlight.group = group;
}
static void
@ -195,71 +195,71 @@ _transition_animation_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
}
EFL_OPS_DEFINE(transition_tracker,
EFL_OBJECT_OP_FUNC(efl_ui_active_view_view_manager_animation_enabled_set, _transition_animation_set),
EFL_OBJECT_OP_FUNC(efl_ui_active_view_view_manager_animation_enabled_get, _transition_animation_get),
EFL_OBJECT_OP_FUNC(efl_ui_active_view_view_manager_content_add, _transition_content_add),
EFL_OBJECT_OP_FUNC(efl_ui_active_view_view_manager_content_del, _transition_content_del),
EFL_OBJECT_OP_FUNC(efl_ui_active_view_view_manager_switch_to, _transition_request_switch),
EFL_OBJECT_OP_FUNC(efl_ui_active_view_view_manager_view_size_set, _transition_page_size_set),
EFL_OBJECT_OP_FUNC(efl_ui_active_view_view_manager_bind, _transition_bind),
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_animation_enabled_set, _transition_animation_set),
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_animation_enabled_get, _transition_animation_get),
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_content_add, _transition_content_add),
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_content_del, _transition_content_del),
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_switch_to, _transition_request_switch),
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_size_set, _transition_page_size_set),
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_bind, _transition_bind),
);
static Efl_Ui_Active_View_View_Manager*
static Efl_Ui_Spotlight_Manager*
_create_transition(void)
{
Eo *obj;
obj = efl_add(efl_ui_active_view_view_manager_realized_class_get(), win);
obj = efl_add(efl_ui_spotlight_manager_realized_class_get(), win);
efl_object_override(obj, &transition_tracker);
return obj;
}
EFL_START_TEST (efl_ui_active_view_init)
EFL_START_TEST (efl_ui_spotlight_init)
{
ck_assert_ptr_ne(container, NULL);
ck_assert_ptr_ne(win, NULL);
ck_assert_ptr_eq(efl_ui_active_view_indicator_get(container), NULL);
ck_assert_ptr_eq(efl_ui_active_view_manager_get(container), NULL);
Eina_Size2D s = efl_ui_active_view_size_get(container);
ck_assert_ptr_eq(efl_ui_spotlight_indicator_get(container), NULL);
ck_assert_ptr_eq(efl_ui_spotlight_manager_get(container), NULL);
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_active_view_active_index_get(container), -1);
ck_assert_int_eq(efl_ui_spotlight_active_index_get(container), -1);
}
EFL_END_TEST
EFL_START_TEST (efl_ui_active_view_active_index)
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_active_view_active_index_get(container), 0);
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_active_view_active_index_set(container, i);
efl_ui_spotlight_active_index_set(container, i);
EXPECT_ERROR_END;
}
efl_del(w);
ck_assert_int_eq(efl_ui_active_view_active_index_get(container), -1);
ck_assert_int_eq(efl_ui_spotlight_active_index_get(container), -1);
}
EFL_END_TEST
EFL_START_TEST (efl_ui_smart_transition_calls)
{
Efl_Ui_Widget *w, *w1, *w2;
Efl_Ui_Active_View_View_Manager*t = _create_transition();
Efl_Ui_Spotlight_Manager*t = _create_transition();
w = efl_add(WIDGET_CLASS, win);
w1 = efl_add(WIDGET_CLASS, win);
w2 = efl_add(WIDGET_CLASS, win);
efl_ui_active_view_manager_set(container, t);
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.active_view.called, 1);
ck_assert_ptr_eq(transition_calls.active_view.active_view, container);
ck_assert_int_eq(transition_calls.spotlight.called, 1);
ck_assert_ptr_eq(transition_calls.spotlight.spotlight, container);
//We cannot verify group
ck_assert_int_eq(transition_calls.page_size.called, 1);
ck_assert_int_eq(transition_calls.page_size.size.w, 0); //FIXME
@ -267,12 +267,12 @@ EFL_START_TEST (efl_ui_smart_transition_calls)
ck_assert_int_eq(transition_calls.request_switch.called, 0);
ck_assert_int_eq(transition_calls.content_add.called, 0);
ck_assert_int_eq(transition_calls.content_del.called, 0);
transition_calls.active_view.called = 0;
transition_calls.spotlight.called = 0;
transition_calls.page_size.called = 0;
//must update content, and request a switch from -1 to 1
efl_pack(container, w);
ck_assert_int_eq(transition_calls.active_view.called, 0);
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);
ck_assert_int_eq(transition_calls.request_switch.from, -1);
@ -287,7 +287,7 @@ EFL_START_TEST (efl_ui_smart_transition_calls)
//this must update content and a updated current page, but no other call
efl_pack_begin(container, w1);
ck_assert_int_eq(transition_calls.active_view.called, 0);
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, 0);
ck_assert_int_eq(transition_calls.content_add.called, 1);
@ -297,11 +297,11 @@ EFL_START_TEST (efl_ui_smart_transition_calls)
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_active_view_active_index_get(container), 1);
ck_assert_int_eq(efl_ui_spotlight_active_index_get(container), 1);
//new object, must update the content and a not update current page
efl_pack_end(container, w2);
ck_assert_int_eq(transition_calls.active_view.called, 0);
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, 0);
ck_assert_int_eq(transition_calls.content_add.called, 1);
@ -310,11 +310,11 @@ EFL_START_TEST (efl_ui_smart_transition_calls)
ck_assert_int_eq(transition_calls.content_add.current_page_at_call, 1);
ck_assert_int_eq(transition_calls.content_del.called, 0);
transition_calls.content_add.called = 0;
ck_assert_int_eq(efl_ui_active_view_active_index_get(container), 1);
ck_assert_int_eq(efl_ui_spotlight_active_index_get(container), 1);
//page change must result in a call to request a switch
efl_ui_active_view_active_index_set(container, 2);
ck_assert_int_eq(transition_calls.active_view.called, 0);
efl_ui_spotlight_active_index_set(container, 2);
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);
ck_assert_int_eq(transition_calls.request_switch.from, 1);
@ -325,7 +325,7 @@ EFL_START_TEST (efl_ui_smart_transition_calls)
//deletion of object must result in a content update
efl_del(w);
ck_assert_int_eq(transition_calls.active_view.called, 0);
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, 0);
ck_assert_int_eq(transition_calls.content_add.called, 0);
@ -340,15 +340,15 @@ EFL_END_TEST
EFL_START_TEST (efl_ui_smart_transition_lifetime)
{
Efl_Ui_Active_View_View_Manager*t, *t1;
Efl_Ui_Spotlight_Manager*t, *t1;
t = _create_transition();
efl_wref_add(t, &t);
t1 = _create_transition();
efl_wref_add(t1, &t1);
efl_ui_active_view_manager_set(container, t);
efl_ui_active_view_manager_set(container, t1);
efl_ui_spotlight_manager_set(container, t);
efl_ui_spotlight_manager_set(container, t1);
ck_assert_ptr_eq(t, NULL);
}
EFL_END_TEST
@ -362,15 +362,15 @@ _verify_indicator_calls(void)
w1 = efl_add(WIDGET_CLASS, win);
w2 = efl_add(WIDGET_CLASS, win);
ck_assert_int_eq(indicator_calls.active_view.called, 1);
ck_assert_ptr_eq(indicator_calls.active_view.active_view, container);
ck_assert_int_eq(indicator_calls.spotlight.called, 1);
ck_assert_ptr_eq(indicator_calls.spotlight.spotlight, container);
ck_assert_int_eq(indicator_calls.content_add.called, 0);
ck_assert_int_eq(indicator_calls.content_del.called, 0);
ck_assert_int_eq(indicator_calls.position_update.called, 0);
indicator_calls.active_view.called = 0;
indicator_calls.spotlight.called = 0;
efl_pack(container, w);
ck_assert_int_eq(indicator_calls.active_view.called, 0);
ck_assert_int_eq(indicator_calls.spotlight.called, 0);
ck_assert_int_eq(indicator_calls.content_add.called, 1);
ck_assert_int_eq(indicator_calls.content_add.index, 0);
ck_assert_ptr_eq(indicator_calls.content_add.subobj, w);
@ -381,7 +381,7 @@ _verify_indicator_calls(void)
indicator_calls.position_update.called = 0;
efl_pack_begin(container, w1);
ck_assert_int_eq(indicator_calls.active_view.called, 0);
ck_assert_int_eq(indicator_calls.spotlight.called, 0);
ck_assert_int_eq(indicator_calls.content_add.called, 1);
ck_assert_int_eq(indicator_calls.content_add.index, 0);
ck_assert_ptr_eq(indicator_calls.content_add.subobj, w1);
@ -392,7 +392,7 @@ _verify_indicator_calls(void)
indicator_calls.position_update.called = 0;
efl_pack_end(container, w2);
ck_assert_int_eq(indicator_calls.active_view.called, 0);
ck_assert_int_eq(indicator_calls.spotlight.called, 0);
ck_assert_int_eq(indicator_calls.content_add.called, 1);
ck_assert_int_eq(indicator_calls.content_add.index, 2);
ck_assert_ptr_eq(indicator_calls.content_add.subobj, w2);
@ -402,7 +402,7 @@ _verify_indicator_calls(void)
indicator_calls.position_update.called = 0;
efl_del(w1);
ck_assert_int_eq(indicator_calls.active_view.called, 0);
ck_assert_int_eq(indicator_calls.spotlight.called, 0);
ck_assert_int_eq(indicator_calls.content_add.called, 0);
ck_assert_int_eq(indicator_calls.content_del.called, 1);
ck_assert_int_eq(indicator_calls.content_del.index, 0);
@ -415,41 +415,41 @@ _verify_indicator_calls(void)
EFL_START_TEST (efl_ui_smart_indicator_calls)
{
Efl_Ui_Active_View_View_Manager*i = _create_indicator();
efl_ui_active_view_indicator_set(container, i);
Efl_Ui_Spotlight_Manager*i = _create_indicator();
efl_ui_spotlight_indicator_set(container, i);
_verify_indicator_calls();
}
EFL_END_TEST
EFL_START_TEST (efl_ui_smart_indicator_transition_calls)
{
Efl_Ui_Active_View_View_Manager *i = _create_indicator();
Efl_Ui_Active_View_View_Manager *t = _create_transition();
Efl_Ui_Spotlight_Manager *i = _create_indicator();
Efl_Ui_Spotlight_Manager *t = _create_transition();
transition_calls.last_position = -2.0;
efl_ui_active_view_indicator_set(container, i);
efl_ui_active_view_manager_set(container, t);
efl_ui_spotlight_indicator_set(container, i);
efl_ui_spotlight_manager_set(container, t);
_verify_indicator_calls();
}
EFL_END_TEST
Efl_Ui_Active_View_Transition_Event start;
Efl_Ui_Active_View_Transition_Event end;
Efl_Ui_Spotlight_Transition_Event start;
Efl_Ui_Spotlight_Transition_Event end;
static void
_start(void *data EINA_UNUSED, const Efl_Event *ev)
{
Efl_Ui_Active_View_Transition_Event *e = ev->info;
Efl_Ui_Spotlight_Transition_Event *e = ev->info;
memcpy(&start, e, sizeof(Efl_Ui_Active_View_Transition_Event));
memcpy(&start, e, sizeof(Efl_Ui_Spotlight_Transition_Event));
}
static void
_end(void *data EINA_UNUSED, const Efl_Event *ev)
{
Efl_Ui_Active_View_Transition_Event *e = ev->info;
Efl_Ui_Spotlight_Transition_Event *e = ev->info;
memcpy(&end, e, sizeof(Efl_Ui_Active_View_Transition_Event));
memcpy(&end, e, sizeof(Efl_Ui_Spotlight_Transition_Event));
}
#define EV_RESET \
@ -467,8 +467,8 @@ _verify_transition_start_end_events(void)
w1 = efl_add(WIDGET_CLASS, win);
w2 = efl_add(WIDGET_CLASS, win);
efl_event_callback_add(container, EFL_UI_ACTIVE_VIEW_EVENT_TRANSITION_START, _start, NULL);
efl_event_callback_add(container, EFL_UI_ACTIVE_VIEW_EVENT_TRANSITION_END, _end, NULL);
efl_event_callback_add(container, EFL_UI_SPOTLIGHT_EVENT_TRANSITION_START, _start, NULL);
efl_event_callback_add(container, EFL_UI_SPOTLIGHT_EVENT_TRANSITION_END, _end, NULL);
EV_RESET
efl_pack_end(container, w);
@ -486,14 +486,14 @@ _verify_transition_start_end_events(void)
ck_assert_int_eq(end.from, -8);
EV_RESET
efl_ui_active_view_active_index_set(container, 2);
efl_ui_spotlight_active_index_set(container, 2);
ck_assert_int_eq(start.to, 2);
ck_assert_int_eq(end.to, 2);
ck_assert_int_eq(start.from, 1);
ck_assert_int_eq(end.from, 1);
}
EFL_START_TEST (efl_ui_active_view_view_manager_start_end)
EFL_START_TEST (efl_ui_spotlight_manager_start_end)
{
transition_calls.last_position = -2.0;
@ -501,7 +501,7 @@ EFL_START_TEST (efl_ui_active_view_view_manager_start_end)
}
EFL_END_TEST
EFL_START_TEST (efl_ui_active_view_test_push1)
EFL_START_TEST (efl_ui_spotlight_test_push1)
{
for (int i = 0; i < 5; ++i)
{
@ -509,25 +509,25 @@ EFL_START_TEST (efl_ui_active_view_test_push1)
efl_pack_end(container, w);
}
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
efl_ui_active_view_push(container, w);
efl_ui_spotlight_push(container, w);
ck_assert_int_eq(efl_pack_index_get(container, w), 0);
ck_assert_int_eq(efl_ui_active_view_active_index_get(container), 0);
ck_assert_int_eq(efl_ui_spotlight_active_index_get(container), 0);
}
EFL_END_TEST
EFL_START_TEST (efl_ui_active_view_test_push2)
EFL_START_TEST (efl_ui_spotlight_test_push2)
{
for (int i = 0; i < 5; ++i)
{
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
efl_pack_end(container, w);
}
efl_ui_active_view_active_index_set(container, 3);
efl_ui_spotlight_active_index_set(container, 3);
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
efl_ui_active_view_push(container, w);
efl_ui_spotlight_push(container, w);
ck_assert_int_eq(efl_pack_index_get(container, w), 3);
ck_assert_int_eq(efl_ui_active_view_active_index_get(container), 3);
ck_assert_int_eq(efl_ui_spotlight_active_index_get(container), 3);
}
EFL_END_TEST
@ -541,7 +541,7 @@ _then_cb(void *data, const Eina_Value v, const Eina_Future *dead_future EINA_UNU
return EINA_VALUE_EMPTY;
}
EFL_START_TEST (efl_ui_active_view_test_pop1)
EFL_START_TEST (efl_ui_spotlight_test_pop1)
{
Eo *called;
for (int i = 0; i < 5; ++i)
@ -550,8 +550,8 @@ EFL_START_TEST (efl_ui_active_view_test_pop1)
efl_pack_end(container, w);
}
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
efl_ui_active_view_push(container, w);
Eina_Future *f = efl_ui_active_view_pop(container, EINA_FALSE);
efl_ui_spotlight_push(container, w);
Eina_Future *f = efl_ui_spotlight_pop(container, EINA_FALSE);
eina_future_then(f, _then_cb, &called);
for (int i = 0; i < 10; ++i)
{
@ -564,7 +564,7 @@ EFL_START_TEST (efl_ui_active_view_test_pop1)
}
EFL_END_TEST
EFL_START_TEST (efl_ui_active_view_test_pop2)
EFL_START_TEST (efl_ui_spotlight_test_pop2)
{
for (int i = 0; i < 5; ++i)
{
@ -572,8 +572,8 @@ EFL_START_TEST (efl_ui_active_view_test_pop2)
efl_pack_end(container, w);
}
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
efl_ui_active_view_push(container, w);
Eina_Future *f = efl_ui_active_view_pop(container, EINA_TRUE);
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));
@ -584,7 +584,7 @@ EFL_START_TEST (efl_ui_active_view_test_pop2)
}
EFL_END_TEST
EFL_START_TEST (efl_ui_active_view_test_pop3)
EFL_START_TEST (efl_ui_spotlight_test_pop3)
{
for (int i = 0; i < 5; ++i)
{
@ -592,14 +592,14 @@ EFL_START_TEST (efl_ui_active_view_test_pop3)
efl_pack_end(container, w);
}
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
efl_ui_active_view_active_index_set(container, 3);
efl_ui_active_view_push(container, w);
Eina_Future *f = efl_ui_active_view_pop(container, EINA_TRUE);
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_active_view_active_index_get(container), 3);
ck_assert_int_eq(efl_ui_spotlight_active_index_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);
@ -607,38 +607,38 @@ EFL_START_TEST (efl_ui_active_view_test_pop3)
EFL_END_TEST
static void
active_view_setup()
spotlight_setup()
{
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC));
container = efl_add(EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS, win,
container = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, win,
efl_content_set(win, efl_added));
efl_gfx_entity_size_set(win, EINA_SIZE2D(200, 200));
}
static void
active_view_teardown()
spotlight_teardown()
{
memset(&transition_calls, 0, sizeof(transition_calls));
memset(&indicator_calls, 0, sizeof(indicator_calls));
}
void efl_ui_test_active_view(TCase *tc)
void efl_ui_test_spotlight(TCase *tc)
{
tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
tcase_add_checked_fixture(tc, active_view_setup, active_view_teardown);
tcase_add_test(tc, efl_ui_active_view_init);
tcase_add_test(tc, efl_ui_active_view_active_index);
tcase_add_checked_fixture(tc, spotlight_setup, spotlight_teardown);
tcase_add_test(tc, efl_ui_spotlight_init);
tcase_add_test(tc, efl_ui_spotlight_active_index);
tcase_add_test(tc, efl_ui_smart_transition_calls);
tcase_add_test(tc, efl_ui_smart_transition_lifetime);
tcase_add_test(tc, efl_ui_smart_indicator_calls);
tcase_add_test(tc, efl_ui_smart_indicator_transition_calls);
tcase_add_test(tc, efl_ui_active_view_view_manager_start_end);
tcase_add_test(tc, efl_ui_active_view_test_push1);
tcase_add_test(tc, efl_ui_active_view_test_push2);
tcase_add_test(tc, efl_ui_active_view_test_pop1);
tcase_add_test(tc, efl_ui_active_view_test_pop2);
tcase_add_test(tc, efl_ui_active_view_test_pop3);
tcase_add_test(tc, efl_ui_spotlight_manager_start_end);
tcase_add_test(tc, efl_ui_spotlight_test_push1);
tcase_add_test(tc, efl_ui_spotlight_test_push2);
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);
}

View File

@ -139,7 +139,7 @@ efl_ui_suite_src = [
'efl_ui_suite.h',
'efl_ui_model.c',
'efl_ui_test_widget.c',
'efl_ui_test_active_view.c',
'efl_ui_test_spotlight.c',
'efl_ui_test_check.c',
'efl_ui_test_radio_group.c',
'efl_ui_test_progressbar.c',

View File

@ -9,7 +9,7 @@
/* spec-meta-start
{"test-interface":"Efl.Pack_Linear",
"test-widgets": ["Efl.Ui.Box", "Efl.Ui.Grid", "Efl.Ui.Active_View.Container"],
"test-widgets": ["Efl.Ui.Box", "Efl.Ui.Grid", "Efl.Ui.Spotlight.Container"],
"custom-mapping" : {
"Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS"
}