efl_ui_relative_container: rename relative_layout

Summary:
Also,
Rename parameter name `target` to `base`.
Rename parameter name `relative` to `relative_position`.

ref T8380

Depends On D10639

Test Plan: ninja test

Reviewers: woohyun, segfaultxavi

Reviewed By: segfaultxavi

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8380

Differential Revision: https://phab.enlightenment.org/D10640
This commit is contained in:
Yeongjong Lee 2019-11-12 13:46:20 +01:00 committed by Xavi Artigas
parent a5daa2b72f
commit 246485ca92
18 changed files with 311 additions and 291 deletions

View File

@ -155,7 +155,7 @@ elementary_test_src = [
'test_win_indicator.c', 'test_win_indicator.c',
'test_gesture_framework.c', 'test_gesture_framework.c',
'test_ui_tab_pager.c', 'test_ui_tab_pager.c',
'test_ui_relative_layout.c', 'test_ui_relative_container.c',
'test_ui_collection.c', 'test_ui_collection.c',
'test_ui_collection_view.c', 'test_ui_collection_view.c',
'test_ui_items.c', 'test_ui_items.c',

View File

@ -397,7 +397,7 @@ 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_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_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_ui_relative_container(void *data, Evas_Object *obj, void *event_info);
void test_efl_ui_radio(void *data, Evas_Object *obj, void *event_info); void test_efl_ui_radio(void *data, Evas_Object *obj, void *event_info);
void test_efl_ui_collection_list(void *data, Evas_Object *obj, void *event_info); void test_efl_ui_collection_list(void *data, Evas_Object *obj, void *event_info);
void test_efl_ui_collection_grid(void *data, Evas_Object *obj, void *event_info); void test_efl_ui_collection_grid(void *data, Evas_Object *obj, void *event_info);
@ -908,7 +908,7 @@ add_tests:
ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Table", test_ui_table); ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Table", test_ui_table);
ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Table (Linear API)", test_ui_table_linear); ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Table (Linear API)", test_ui_table_linear);
ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Table_Static", test_ui_table_static); ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Table_Static", test_ui_table_static);
ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Relative_Layout", test_ui_relative_layout); ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Relative_Container", test_ui_relative_container);
ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection List", test_efl_ui_collection_list); ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection List", test_efl_ui_collection_list);
ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection Grid", test_efl_ui_collection_grid); ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection Grid", test_efl_ui_collection_grid);
ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection_View", test_efl_ui_collection_view); ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection_View", test_efl_ui_collection_view);

View File

@ -57,20 +57,20 @@ _btn_clicked_to_cb(void *data, const Efl_Event *event)
switch (opt) switch (opt)
{ {
case LEFT: case LEFT:
efl_ui_relative_layout_relation_left_get(layout, btn, NULL, &relative); efl_ui_relative_container_relation_left_get(layout, btn, NULL, &relative);
efl_ui_relative_layout_relation_left_set(layout, btn, to, relative); efl_ui_relative_container_relation_left_set(layout, btn, to, relative);
break; break;
case RIGHT: case RIGHT:
efl_ui_relative_layout_relation_right_get(layout, btn, NULL, &relative); efl_ui_relative_container_relation_right_get(layout, btn, NULL, &relative);
efl_ui_relative_layout_relation_right_set(layout, btn, to, relative); efl_ui_relative_container_relation_right_set(layout, btn, to, relative);
break; break;
case TOP: case TOP:
efl_ui_relative_layout_relation_top_get(layout, btn, NULL, &relative); efl_ui_relative_container_relation_top_get(layout, btn, NULL, &relative);
efl_ui_relative_layout_relation_top_set(layout, btn, to, relative); efl_ui_relative_container_relation_top_set(layout, btn, to, relative);
break; break;
case BOTTOM: case BOTTOM:
efl_ui_relative_layout_relation_bottom_get(layout, btn, NULL, &relative); efl_ui_relative_container_relation_bottom_get(layout, btn, NULL, &relative);
efl_ui_relative_layout_relation_bottom_set(layout, btn, to, relative); efl_ui_relative_container_relation_bottom_set(layout, btn, to, relative);
break; break;
} }
efl_text_set(obj, ((to == layout) ? "parent" : (char *)efl_text_get(to))); efl_text_set(obj, ((to == layout) ? "parent" : (char *)efl_text_get(to)));
@ -89,16 +89,16 @@ _slider_changed_relative_cb(void *data, const Efl_Event *event)
switch (opt) switch (opt)
{ {
case LEFT: case LEFT:
efl_ui_relative_layout_relation_left_set(layout, btn, NULL, val); efl_ui_relative_container_relation_left_set(layout, btn, NULL, val);
break; break;
case RIGHT: case RIGHT:
efl_ui_relative_layout_relation_right_set(layout, btn, NULL, val); efl_ui_relative_container_relation_right_set(layout, btn, NULL, val);
break; break;
case TOP: case TOP:
efl_ui_relative_layout_relation_top_set(layout, btn, NULL, val); efl_ui_relative_container_relation_top_set(layout, btn, NULL, val);
break; break;
case BOTTOM: case BOTTOM:
efl_ui_relative_layout_relation_bottom_set(layout, btn, NULL, val); efl_ui_relative_container_relation_bottom_set(layout, btn, NULL, val);
break; break;
} }
} }
@ -131,19 +131,19 @@ _setter_add(Eo *vbox, Eo *btn, Options option)
{ {
case LEFT: case LEFT:
text = "left"; text = "left";
efl_ui_relative_layout_relation_left_get(layout, btn, &to, &relative); efl_ui_relative_container_relation_left_get(layout, btn, &to, &relative);
break; break;
case RIGHT: case RIGHT:
text = "right"; text = "right";
efl_ui_relative_layout_relation_right_get(layout, btn, &to, &relative); efl_ui_relative_container_relation_right_get(layout, btn, &to, &relative);
break; break;
case TOP: case TOP:
text = "top"; text = "top";
efl_ui_relative_layout_relation_top_get(layout, btn, &to, &relative); efl_ui_relative_container_relation_top_get(layout, btn, &to, &relative);
break; break;
case BOTTOM: case BOTTOM:
text = "bottom"; text = "bottom";
efl_ui_relative_layout_relation_bottom_get(layout, btn, &to, &relative); efl_ui_relative_container_relation_bottom_get(layout, btn, &to, &relative);
break; break;
} }
btn_text = ((to == layout) ? "parent" : (char *)efl_text_get(to)); btn_text = ((to == layout) ? "parent" : (char *)efl_text_get(to));
@ -271,12 +271,12 @@ _button_frame_add(Eo *box, Eo *btn)
} }
void void
test_ui_relative_layout(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) test_ui_relative_container(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{ {
Eo *win, *vbox, *f, *hbox; Eo *win, *vbox, *f, *hbox;
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
efl_text_set(efl_added, "Efl.Ui.Relative_Layout"), efl_text_set(efl_added, "Efl.Ui.Relative_Container"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE)); efl_ui_win_autodel_set(efl_added, EINA_TRUE));
vbox = efl_add(EFL_UI_BOX_CLASS, win, vbox = efl_add(EFL_UI_BOX_CLASS, win,
@ -301,26 +301,26 @@ test_ui_relative_layout(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, vo
efl_text_set(efl_added, "Contents"), efl_text_set(efl_added, "Contents"),
efl_pack(vbox, efl_added)); efl_pack(vbox, efl_added));
layout = efl_add(EFL_UI_RELATIVE_LAYOUT_CLASS, f, layout = efl_add(EFL_UI_RELATIVE_CONTAINER_CLASS, f,
efl_content_set(f, efl_added)); efl_content_set(f, efl_added));
btn1 = efl_add(EFL_UI_BUTTON_CLASS, layout, btn1 = efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "button1"), efl_text_set(efl_added, "button1"),
efl_gfx_hint_align_set(efl_added, 0.0, 0.0), efl_gfx_hint_align_set(efl_added, 0.0, 0.0),
efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, _btn_color_clicked_cb, layout), efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, _btn_color_clicked_cb, layout),
efl_ui_relative_layout_relation_right_set(layout, efl_added, layout, 0.0), efl_ui_relative_container_relation_right_set(layout, efl_added, layout, 0.0),
efl_ui_relative_layout_relation_bottom_set(layout, efl_added, layout, 0.0)); efl_ui_relative_container_relation_bottom_set(layout, efl_added, layout, 0.0));
btn2 = efl_add(EFL_UI_BUTTON_CLASS, layout, btn2 = efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "button2"), efl_text_set(efl_added, "button2"),
efl_gfx_hint_align_set(efl_added, 0.5, 0.0), efl_gfx_hint_align_set(efl_added, 0.5, 0.0),
efl_ui_relative_layout_relation_left_set(layout, efl_added, btn1, 1.0), efl_ui_relative_container_relation_left_set(layout, efl_added, btn1, 1.0),
efl_ui_relative_layout_relation_bottom_set(layout, efl_added, layout, 0.0)); efl_ui_relative_container_relation_bottom_set(layout, efl_added, layout, 0.0));
btn3 = efl_add(EFL_UI_BUTTON_CLASS, layout, btn3 = efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "button3"), efl_text_set(efl_added, "button3"),
efl_ui_relative_layout_relation_left_set(layout, efl_added, btn2, 0.0), efl_ui_relative_container_relation_left_set(layout, efl_added, btn2, 0.0),
efl_ui_relative_layout_relation_top_set(layout, efl_added, btn2, 1.0)); efl_ui_relative_container_relation_top_set(layout, efl_added, btn2, 1.0));
_button_frame_add(hbox, btn1); _button_frame_add(hbox, btn1);
_button_frame_add(hbox, btn2); _button_frame_add(hbox, btn2);

View File

@ -169,5 +169,5 @@
/efl_ui_list_view_example_3 /efl_ui_list_view_example_3
/efl_ui_theme_example_01 /efl_ui_theme_example_01
/efl_ui_theme_example_02 /efl_ui_theme_example_02
/efl_ui_relative_layout_example_01 /efl_ui_relative_container_example_01
/efl_ui_relative_layout_example_02 /efl_ui_relative_container_example_02

View File

@ -1,4 +1,4 @@
// gcc -o efl_ui_relative_layout_example_01 efl_ui_relative_layout_example_01.c `pkg-config --cflags --libs elementary` // gcc -o efl_ui_relative_container_example_01 efl_ui_relative_container_example_01.c `pkg-config --cflags --libs elementary`
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "elementary_config.h" #include "elementary_config.h"
@ -16,10 +16,10 @@ elm_main(int argc, char **argv)
Eo *win, *layout, *btn1, *btn2, *btn3; Eo *win, *layout, *btn1, *btn2, *btn3;
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
efl_text_set(efl_added, "Efl.Ui.Relative_Layout"), efl_text_set(efl_added, "Efl.Ui.Relative_Container"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE)); efl_ui_win_autodel_set(efl_added, EINA_TRUE));
layout = efl_add(EFL_UI_RELATIVE_LAYOUT_CLASS, win, layout = efl_add(EFL_UI_RELATIVE_CONTAINER_CLASS, win,
efl_content_set(win, efl_added)); efl_content_set(win, efl_added));
btn1 = efl_add(EFL_UI_BUTTON_CLASS, layout, btn1 = efl_add(EFL_UI_BUTTON_CLASS, layout,
@ -27,20 +27,20 @@ elm_main(int argc, char **argv)
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(100, 100)), efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(100, 100)),
efl_gfx_hint_align_set(efl_added, 0, 0), efl_gfx_hint_align_set(efl_added, 0, 0),
efl_gfx_hint_margin_set(efl_added, 10, 30, 20, 40), efl_gfx_hint_margin_set(efl_added, 10, 30, 20, 40),
efl_ui_relative_layout_relation_right_set(layout, efl_added, layout, 0.0), efl_ui_relative_container_relation_right_set(layout, efl_added, layout, 0.0),
efl_ui_relative_layout_relation_bottom_set(layout, efl_added, layout, 0.0)); efl_ui_relative_container_relation_bottom_set(layout, efl_added, layout, 0.0));
btn2 = efl_add(EFL_UI_BUTTON_CLASS, layout, btn2 = efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "btn2"), efl_text_set(efl_added, "btn2"),
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(0, 200)), efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(0, 200)),
efl_gfx_hint_align_set(efl_added, 0.5, 0), efl_gfx_hint_align_set(efl_added, 0.5, 0),
efl_ui_relative_layout_relation_left_set(layout, efl_added, btn1, 1.0), efl_ui_relative_container_relation_left_set(layout, efl_added, btn1, 1.0),
efl_ui_relative_layout_relation_bottom_set(layout, efl_added, layout, 0.0)); efl_ui_relative_container_relation_bottom_set(layout, efl_added, layout, 0.0));
btn3 = efl_add(EFL_UI_BUTTON_CLASS, layout, btn3 = efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "btn3"), efl_text_set(efl_added, "btn3"),
efl_ui_relative_layout_relation_left_set(layout, efl_added, btn2, 0.0), efl_ui_relative_container_relation_left_set(layout, efl_added, btn2, 0.0),
efl_ui_relative_layout_relation_top_set(layout, efl_added, btn2, 1.0)); efl_ui_relative_container_relation_top_set(layout, efl_added, btn2, 1.0));
efl_gfx_entity_size_set(win, EINA_SIZE2D(300, 300)); efl_gfx_entity_size_set(win, EINA_SIZE2D(300, 300));

View File

@ -1,4 +1,4 @@
// gcc -o efl_ui_relative_layout_example_02 efl_ui_relative_layout_example_02.c `pkg-config --cflags --libs elementary` // gcc -o efl_ui_relative_container_example_02 efl_ui_relative_container_example_02.c `pkg-config --cflags --libs elementary`
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "elementary_config.h" #include "elementary_config.h"
@ -16,10 +16,10 @@ elm_main(int argc, char **argv)
Eo *win, *layout, *btn1, *btn2; Eo *win, *layout, *btn1, *btn2;
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
efl_text_set(efl_added, "Efl.Ui.Relative_Layout"), efl_text_set(efl_added, "Efl.Ui.Relative_Container"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE)); efl_ui_win_autodel_set(efl_added, EINA_TRUE));
layout = efl_add(EFL_UI_RELATIVE_LAYOUT_CLASS, win, layout = efl_add(EFL_UI_RELATIVE_CONTAINER_CLASS, win,
efl_content_set(win, efl_added)); efl_content_set(win, efl_added));
btn1 = efl_add(EFL_UI_BUTTON_CLASS, layout, btn1 = efl_add(EFL_UI_BUTTON_CLASS, layout,
@ -30,11 +30,11 @@ elm_main(int argc, char **argv)
efl_text_set(efl_added, "btn2"), efl_text_set(efl_added, "btn2"),
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(0, 100))); efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(0, 100)));
efl_ui_relative_layout_relation_right_set(layout, btn1, btn2, 0.0); efl_ui_relative_container_relation_right_set(layout, btn1, btn2, 0.0);
efl_ui_relative_layout_relation_bottom_set(layout, btn1, btn2, 0.0); efl_ui_relative_container_relation_bottom_set(layout, btn1, btn2, 0.0);
efl_ui_relative_layout_relation_left_set(layout, btn2, btn1, 1.0); efl_ui_relative_container_relation_left_set(layout, btn2, btn1, 1.0);
efl_ui_relative_layout_relation_top_set(layout, btn2, btn1, 1.0); efl_ui_relative_container_relation_top_set(layout, btn2, btn1, 1.0);
efl_gfx_entity_size_set(win, EINA_SIZE2D(300, 300)); efl_gfx_entity_size_set(win, EINA_SIZE2D(300, 300));

View File

@ -222,7 +222,7 @@ EAPI Eina_Bool efl_ui_win_autodel_get(const Efl_Ui_Win *obj);
#endif #endif
# include <efl_ui_win_inlined.eo.h> # include <efl_ui_win_inlined.eo.h>
# include <efl_ui_win_socket.eo.h> # include <efl_ui_win_socket.eo.h>
# include <efl_ui_relative_layout.eo.h> # include <efl_ui_relative_container.eo.h>
// FIXME - Text object must stop using Context_Item_Clicked_Cb! // FIXME - Text object must stop using Context_Item_Clicked_Cb!
typedef void (*Context_Item_Clicked_Cb)(void *data, Eo *obj, void *event_info); typedef void (*Context_Item_Clicked_Cb)(void *data, Eo *obj, void *event_info);

View File

@ -1,7 +1,7 @@
#include "efl_ui_relative_layout_private.h" #include "efl_ui_relative_container_private.h"
#define MY_CLASS EFL_UI_RELATIVE_LAYOUT_CLASS #define MY_CLASS EFL_UI_RELATIVE_CONTAINER_CLASS
#define MY_CLASS_NAME "Efl.Ui.Relative_Layout" #define MY_CLASS_NAME "Efl.Ui.Relative_Container"
#define LEFT 0 #define LEFT 0
#define RIGHT 1 #define RIGHT 1
@ -11,15 +11,15 @@
#define START (axis ? TOP : LEFT) #define START (axis ? TOP : LEFT)
#define END (axis ? BOTTOM : RIGHT) #define END (axis ? BOTTOM : RIGHT)
static void _child_calc(Efl_Ui_Relative_Layout_Child *child, Eina_Bool axis); static void _child_calc(Efl_Ui_Relative_Container_Child *child, Eina_Bool axis);
static int static int
_chain_sort_cb(const void *l1, const void *l2) _chain_sort_cb(const void *l1, const void *l2)
{ {
Efl_Ui_Relative_Layout_Calc *calc1, *calc2; Efl_Ui_Relative_Container_Calc *calc1, *calc2;
calc1 = EINA_INLIST_CONTAINER_GET(l1, Efl_Ui_Relative_Layout_Calc); calc1 = EINA_INLIST_CONTAINER_GET(l1, Efl_Ui_Relative_Container_Calc);
calc2 = EINA_INLIST_CONTAINER_GET(l2, Efl_Ui_Relative_Layout_Calc); calc2 = EINA_INLIST_CONTAINER_GET(l2, Efl_Ui_Relative_Container_Calc);
return calc2->comp_factor <= calc1->comp_factor ? -1 : 1; return calc2->comp_factor <= calc1->comp_factor ? -1 : 1;
} }
@ -27,7 +27,7 @@ _chain_sort_cb(const void *l1, const void *l2)
static void static void
_on_child_size_changed(void *data, const Efl_Event *event EINA_UNUSED) _on_child_size_changed(void *data, const Efl_Event *event EINA_UNUSED)
{ {
Efl_Ui_Relative_Layout *obj = data; Efl_Ui_Relative_Container *obj = data;
efl_pack_layout_request(obj); efl_pack_layout_request(obj);
} }
@ -35,7 +35,7 @@ _on_child_size_changed(void *data, const Efl_Event *event EINA_UNUSED)
static void static void
_on_child_hints_changed(void *data, const Efl_Event *event EINA_UNUSED) _on_child_hints_changed(void *data, const Efl_Event *event EINA_UNUSED)
{ {
Efl_Ui_Relative_Layout *obj = data; Efl_Ui_Relative_Container *obj = data;
efl_pack_layout_request(obj); efl_pack_layout_request(obj);
} }
@ -43,42 +43,42 @@ _on_child_hints_changed(void *data, const Efl_Event *event EINA_UNUSED)
static void static void
_on_child_del(void *data, const Efl_Event *event) _on_child_del(void *data, const Efl_Event *event)
{ {
Efl_Ui_Relative_Layout *obj = data; Efl_Ui_Relative_Container *obj = data;
efl_pack_unpack(obj, event->object); efl_pack_unpack(obj, event->object);
} }
EFL_CALLBACKS_ARRAY_DEFINE(efl_ui_relative_layout_callbacks, EFL_CALLBACKS_ARRAY_DEFINE(efl_ui_relative_container_callbacks,
{ EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _on_child_size_changed }, { EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _on_child_size_changed },
{ EFL_GFX_ENTITY_EVENT_HINTS_CHANGED, _on_child_hints_changed }, { EFL_GFX_ENTITY_EVENT_HINTS_CHANGED, _on_child_hints_changed },
{ EFL_EVENT_DEL, _on_child_del } { EFL_EVENT_DEL, _on_child_del }
); );
static Efl_Ui_Relative_Layout_Child * static Efl_Ui_Relative_Container_Child *
_efl_ui_relative_layout_register(Efl_Ui_Relative_Layout_Data *pd, Eo *child) _efl_ui_relative_container_register(Efl_Ui_Relative_Container_Data *pd, Eo *child)
{ {
Efl_Ui_Relative_Layout_Child *rc; Efl_Ui_Relative_Container_Child *rc;
if (!efl_ui_widget_sub_object_add(pd->obj, child)) if (!efl_ui_widget_sub_object_add(pd->obj, child))
return NULL; return NULL;
rc = calloc(1, sizeof(Efl_Ui_Relative_Layout_Child)); rc = calloc(1, sizeof(Efl_Ui_Relative_Container_Child));
if (!rc) return NULL; if (!rc) return NULL;
rc->obj = child; rc->obj = child;
rc->layout = pd->obj; rc->layout = pd->obj;
rc->rel[LEFT].to = rc->layout; rc->rel[LEFT].to = rc->layout;
rc->rel[LEFT].relative = 0.0; rc->rel[LEFT].relative_position = 0.0;
rc->rel[RIGHT].to = rc->layout; rc->rel[RIGHT].to = rc->layout;
rc->rel[RIGHT].relative = 1.0; rc->rel[RIGHT].relative_position = 1.0;
rc->rel[TOP].to = rc->layout; rc->rel[TOP].to = rc->layout;
rc->rel[TOP].relative = 0.0; rc->rel[TOP].relative_position = 0.0;
rc->rel[BOTTOM].to = rc->layout; rc->rel[BOTTOM].to = rc->layout;
rc->rel[BOTTOM].relative = 1.0; rc->rel[BOTTOM].relative_position = 1.0;
efl_key_data_set(child, "_elm_leaveme", pd->obj); efl_key_data_set(child, "_elm_leaveme", pd->obj);
efl_canvas_object_clipper_set(child, pd->clipper); efl_canvas_object_clipper_set(child, pd->clipper);
efl_event_callback_array_add(child, efl_ui_relative_layout_callbacks(), pd->obj); efl_event_callback_array_add(child, efl_ui_relative_container_callbacks(), pd->obj);
efl_canvas_group_member_add(pd->obj, child); efl_canvas_group_member_add(pd->obj, child);
efl_canvas_group_change(pd->obj); efl_canvas_group_change(pd->obj);
@ -87,22 +87,22 @@ _efl_ui_relative_layout_register(Efl_Ui_Relative_Layout_Data *pd, Eo *child)
return rc; return rc;
} }
static Efl_Ui_Relative_Layout_Child * static Efl_Ui_Relative_Container_Child *
_relative_child_get(Efl_Ui_Relative_Layout_Data *pd, Eo *child) _relative_child_get(Efl_Ui_Relative_Container_Data *pd, Eo *child)
{ {
Efl_Ui_Relative_Layout_Child *rc; Efl_Ui_Relative_Container_Child *rc;
rc = eina_hash_find(pd->children, &child); rc = eina_hash_find(pd->children, &child);
if (!rc) if (!rc)
rc = _efl_ui_relative_layout_register(pd, child); rc = _efl_ui_relative_container_register(pd, child);
return rc; return rc;
} }
static Efl_Ui_Relative_Layout_Child * static Efl_Ui_Relative_Container_Child *
_relative_child_find(Efl_Ui_Relative_Layout_Data *pd, Eo *target) _relative_child_find(Efl_Ui_Relative_Container_Data *pd, Eo *target)
{ {
Efl_Ui_Relative_Layout_Child *child; Efl_Ui_Relative_Container_Child *child;
if (pd->obj == target) if (pd->obj == target)
return pd->base; return pd->base;
@ -118,9 +118,9 @@ _relative_child_find(Efl_Ui_Relative_Layout_Data *pd, Eo *target)
} }
static void static void
_child_aspect_calc(Efl_Ui_Relative_Layout_Child *child, Eina_Bool axis) _child_aspect_calc(Efl_Ui_Relative_Container_Child *child, Eina_Bool axis)
{ {
Efl_Ui_Relative_Layout_Calc *calc = &child->calc; Efl_Ui_Relative_Container_Calc *calc = &child->calc;
double temph; double temph;
if ((calc->aspect[0] <= 0) || (calc->aspect[1] <= 0)) if ((calc->aspect[0] <= 0) || (calc->aspect[1] <= 0))
@ -200,9 +200,9 @@ _child_aspect_calc(Efl_Ui_Relative_Layout_Child *child, Eina_Bool axis)
} }
static Eina_Bool static Eina_Bool
_child_chain_calc(Efl_Ui_Relative_Layout_Child *child, Eina_Bool axis) _child_chain_calc(Efl_Ui_Relative_Container_Child *child, Eina_Bool axis)
{ {
Efl_Ui_Relative_Layout_Child *head, *tail, *o; Efl_Ui_Relative_Container_Child *head, *tail, *o;
Efl_Gfx_Hint_Aspect aspect_type; Efl_Gfx_Hint_Aspect aspect_type;
int space, min_sum = 0; int space, min_sum = 0;
double weight_sum = 0, cur_pos; double weight_sum = 0, cur_pos;
@ -260,15 +260,15 @@ _child_chain_calc(Efl_Ui_Relative_Layout_Child *child, Eina_Bool axis)
_child_calc(tail->calc.to[END], axis); _child_calc(tail->calc.to[END], axis);
cur_pos = head->calc.to[START]->calc.want[axis].position + cur_pos = head->calc.to[START]->calc.want[axis].position +
(head->calc.to[START]->calc.want[axis].length * head->rel[START].relative); (head->calc.to[START]->calc.want[axis].length * head->rel[START].relative_position);
space = tail->calc.to[END]->calc.want[axis].position + space = tail->calc.to[END]->calc.want[axis].position +
(tail->calc.to[END]->calc.want[axis].length * tail->rel[END].relative) - cur_pos; (tail->calc.to[END]->calc.want[axis].length * tail->rel[END].relative_position) - cur_pos;
if ((space <= min_sum) || EINA_DBL_EQ(weight_sum, 0.0)) if ((space <= min_sum) || EINA_DBL_EQ(weight_sum, 0.0))
cur_pos += (space - min_sum) * head->calc.align[axis]; cur_pos += (space - min_sum) * head->calc.align[axis];
else else
{ {
Efl_Ui_Relative_Layout_Calc *calc; Efl_Ui_Relative_Container_Calc *calc;
double weight_len, orig_space = space, orig_weight = weight_sum; double weight_len, orig_space = space, orig_weight = weight_sum;
// Calculate compare factor // Calculate compare factor
@ -314,21 +314,21 @@ _child_chain_calc(Efl_Ui_Relative_Layout_Child *child, Eina_Bool axis)
child->calc.m0[axis] += o->calc.min[axis]; child->calc.m0[axis] += o->calc.min[axis];
} }
child->calc.mi[axis] = head->rel[START].relative * (head->calc.to[START]->calc.mj[axis] - child->calc.mi[axis] = head->rel[START].relative_position * (head->calc.to[START]->calc.mj[axis] -
head->calc.to[START]->calc.mi[axis]) + head->calc.to[START]->calc.mi[axis]; head->calc.to[START]->calc.mi[axis]) + head->calc.to[START]->calc.mi[axis];
child->calc.mj[axis] = tail->rel[END].relative * (tail->calc.to[END]->calc.mj[axis] - child->calc.mj[axis] = tail->rel[END].relative_position * (tail->calc.to[END]->calc.mj[axis] -
tail->calc.to[END]->calc.mi[axis]) + tail->calc.to[END]->calc.mi[axis]; tail->calc.to[END]->calc.mi[axis]) + tail->calc.to[END]->calc.mi[axis];
child->calc.m0[axis] += -child->calc.min[axis] + child->calc.m0[axis] += -child->calc.min[axis] +
(head->calc.to[START]->calc.m0[axis] * head->rel[START].relative) + (head->calc.to[START]->calc.m0[axis] * head->rel[START].relative_position) +
(tail->calc.to[END]->calc.m0[axis] * (1 - tail->rel[END].relative)); (tail->calc.to[END]->calc.m0[axis] * (1 - tail->rel[END].relative_position));
return EINA_TRUE; return EINA_TRUE;
} }
static void static void
_child_calc(Efl_Ui_Relative_Layout_Child *child, Eina_Bool axis) _child_calc(Efl_Ui_Relative_Container_Child *child, Eina_Bool axis)
{ {
Efl_Ui_Relative_Layout_Calc *calc = &child->calc; Efl_Ui_Relative_Container_Calc *calc = &child->calc;
if (calc->state[axis] == RELATIVE_CALC_DONE) if (calc->state[axis] == RELATIVE_CALC_DONE)
return; return;
@ -348,10 +348,10 @@ _child_calc(Efl_Ui_Relative_Layout_Child *child, Eina_Bool axis)
_child_calc(calc->to[END], axis); _child_calc(calc->to[END], axis);
calc->space[axis].position = calc->to[START]->calc.want[axis].position calc->space[axis].position = calc->to[START]->calc.want[axis].position
+ (calc->to[START]->calc.want[axis].length * child->rel[START].relative) + (calc->to[START]->calc.want[axis].length * child->rel[START].relative_position)
+ calc->margin[START]; + calc->margin[START];
calc->space[axis].length = calc->to[END]->calc.want[axis].position calc->space[axis].length = calc->to[END]->calc.want[axis].position
+ (calc->to[END]->calc.want[axis].length * child->rel[END].relative) + (calc->to[END]->calc.want[axis].length * child->rel[END].relative_position)
- calc->margin[END] - calc->space[axis].position; - calc->margin[END] - calc->space[axis].position;
} }
@ -381,18 +381,18 @@ _child_calc(Efl_Ui_Relative_Layout_Child *child, Eina_Bool axis)
return; return;
//calculate relative layout min //calculate relative layout min
calc->mi[axis] = child->rel[START].relative * (calc->to[START]->calc.mj[axis] - calc->mi[axis] = child->rel[START].relative_position * (calc->to[START]->calc.mj[axis] -
calc->to[START]->calc.mi[axis]) + calc->to[START]->calc.mi[axis]; calc->to[START]->calc.mi[axis]) + calc->to[START]->calc.mi[axis];
calc->mj[axis] = child->rel[END].relative * (calc->to[END]->calc.mj[axis] - calc->mj[axis] = child->rel[END].relative_position * (calc->to[END]->calc.mj[axis] -
calc->to[END]->calc.mi[axis]) + calc->to[END]->calc.mi[axis]; calc->to[END]->calc.mi[axis]) + calc->to[END]->calc.mi[axis];
calc->m0[axis] = calc->to[START]->calc.m0[axis] * child->rel[START].relative; calc->m0[axis] = calc->to[START]->calc.m0[axis] * child->rel[START].relative_position;
if ((calc->to[START] == calc->to[END]) && if ((calc->to[START] == calc->to[END]) &&
EINA_DBL_EQ(child->rel[START].relative, child->rel[END].relative)) EINA_DBL_EQ(child->rel[START].relative_position, child->rel[END].relative_position))
{ {
double r, a; // relative, align double r, a; // relative, align
r = calc->mi[axis] + r = calc->mi[axis] +
(child->rel[START].relative * (calc->mj[axis] - calc->mi[axis])); (child->rel[START].relative_position * (calc->mj[axis] - calc->mi[axis]));
a = calc->align[axis]; a = calc->align[axis];
calc->m0[axis] += (calc->min[axis] + calc->margin[START] + calc->margin[END]) * calc->m0[axis] += (calc->min[axis] + calc->margin[START] + calc->margin[END]) *
((EINA_DBL_EQ(r, 0.0) || (!EINA_DBL_EQ(r, 1.0) && (a < r))) ? ((EINA_DBL_EQ(r, 0.0) || (!EINA_DBL_EQ(r, 1.0) && (a < r))) ?
@ -400,7 +400,7 @@ _child_calc(Efl_Ui_Relative_Layout_Child *child, Eina_Bool axis)
} }
else else
{ {
calc->m0[axis] += calc->to[END]->calc.m0[axis] * (1 - child->rel[END].relative); calc->m0[axis] += calc->to[END]->calc.m0[axis] * (1 - child->rel[END].relative_position);
} }
} }
@ -408,12 +408,12 @@ _child_calc(Efl_Ui_Relative_Layout_Child *child, Eina_Bool axis)
static void static void
_hash_free_cb(void *data) _hash_free_cb(void *data)
{ {
Efl_Ui_Relative_Layout_Child *child = data; Efl_Ui_Relative_Container_Child *child = data;
efl_canvas_group_member_remove(child->layout, child->obj); efl_canvas_group_member_remove(child->layout, child->obj);
efl_canvas_object_clipper_set(child->obj, NULL); efl_canvas_object_clipper_set(child->obj, NULL);
efl_key_data_set(child->obj, "_elm_leaveme", NULL); efl_key_data_set(child->obj, "_elm_leaveme", NULL);
efl_event_callback_array_del(child->obj, efl_ui_relative_layout_callbacks(), efl_event_callback_array_del(child->obj, efl_ui_relative_container_callbacks(),
child->layout); child->layout);
if (!efl_invalidated_get(child->obj)) if (!efl_invalidated_get(child->obj))
@ -425,9 +425,9 @@ _hash_free_cb(void *data)
static void static void
_hash_clear_cb(void *data) _hash_clear_cb(void *data)
{ {
Efl_Ui_Relative_Layout_Child *child = data; Efl_Ui_Relative_Container_Child *child = data;
efl_event_callback_array_del(child->obj, efl_ui_relative_layout_callbacks(), efl_event_callback_array_del(child->obj, efl_ui_relative_container_callbacks(),
child->layout); child->layout);
efl_del(child->obj); efl_del(child->obj);
} }
@ -436,9 +436,9 @@ static Eina_Bool
_hash_child_calc_foreach_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, _hash_child_calc_foreach_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED,
void *data, void *fdata) void *data, void *fdata)
{ {
Efl_Ui_Relative_Layout_Child *child = data; Efl_Ui_Relative_Container_Child *child = data;
Efl_Ui_Relative_Layout_Calc *calc = &(child->calc); Efl_Ui_Relative_Container_Calc *calc = &(child->calc);
Efl_Ui_Relative_Layout_Data *pd = fdata; Efl_Ui_Relative_Container_Data *pd = fdata;
Eina_Rect want; Eina_Rect want;
int axis, layout_min; int axis, layout_min;
double min_len; double min_len;
@ -475,9 +475,9 @@ _hash_child_init_foreach_cb(const Eina_Hash *hash EINA_UNUSED, const void *key E
void *data, void *fdata) void *data, void *fdata)
{ {
Eina_Size2D max, min, aspect; Eina_Size2D max, min, aspect;
Efl_Ui_Relative_Layout_Child *child = data; Efl_Ui_Relative_Container_Child *child = data;
Efl_Ui_Relative_Layout_Calc *calc = &(child->calc); Efl_Ui_Relative_Container_Calc *calc = &(child->calc);
Efl_Ui_Relative_Layout_Data *pd = fdata; Efl_Ui_Relative_Container_Data *pd = fdata;
calc->to[LEFT] = _relative_child_find(pd, child->rel[LEFT].to); calc->to[LEFT] = _relative_child_find(pd, child->rel[LEFT].to);
calc->to[RIGHT] = _relative_child_find(pd, child->rel[RIGHT].to); calc->to[RIGHT] = _relative_child_find(pd, child->rel[RIGHT].to);
@ -532,13 +532,13 @@ _hash_child_init_foreach_cb(const Eina_Hash *hash EINA_UNUSED, const void *key E
} }
static void static void
_efl_ui_relative_layout_hints_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev) _efl_ui_relative_container_hints_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev)
{ {
efl_pack_layout_request(ev->object); efl_pack_layout_request(ev->object);
} }
EOLIAN static void EOLIAN static void
_efl_ui_relative_layout_efl_pack_layout_layout_update(Eo *obj, Efl_Ui_Relative_Layout_Data *pd) _efl_ui_relative_container_efl_pack_layout_layout_update(Eo *obj, Efl_Ui_Relative_Container_Data *pd)
{ {
Eina_Rect want = efl_gfx_entity_geometry_get(obj); Eina_Rect want = efl_gfx_entity_geometry_get(obj);
pd->base->calc.want[0].position = want.x; pd->base->calc.want[0].position = want.x;
@ -557,34 +557,34 @@ _efl_ui_relative_layout_efl_pack_layout_layout_update(Eo *obj, Efl_Ui_Relative_L
} }
EOLIAN static void EOLIAN static void
_efl_ui_relative_layout_efl_pack_layout_layout_request(Eo *obj, Efl_Ui_Relative_Layout_Data *pd EINA_UNUSED) _efl_ui_relative_container_efl_pack_layout_layout_request(Eo *obj, Efl_Ui_Relative_Container_Data *pd EINA_UNUSED)
{ {
efl_canvas_group_need_recalculate_set(obj, EINA_TRUE); efl_canvas_group_need_recalculate_set(obj, EINA_TRUE);
} }
EOLIAN static void EOLIAN static void
_efl_ui_relative_layout_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Relative_Layout_Data *pd EINA_UNUSED) _efl_ui_relative_container_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Relative_Container_Data *pd EINA_UNUSED)
{ {
efl_canvas_group_need_recalculate_set(obj, EINA_FALSE); efl_canvas_group_need_recalculate_set(obj, EINA_FALSE);
efl_pack_layout_update(obj); efl_pack_layout_update(obj);
} }
EOLIAN static void EOLIAN static void
_efl_ui_relative_layout_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Relative_Layout_Data *pd EINA_UNUSED, Eina_Size2D sz) _efl_ui_relative_container_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Relative_Container_Data *pd EINA_UNUSED, Eina_Size2D sz)
{ {
efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), sz); efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), sz);
efl_canvas_group_change(obj); efl_canvas_group_change(obj);
} }
EOLIAN static void EOLIAN static void
_efl_ui_relative_layout_efl_gfx_entity_position_set(Eo *obj, Efl_Ui_Relative_Layout_Data *pd EINA_UNUSED, Eina_Position2D pos) _efl_ui_relative_container_efl_gfx_entity_position_set(Eo *obj, Efl_Ui_Relative_Container_Data *pd EINA_UNUSED, Eina_Position2D pos)
{ {
efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos); efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos);
efl_canvas_group_change(obj); efl_canvas_group_change(obj);
} }
EOLIAN static void EOLIAN static void
_efl_ui_relative_layout_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Relative_Layout_Data *pd EINA_UNUSED) _efl_ui_relative_container_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Relative_Container_Data *pd EINA_UNUSED)
{ {
pd->clipper = efl_add(EFL_CANVAS_RECTANGLE_CLASS, obj); pd->clipper = efl_add(EFL_CANVAS_RECTANGLE_CLASS, obj);
evas_object_static_clip_set(pd->clipper, EINA_TRUE); evas_object_static_clip_set(pd->clipper, EINA_TRUE);
@ -593,14 +593,14 @@ _efl_ui_relative_layout_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Relative_Layo
efl_ui_widget_sub_object_add(obj, pd->clipper); efl_ui_widget_sub_object_add(obj, pd->clipper);
efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_HINTS_CHANGED, efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_HINTS_CHANGED,
_efl_ui_relative_layout_hints_changed_cb, NULL); _efl_ui_relative_container_hints_changed_cb, NULL);
efl_canvas_group_add(efl_super(obj, MY_CLASS)); efl_canvas_group_add(efl_super(obj, MY_CLASS));
elm_widget_highlight_ignore_set(obj, EINA_TRUE); elm_widget_highlight_ignore_set(obj, EINA_TRUE);
} }
EOLIAN static Eo * EOLIAN static Eo *
_efl_ui_relative_layout_efl_object_constructor(Eo *obj, Efl_Ui_Relative_Layout_Data *pd) _efl_ui_relative_container_efl_object_constructor(Eo *obj, Efl_Ui_Relative_Container_Data *pd)
{ {
obj = efl_constructor(efl_super(obj, MY_CLASS)); obj = efl_constructor(efl_super(obj, MY_CLASS));
efl_canvas_object_type_set(obj, MY_CLASS_NAME); efl_canvas_object_type_set(obj, MY_CLASS_NAME);
@ -610,19 +610,19 @@ _efl_ui_relative_layout_efl_object_constructor(Eo *obj, Efl_Ui_Relative_Layout_D
pd->obj = obj; pd->obj = obj;
pd->children = eina_hash_pointer_new(_hash_free_cb); pd->children = eina_hash_pointer_new(_hash_free_cb);
pd->base = calloc(1, sizeof(Efl_Ui_Relative_Layout_Child)); pd->base = calloc(1, sizeof(Efl_Ui_Relative_Container_Child));
if (!pd->base) return NULL; if (!pd->base) return NULL;
pd->base->obj = obj; pd->base->obj = obj;
pd->base->layout = obj; pd->base->layout = obj;
pd->base->rel[LEFT].to = obj; pd->base->rel[LEFT].to = obj;
pd->base->rel[LEFT].relative = 0.0; pd->base->rel[LEFT].relative_position = 0.0;
pd->base->rel[RIGHT].to = obj; pd->base->rel[RIGHT].to = obj;
pd->base->rel[RIGHT].relative = 1.0; pd->base->rel[RIGHT].relative_position = 1.0;
pd->base->rel[TOP].to = obj; pd->base->rel[TOP].to = obj;
pd->base->rel[TOP].relative = 0.0; pd->base->rel[TOP].relative_position = 0.0;
pd->base->rel[BOTTOM].to = obj; pd->base->rel[BOTTOM].to = obj;
pd->base->rel[BOTTOM].relative = 1.0; pd->base->rel[BOTTOM].relative_position = 1.0;
pd->base->calc.mi[0] = pd->base->calc.mi[1] = 0.0; pd->base->calc.mi[0] = pd->base->calc.mi[1] = 0.0;
pd->base->calc.mj[0] = pd->base->calc.mj[1] = 1.0; pd->base->calc.mj[0] = pd->base->calc.mj[1] = 1.0;
pd->base->calc.state[0] = RELATIVE_CALC_DONE; pd->base->calc.state[0] = RELATIVE_CALC_DONE;
@ -634,7 +634,7 @@ _efl_ui_relative_layout_efl_object_constructor(Eo *obj, Efl_Ui_Relative_Layout_D
} }
EOLIAN static void EOLIAN static void
_efl_ui_relative_layout_efl_object_invalidate(Eo *obj, Efl_Ui_Relative_Layout_Data *pd) _efl_ui_relative_container_efl_object_invalidate(Eo *obj, Efl_Ui_Relative_Container_Data *pd)
{ {
efl_invalidate(efl_super(obj, MY_CLASS)); efl_invalidate(efl_super(obj, MY_CLASS));
@ -642,26 +642,26 @@ _efl_ui_relative_layout_efl_object_invalidate(Eo *obj, Efl_Ui_Relative_Layout_Da
} }
EOLIAN static void EOLIAN static void
_efl_ui_relative_layout_efl_object_destructor(Eo *obj, Efl_Ui_Relative_Layout_Data *pd) _efl_ui_relative_container_efl_object_destructor(Eo *obj, Efl_Ui_Relative_Container_Data *pd)
{ {
efl_event_callback_del(obj, EFL_GFX_ENTITY_EVENT_HINTS_CHANGED, efl_event_callback_del(obj, EFL_GFX_ENTITY_EVENT_HINTS_CHANGED,
_efl_ui_relative_layout_hints_changed_cb, NULL); _efl_ui_relative_container_hints_changed_cb, NULL);
eina_hash_free(pd->children); eina_hash_free(pd->children);
if (pd->base) free(pd->base); if (pd->base) free(pd->base);
efl_destructor(efl_super(obj, MY_CLASS)); efl_destructor(efl_super(obj, MY_CLASS));
} }
EOLIAN static Eina_Bool EOLIAN static Eina_Bool
_efl_ui_relative_layout_efl_pack_pack(Eo *obj EINA_UNUSED, Efl_Ui_Relative_Layout_Data *pd, Efl_Gfx_Entity *subobj) _efl_ui_relative_container_efl_pack_pack(Eo *obj EINA_UNUSED, Efl_Ui_Relative_Container_Data *pd, Efl_Gfx_Entity *subobj)
{ {
EINA_SAFETY_ON_FALSE_RETURN_VAL(subobj, EINA_FALSE); EINA_SAFETY_ON_FALSE_RETURN_VAL(subobj, EINA_FALSE);
EINA_SAFETY_ON_TRUE_RETURN_VAL(!!eina_hash_find(pd->children, &subobj), EINA_FALSE); EINA_SAFETY_ON_TRUE_RETURN_VAL(!!eina_hash_find(pd->children, &subobj), EINA_FALSE);
return !!_efl_ui_relative_layout_register(pd, subobj); return !!_efl_ui_relative_container_register(pd, subobj);
} }
EOLIAN static Eina_Bool EOLIAN static Eina_Bool
_efl_ui_relative_layout_efl_pack_unpack(Eo *obj, Efl_Ui_Relative_Layout_Data *pd, Efl_Object *child) _efl_ui_relative_container_efl_pack_unpack(Eo *obj, Efl_Ui_Relative_Container_Data *pd, Efl_Object *child)
{ {
if (!eina_hash_del_by_key(pd->children, &child)) if (!eina_hash_del_by_key(pd->children, &child))
{ {
@ -675,7 +675,7 @@ _efl_ui_relative_layout_efl_pack_unpack(Eo *obj, Efl_Ui_Relative_Layout_Data *pd
} }
EOLIAN static Eina_Bool EOLIAN static Eina_Bool
_efl_ui_relative_layout_efl_pack_unpack_all(Eo *obj, Efl_Ui_Relative_Layout_Data *pd) _efl_ui_relative_container_efl_pack_unpack_all(Eo *obj, Efl_Ui_Relative_Container_Data *pd)
{ {
eina_hash_free_buckets(pd->children); eina_hash_free_buckets(pd->children);
efl_pack_layout_request(obj); efl_pack_layout_request(obj);
@ -684,7 +684,7 @@ _efl_ui_relative_layout_efl_pack_unpack_all(Eo *obj, Efl_Ui_Relative_Layout_Data
} }
EOLIAN static Eina_Bool EOLIAN static Eina_Bool
_efl_ui_relative_layout_efl_pack_pack_clear(Eo *obj, Efl_Ui_Relative_Layout_Data *pd) _efl_ui_relative_container_efl_pack_pack_clear(Eo *obj, Efl_Ui_Relative_Container_Data *pd)
{ {
eina_hash_free_cb_set(pd->children, _hash_clear_cb); eina_hash_free_cb_set(pd->children, _hash_clear_cb);
eina_hash_free_buckets(pd->children); eina_hash_free_buckets(pd->children);
@ -696,9 +696,9 @@ _efl_ui_relative_layout_efl_pack_pack_clear(Eo *obj, Efl_Ui_Relative_Layout_Data
} }
static Eina_Bool static Eina_Bool
_efl_ui_relative_layout_content_iterator_next(Efl_Ui_Relative_Layout_Content_Iterator *it, void **data) _efl_ui_relative_container_content_iterator_next(Efl_Ui_Relative_Container_Content_Iterator *it, void **data)
{ {
Efl_Ui_Relative_Layout_Child *child; Efl_Ui_Relative_Container_Child *child;
if (!eina_iterator_next(it->real_iterator, (void **) &child)) if (!eina_iterator_next(it->real_iterator, (void **) &child))
return EINA_FALSE; return EINA_FALSE;
@ -708,54 +708,54 @@ _efl_ui_relative_layout_content_iterator_next(Efl_Ui_Relative_Layout_Content_Ite
} }
static Eo * static Eo *
_efl_ui_relative_layout_content_iterator_get_container(Efl_Ui_Relative_Layout_Content_Iterator *it) _efl_ui_relative_container_content_iterator_get_container(Efl_Ui_Relative_Container_Content_Iterator *it)
{ {
return it->relative_layout; return it->relative_container;
} }
static void static void
_efl_ui_relative_layout_content_iterator_free(Efl_Ui_Relative_Layout_Content_Iterator *it) _efl_ui_relative_container_content_iterator_free(Efl_Ui_Relative_Container_Content_Iterator *it)
{ {
eina_iterator_free(it->real_iterator); eina_iterator_free(it->real_iterator);
free(it); free(it);
} }
EOLIAN static Eina_Iterator * EOLIAN static Eina_Iterator *
_efl_ui_relative_layout_efl_container_content_iterate(Eo *obj, Efl_Ui_Relative_Layout_Data *pd) _efl_ui_relative_container_efl_container_content_iterate(Eo *obj, Efl_Ui_Relative_Container_Data *pd)
{ {
Efl_Ui_Relative_Layout_Content_Iterator *it; Efl_Ui_Relative_Container_Content_Iterator *it;
it = calloc(1, sizeof(*it)); it = calloc(1, sizeof(*it));
if (!it) return NULL; if (!it) return NULL;
EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR); EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR);
it->relative_layout = obj; it->relative_container = obj;
it->real_iterator = eina_hash_iterator_data_new(pd->children); it->real_iterator = eina_hash_iterator_data_new(pd->children);
it->iterator.version = EINA_ITERATOR_VERSION; it->iterator.version = EINA_ITERATOR_VERSION;
it->iterator.next = FUNC_ITERATOR_NEXT(_efl_ui_relative_layout_content_iterator_next); it->iterator.next = FUNC_ITERATOR_NEXT(_efl_ui_relative_container_content_iterator_next);
it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER( it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(
_efl_ui_relative_layout_content_iterator_get_container); _efl_ui_relative_container_content_iterator_get_container);
it->iterator.free = FUNC_ITERATOR_FREE(_efl_ui_relative_layout_content_iterator_free); it->iterator.free = FUNC_ITERATOR_FREE(_efl_ui_relative_container_content_iterator_free);
return &it->iterator; return &it->iterator;
} }
EOLIAN static int EOLIAN static int
_efl_ui_relative_layout_efl_container_content_count(Eo *obj EINA_UNUSED, Efl_Ui_Relative_Layout_Data *pd) _efl_ui_relative_container_efl_container_content_count(Eo *obj EINA_UNUSED, Efl_Ui_Relative_Container_Data *pd)
{ {
return eina_hash_population(pd->children); return eina_hash_population(pd->children);
} }
EFL_UI_RELATIVE_LAYOUT_RELATION_SET_GET(left, LEFT); EFL_UI_RELATIVE_CONTAINER_RELATION_SET_GET(left, LEFT);
EFL_UI_RELATIVE_LAYOUT_RELATION_SET_GET(right, RIGHT); EFL_UI_RELATIVE_CONTAINER_RELATION_SET_GET(right, RIGHT);
EFL_UI_RELATIVE_LAYOUT_RELATION_SET_GET(top, TOP); EFL_UI_RELATIVE_CONTAINER_RELATION_SET_GET(top, TOP);
EFL_UI_RELATIVE_LAYOUT_RELATION_SET_GET(bottom, BOTTOM); EFL_UI_RELATIVE_CONTAINER_RELATION_SET_GET(bottom, BOTTOM);
/* Internal EO APIs and hidden overrides */ /* Internal EO APIs and hidden overrides */
#define EFL_UI_RELATIVE_LAYOUT_EXTRA_OPS \ #define EFL_UI_RELATIVE_CONTAINER_EXTRA_OPS \
EFL_CANVAS_GROUP_ADD_OPS(efl_ui_relative_layout) EFL_CANVAS_GROUP_ADD_OPS(efl_ui_relative_container)
#include "efl_ui_relative_layout.eo.c" #include "efl_ui_relative_container.eo.c"

View File

@ -0,0 +1,94 @@
import efl_gfx_types;
class @beta Efl.Ui.Relative_Container extends Efl.Ui.Widget implements Efl.Pack_Layout, Efl.Pack
{
[[The relative container class.
A relative container calculates the size and position of all the children
based on their relationship to each other.]]
methods {
@property relation_left {
[[Specifies the left side edge of the $child object relative to the $base object.
When $relative_position is 0 the left edges of the two objects are aligned.
When $relative_position is 1 the left edge of the $child object is aligned
to the right edge of the $base object.]]
keys {
child: Efl.Gfx.Entity; [[The child object whose size and position is
being changed.]]
}
values {
base: Efl.Gfx.Entity; [[The object whose size and position is being used as reference.
$NULL means that the container object is used
(this is the default value).]]
relative_position: Efl.Gfx.Align(0.0); [[The ratio between left and right of the base,
ranging from 0.0 to 1.0.]]
}
}
@property relation_right {
[[Specifies the right side edge of the $child object relative to the $base object.
When $relative_position is 0 the right edge of the $child object is aligned
to the left edge of the $base object.
When $relative_position is 1 the right edges of the two objects are aligned.]]
keys {
child: Efl.Gfx.Entity; [[The child object whose size and position is
being changed.]]
}
values {
base: Efl.Gfx.Entity; [[The object whose size and position is being used as reference.
$NULL means that the container object is used
(this is the default value).]]
relative_position: Efl.Gfx.Align(1.0); [[The ratio between left and right of the base,
ranging from 0.0 to 1.0.]]
}
}
@property relation_top {
[[Specifies the top side edge of the $child object relative to the $base object.
When $relative_position is 0 the top edges of the two objects are aligned.
When $relative_position is 1 the top edge of the $child object is aligned
to the bottom edge of the $base object.]]
keys {
child: Efl.Gfx.Entity; [[The child object whose size and position is
being changed.]]
}
values {
base: Efl.Gfx.Entity; [[The object whose size and position is being used as reference.
$NULL means that the container object is used
(this is the default value).]]
relative_position: Efl.Gfx.Align(0.0); [[The ratio between top and bottom of the base,
ranging from 0.0 to 1.0.]]
}
}
@property relation_bottom {
[[Specifies the bottom side edge of the $child object relative to the $base object.
When $relative_position is 0 the bottom edge of the $child object is aligned
to the top edge of the $base object.
When $relative_position is 1 the bottom edges of the two objects are aligned.]]
keys {
child: Efl.Gfx.Entity; [[The child object whose size and position is
being changed.]]
}
values {
base: Efl.Gfx.Entity; [[The object whose size and position is being used as reference.
$NULL means that the container object is used
(this is the default value).]]
relative_position: Efl.Gfx.Align(1.0); [[The ratio between top and bottom of the base,
ranging from 0.0 to 1.0.]]
}
}
}
implements {
Efl.Object.constructor;
Efl.Object.invalidate;
Efl.Object.destructor;
Efl.Canvas.Group.group_calculate;
Efl.Pack.pack_clear;
Efl.Pack.unpack_all;
Efl.Pack.unpack;
Efl.Pack.pack;
Efl.Container.content_iterate;
Efl.Container.content_count;
Efl.Gfx.Entity.position { set; }
Efl.Gfx.Entity.size { set; }
Efl.Pack_Layout.layout_update;
Efl.Pack_Layout.layout_request;
}
}

View File

@ -1,5 +1,5 @@
#ifndef EFL_UI_RELATIVE_LAYOUT_PRIVATE_H #ifndef EFL_UI_RELATIVE_CONTAINER_PRIVATE_H
#define EFL_UI_RELATIVE_LAYOUT_PRIVATE_H #define EFL_UI_RELATIVE_CONTAINER_PRIVATE_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "elementary_config.h" # include "elementary_config.h"
@ -10,20 +10,20 @@
#include <Elementary.h> #include <Elementary.h>
#include "elm_priv.h" #include "elm_priv.h"
typedef enum _Efl_Ui_Relative_Layout_Calc_State typedef enum _Efl_Ui_Relative_Container_Calc_State
{ {
RELATIVE_CALC_NONE, RELATIVE_CALC_NONE,
RELATIVE_CALC_DONE, RELATIVE_CALC_DONE,
RELATIVE_CALC_ON RELATIVE_CALC_ON
} Efl_Ui_Relative_Layout_Calc_State; } Efl_Ui_Relative_Container_Calc_State;
typedef struct _Efl_Ui_Relative_Layout_Data Efl_Ui_Relative_Layout_Data; typedef struct _Efl_Ui_Relative_Container_Data Efl_Ui_Relative_Container_Data;
typedef struct _Efl_Ui_Relative_Layout_Child Efl_Ui_Relative_Layout_Child; typedef struct _Efl_Ui_Relative_Container_Child Efl_Ui_Relative_Container_Child;
typedef struct _Efl_Ui_Relative_Layout_Calc Efl_Ui_Relative_Layout_Calc; typedef struct _Efl_Ui_Relative_Container_Calc Efl_Ui_Relative_Container_Calc;
typedef struct _Efl_Ui_Relative_Layout_Relation Efl_Ui_Relative_Layout_Relation; typedef struct _Efl_Ui_Relative_Container_Relation Efl_Ui_Relative_Container_Relation;
typedef struct _Efl_Ui_Relative_Layout_Content_Iterator Efl_Ui_Relative_Layout_Content_Iterator; typedef struct _Efl_Ui_Relative_Container_Content_Iterator Efl_Ui_Relative_Container_Content_Iterator;
struct _Efl_Ui_Relative_Layout_Calc struct _Efl_Ui_Relative_Container_Calc
{ {
EINA_INLIST; EINA_INLIST;
@ -42,7 +42,7 @@ struct _Efl_Ui_Relative_Layout_Calc
* align is greater than relative, (min * ((1 - align) / (1 - relative))) otherwise. * align is greater than relative, (min * ((1 - align) / (1 - relative))) otherwise.
* mi, mj are transformed relative based on layout min size. they are * mi, mj are transformed relative based on layout min size. they are
* calculated as (target.mi + (relative * (target.mj - target.mi))). for example, * calculated as (target.mi + (relative * (target.mj - target.mi))). for example,
* there are two children of relative_layout that has different target base. * there are two children of relative_container that has different target base.
* | | obj1 | obj2 | * | | obj1 | obj2 |
* | min | 100 | 100 | * | min | 100 | 100 |
* |left.target | layout| obj1 | * |left.target | layout| obj1 |
@ -52,7 +52,7 @@ struct _Efl_Ui_Relative_Layout_Calc
* | mi | 0.0 | 0.25 | * | mi | 0.0 | 0.25 |
* | mj | 0.5 | 0.5 | * | mj | 0.5 | 0.5 |
* *
* obj1.mi = layout.mi(0.0) + (obj1.relative(0.0) * (layout.mj(1.0) - layout.mi(0.0))) = 0.0 * obj1.mi = layout.mi(0.0) + (obj1.relative(0.0) * (LAyout.mj(1.0) - layout.mi(0.0))) = 0.0
* obj1.mj = layout.mi(0.0) + (obj1.relative(0.5) * (layout.mj(1.0) - layout.mi(0.0))) = 0.5 * obj1.mj = layout.mi(0.0) + (obj1.relative(0.5) * (layout.mj(1.0) - layout.mi(0.0))) = 0.5
* obj2.mi = obj1.mi(0.0) + (obj2.relative(0.5) * (obj1.mj(0.5) - obj1.mi(0.0))) = 0.25 * obj2.mi = obj1.mi(0.0) + (obj2.relative(0.5) * (obj1.mj(0.5) - obj1.mi(0.0))) = 0.25
* obj2.mj = obj1.mi(0.0) + (obj2.relative(1.0) * (obj1.mj(0.5) - obj1.mi(0.0))) = 0.5 * obj2.mj = obj1.mi(0.0) + (obj2.relative(1.0) * (obj1.mj(0.5) - obj1.mi(0.0))) = 0.5
@ -70,71 +70,71 @@ struct _Efl_Ui_Relative_Layout_Calc
double length; double length;
} space[2], want[2]; } space[2], want[2];
Efl_Ui_Relative_Layout_Calc_State state[2]; Efl_Ui_Relative_Container_Calc_State state[2];
Efl_Ui_Relative_Layout_Calc_State chain_state[2]; Efl_Ui_Relative_Container_Calc_State chain_state[2];
Efl_Ui_Relative_Layout_Child *to[4]; Efl_Ui_Relative_Container_Child *to[4];
}; };
struct _Efl_Ui_Relative_Layout_Data struct _Efl_Ui_Relative_Container_Data
{ {
Eo *obj; Eo *obj;
Eo *clipper; Eo *clipper;
Eina_Hash *children; Eina_Hash *children;
Efl_Ui_Relative_Layout_Child *base; Efl_Ui_Relative_Container_Child *base;
}; };
struct _Efl_Ui_Relative_Layout_Relation struct _Efl_Ui_Relative_Container_Relation
{ {
Efl_Object *to; Efl_Object *to;
double relative; double relative_position;
}; };
struct _Efl_Ui_Relative_Layout_Child struct _Efl_Ui_Relative_Container_Child
{ {
Eo *obj; Eo *obj;
Eo *layout; Eo *layout;
Efl_Ui_Relative_Layout_Relation rel[4]; Efl_Ui_Relative_Container_Relation rel[4];
Efl_Ui_Relative_Layout_Calc calc; Efl_Ui_Relative_Container_Calc calc;
}; };
struct _Efl_Ui_Relative_Layout_Content_Iterator struct _Efl_Ui_Relative_Container_Content_Iterator
{ {
Eina_Iterator iterator; Eina_Iterator iterator;
Eina_Iterator *real_iterator; Eina_Iterator *real_iterator;
Eo *relative_layout; Eo *relative_container;
}; };
#define EFL_UI_RELATIVE_LAYOUT_RELATION_SET_GET(direction, DIRECTION) \ #define EFL_UI_RELATIVE_CONTAINER_RELATION_SET_GET(direction, DIRECTION) \
EOLIAN static void \ EOLIAN static void \
_efl_ui_relative_layout_relation_ ## direction ## _set(Eo *obj, Efl_Ui_Relative_Layout_Data *pd, Eo *child, Eo *target, double relative) \ _efl_ui_relative_container_relation_ ## direction ## _set(Eo *obj, Efl_Ui_Relative_Container_Data *pd, Eo *child, Eo *target, double relative_position) \
{ \ { \
Efl_Ui_Relative_Layout_Child *rc; \ Efl_Ui_Relative_Container_Child *rc; \
if (!child) return; \ if (!child) return; \
rc = _relative_child_get(pd, child); \ rc = _relative_child_get(pd, child); \
if (!rc) return; \ if (!rc) return; \
if (target) rc->rel[DIRECTION].to = target; \ if (target) rc->rel[DIRECTION].to = target; \
if (relative < 0) relative = 0; \ if (relative_position < 0) relative_position = 0; \
else if (relative > 1) relative = 1; \ else if (relative_position > 1) relative_position = 1; \
rc->rel[DIRECTION].relative = relative; \ rc->rel[DIRECTION].relative_position = relative_position; \
efl_pack_layout_request(obj); \ efl_pack_layout_request(obj); \
} \ } \
\ \
EOLIAN static void \ EOLIAN static void \
_efl_ui_relative_layout_relation_ ## direction ## _get(const Eo *obj EINA_UNUSED, Efl_Ui_Relative_Layout_Data *pd, Eo *child, Eo **target, double *relative) \ _efl_ui_relative_container_relation_ ## direction ## _get(const Eo *obj EINA_UNUSED, Efl_Ui_Relative_Container_Data *pd, Eo *child, Eo **target, double *relative_position) \
{ \ { \
Efl_Ui_Relative_Layout_Child *rc; \ Efl_Ui_Relative_Container_Child *rc; \
Eo *rel_to = NULL; \ Eo *rel_to = NULL; \
double rel_relative = 0.0; \ double rel_relative = 0.0; \
rc = eina_hash_find(pd->children, &child); \ rc = eina_hash_find(pd->children, &child); \
if (rc) \ if (rc) \
{ \ { \
rel_to = rc->rel[DIRECTION].to; \ rel_to = rc->rel[DIRECTION].to; \
rel_relative = rc->rel[DIRECTION].relative; \ rel_relative = rc->rel[DIRECTION].relative_position; \
} \ } \
else \ else \
ERR("child(%p(%s)) is not registered", child, efl_class_name_get(child)); \ ERR("child(%p(%s)) is not registered", child, efl_class_name_get(child)); \
if (target) *target = rel_to; \ if (target) *target = rel_to; \
if (relative) *relative = rel_relative; \ if (relative_position) *relative_position = rel_relative; \
} }
#endif #endif

View File

@ -1,74 +0,0 @@
import efl_gfx_types;
class @beta Efl.Ui.Relative_Layout extends Efl.Ui.Widget implements Efl.Pack_Layout, Efl.Pack
{
[[The relative layout class.
A relative layout calculates the size and position of all the children
based on their relationship to each other.]]
methods {
@property relation_left {
[[Specifies the left side edge of the child relative to the target.
By default, target is parent and relative is 0.0.]]
keys {
child: Efl.Gfx.Entity; [[The child to specify relation.]]
}
values {
target: Efl.Gfx.Entity; [[The relative target.]]
relative: Efl.Gfx.Align; [[The ratio between left and right of the target,
ranging from 0.0 to 1.0.]]
}
}
@property relation_right {
[[Specifies the right side edge of the child relative to the target.
By default, target is parent and relative is 1.0.]]
keys {
child: Efl.Gfx.Entity; [[The child to specify relation.]]
}
values {
target: Efl.Gfx.Entity; [[The relative target.]]
relative: Efl.Gfx.Align; [[The ratio between left and right of the target,
ranging from 0.0 to 1.0.]]
}
}
@property relation_top {
[[Specifies the top side edge of the child relative to the target.
By default, target is parent and relative is 0.0.]]
keys {
child: Efl.Gfx.Entity; [[The child to specify relation.]]
}
values {
target: Efl.Gfx.Entity; [[The relative target.]]
relative: Efl.Gfx.Align; [[The ratio between top and bottom of the target,
ranging from 0.0 to 1.0.]]
}
}
@property relation_bottom {
[[Specifies the bottom side edge of the child relative to the target.
By default, target is parent and relative is 1.0.]]
keys {
child: Efl.Gfx.Entity; [[The child to specify relation.]]
}
values {
target: Efl.Gfx.Entity; [[The relative target.]]
relative: Efl.Gfx.Align; [[The ratio between top and bottom of the target,
ranging from 0.0 to 1.0.]]
}
}
}
implements {
Efl.Object.constructor;
Efl.Object.invalidate;
Efl.Object.destructor;
Efl.Canvas.Group.group_calculate;
Efl.Pack.pack_clear;
Efl.Pack.unpack_all;
Efl.Pack.unpack;
Efl.Pack.pack;
Efl.Container.content_iterate;
Efl.Container.content_count;
Efl.Gfx.Entity.position { set; }
Efl.Gfx.Entity.size { set; }
Efl.Pack_Layout.layout_update;
Efl.Pack_Layout.layout_request;
}
}

View File

@ -168,7 +168,7 @@ pub_eo_files = [
'efl_ui_caching_factory.eo', 'efl_ui_caching_factory.eo',
'efl_ui_widget_factory.eo', 'efl_ui_widget_factory.eo',
'efl_ui_property_bind_part.eo', 'efl_ui_property_bind_part.eo',
'efl_ui_relative_layout.eo', 'efl_ui_relative_container.eo',
'efl_ui_action_connector.eo', 'efl_ui_action_connector.eo',
'efl_ui_format.eo', 'efl_ui_format.eo',
'efl_ui_item_clickable.eo', 'efl_ui_item_clickable.eo',
@ -373,7 +373,7 @@ elementary_headers_unstable = [
'efl_ui_tab_pager_private.h', 'efl_ui_tab_pager_private.h',
'efl_ui_tab_bar_private.h', 'efl_ui_tab_bar_private.h',
'efl_ui_tab_page_private.h', 'efl_ui_tab_page_private.h',
'efl_ui_relative_layout_private.h' 'efl_ui_relative_container_private.h'
] ]
elementary_pub_headers = [ elementary_pub_headers = [
@ -931,7 +931,7 @@ elementary_src = [
'efl_ui_homogeneous_model.c', 'efl_ui_homogeneous_model.c',
'efl_ui_exact_model.c', 'efl_ui_exact_model.c',
'efl_ui_average_model.c', 'efl_ui_average_model.c',
'efl_ui_relative_layout.c', 'efl_ui_relative_container.c',
'efl_ui_action_connector.c', 'efl_ui_action_connector.c',
'efl_ui_format.c', 'efl_ui_format.c',
'efl_ui_scroll_util.c', 'efl_ui_scroll_util.c',

View File

@ -19,7 +19,7 @@ static const Efl_Test_Case etc[] = {
{ "efl_ui_box_stack", efl_ui_test_box_stack}, { "efl_ui_box_stack", efl_ui_test_box_stack},
{ "efl_ui_table", efl_ui_test_table}, { "efl_ui_table", efl_ui_test_table},
{ "efl_ui_grid", efl_ui_test_grid}, { "efl_ui_grid", efl_ui_test_grid},
{ "efl_ui_relative_layout", efl_ui_test_relative_layout}, { "efl_ui_relative_container", efl_ui_test_relative_container},
{ "efl_ui_image", efl_ui_test_image}, { "efl_ui_image", efl_ui_test_image},
{ "efl_ui_image_zoomable", efl_ui_test_image_zoomable}, { "efl_ui_image_zoomable", efl_ui_test_image_zoomable},
{ "efl_ui_layout", efl_ui_test_layout}, { "efl_ui_layout", efl_ui_test_layout},

View File

@ -25,7 +25,7 @@ void efl_ui_test_box_flow(TCase *tc);
void efl_ui_test_box_stack(TCase *tc); void efl_ui_test_box_stack(TCase *tc);
void efl_ui_test_table(TCase *tc); void efl_ui_test_table(TCase *tc);
void efl_ui_test_grid(TCase *tc); void efl_ui_test_grid(TCase *tc);
void efl_ui_test_relative_layout(TCase *tc); void efl_ui_test_relative_container(TCase *tc);
void efl_ui_test_atspi(TCase *tc); void efl_ui_test_atspi(TCase *tc);
void efl_ui_test_image_zoomable(TCase *tc); void efl_ui_test_image_zoomable(TCase *tc);
void efl_ui_test_layout(TCase *tc); void efl_ui_test_layout(TCase *tc);

View File

@ -212,24 +212,24 @@ layout_setup()
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC)); efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC));
layout = efl_add(EFL_UI_RELATIVE_LAYOUT_CLASS, win, layout = efl_add(EFL_UI_RELATIVE_CONTAINER_CLASS, win,
efl_gfx_entity_size_set(efl_added, EINA_SIZE2D(200, 200))); efl_gfx_entity_size_set(efl_added, EINA_SIZE2D(200, 200)));
efl_gfx_entity_size_set(win, EINA_SIZE2D(200, 200)); efl_gfx_entity_size_set(win, EINA_SIZE2D(200, 200));
} }
EFL_START_TEST (efl_ui_relative_layout_class_check) EFL_START_TEST (efl_ui_relative_container_class_check)
{ {
const char *class; const char *class;
class = efl_class_name_get(layout); class = efl_class_name_get(layout);
ck_assert(class != NULL); ck_assert(class != NULL);
ck_assert(!strcmp(class, "Efl.Ui.Relative_Layout")); ck_assert(!strcmp(class, "Efl.Ui.Relative_Container"));
} }
EFL_END_TEST EFL_END_TEST
EFL_START_TEST (efl_ui_relative_layout_layout_update) EFL_START_TEST (efl_ui_relative_container_layout_update)
{ {
int i, max_index = (sizeof(hints) / sizeof(Hint)); int i, max_index = (sizeof(hints) / sizeof(Hint));
@ -243,7 +243,7 @@ EFL_START_TEST (efl_ui_relative_layout_layout_update)
} }
EFL_END_TEST EFL_END_TEST
EFL_START_TEST (efl_ui_relative_layout_layout_update_chain) EFL_START_TEST (efl_ui_relative_container_layout_update_chain)
{ {
int i, max_index2, max_index3; int i, max_index2, max_index3;
Eo *btn, *btn2, *btn3; Eo *btn, *btn2, *btn3;
@ -254,8 +254,8 @@ EFL_START_TEST (efl_ui_relative_layout_layout_update_chain)
max_index2 = ((sizeof(hints2) / sizeof(Hint)) / 2); max_index2 = ((sizeof(hints2) / sizeof(Hint)) / 2);
max_index3 = ((sizeof(hints3) / sizeof(Hint)) / 3); max_index3 = ((sizeof(hints3) / sizeof(Hint)) / 3);
efl_ui_relative_layout_relation_bottom_set(layout, btn, btn2, 0.0); efl_ui_relative_container_relation_bottom_set(layout, btn, btn2, 0.0);
efl_ui_relative_layout_relation_top_set(layout, btn2, btn, 1.0); efl_ui_relative_container_relation_top_set(layout, btn2, btn, 1.0);
for (i = 0; i < max_index2; i++) for (i = 0; i < max_index2; i++)
{ {
@ -266,8 +266,8 @@ EFL_START_TEST (efl_ui_relative_layout_layout_update_chain)
} }
btn3 = efl_add(EFL_UI_BUTTON_CLASS, layout); btn3 = efl_add(EFL_UI_BUTTON_CLASS, layout);
efl_ui_relative_layout_relation_bottom_set(layout, btn2, btn3, 0.0); efl_ui_relative_container_relation_bottom_set(layout, btn2, btn3, 0.0);
efl_ui_relative_layout_relation_top_set(layout, btn3, btn2, 1.0); efl_ui_relative_container_relation_top_set(layout, btn3, btn2, 1.0);
for (i = 0; i < max_index3; i++) for (i = 0; i < max_index3; i++)
{ {
@ -281,7 +281,7 @@ EFL_START_TEST (efl_ui_relative_layout_layout_update_chain)
} }
EFL_END_TEST EFL_END_TEST
EFL_START_TEST (efl_ui_relative_layout_relation_set) EFL_START_TEST (efl_ui_relative_container_relation_set)
{ {
Eo *btn; Eo *btn;
Eo *target = NULL; Eo *target = NULL;
@ -290,48 +290,48 @@ EFL_START_TEST (efl_ui_relative_layout_relation_set)
btn = efl_add(EFL_UI_BUTTON_CLASS, layout); btn = efl_add(EFL_UI_BUTTON_CLASS, layout);
// negative test // negative test
efl_ui_relative_layout_relation_top_get(layout, NULL, &target, &relative); efl_ui_relative_container_relation_top_get(layout, NULL, &target, &relative);
ck_assert_ptr_eq(target, NULL); ck_assert_ptr_eq(target, NULL);
ck_assert(EINA_DBL_EQ(relative, 0.0)); ck_assert(EINA_DBL_EQ(relative, 0.0));
efl_ui_relative_layout_relation_top_get(layout, btn, &target, &relative); efl_ui_relative_container_relation_top_get(layout, btn, &target, &relative);
ck_assert_ptr_eq(target, NULL); ck_assert_ptr_eq(target, NULL);
ck_assert(EINA_DBL_EQ(relative, 0.0)); ck_assert(EINA_DBL_EQ(relative, 0.0));
efl_ui_relative_layout_relation_top_set(layout, NULL, NULL, 0.0); efl_ui_relative_container_relation_top_set(layout, NULL, NULL, 0.0);
ck_assert_ptr_eq(target, NULL); ck_assert_ptr_eq(target, NULL);
ck_assert(EINA_DBL_EQ(relative, 0.0)); ck_assert(EINA_DBL_EQ(relative, 0.0));
// default value test // default value test
efl_ui_relative_layout_relation_top_set(layout, btn, layout, 0.0); efl_ui_relative_container_relation_top_set(layout, btn, layout, 0.0);
efl_ui_relative_layout_relation_top_get(layout, btn, &target, &relative); efl_ui_relative_container_relation_top_get(layout, btn, &target, &relative);
ck_assert_ptr_eq(target, layout); ck_assert_ptr_eq(target, layout);
ck_assert(EINA_DBL_EQ(relative, 0.0)); ck_assert(EINA_DBL_EQ(relative, 0.0));
efl_ui_relative_layout_relation_bottom_get(layout, btn, &target, &relative); efl_ui_relative_container_relation_bottom_get(layout, btn, &target, &relative);
ck_assert_ptr_eq(target, layout); ck_assert_ptr_eq(target, layout);
ck_assert(EINA_DBL_EQ(relative, 1.0)); ck_assert(EINA_DBL_EQ(relative, 1.0));
efl_ui_relative_layout_relation_left_get(layout, btn, &target, &relative); efl_ui_relative_container_relation_left_get(layout, btn, &target, &relative);
ck_assert_ptr_eq(target, layout); ck_assert_ptr_eq(target, layout);
ck_assert(EINA_DBL_EQ(relative, 0.0)); ck_assert(EINA_DBL_EQ(relative, 0.0));
efl_ui_relative_layout_relation_right_get(layout, btn, &target, &relative); efl_ui_relative_container_relation_right_get(layout, btn, &target, &relative);
ck_assert_ptr_eq(target, layout); ck_assert_ptr_eq(target, layout);
ck_assert(EINA_DBL_EQ(relative, 1.0)); ck_assert(EINA_DBL_EQ(relative, 1.0));
// positive test // positive test
efl_ui_relative_layout_relation_top_set(layout, btn, layout, 0.123); efl_ui_relative_container_relation_top_set(layout, btn, layout, 0.123);
efl_ui_relative_layout_relation_top_get(layout, btn, &target, &relative); efl_ui_relative_container_relation_top_get(layout, btn, &target, &relative);
ck_assert_ptr_eq(target, layout); ck_assert_ptr_eq(target, layout);
ck_assert(EINA_DBL_EQ(relative, 0.123)); ck_assert(EINA_DBL_EQ(relative, 0.123));
efl_ui_relative_layout_relation_top_set(layout, btn, NULL, 0.456); efl_ui_relative_container_relation_top_set(layout, btn, NULL, 0.456);
efl_ui_relative_layout_relation_top_get(layout, btn, &target, &relative); efl_ui_relative_container_relation_top_get(layout, btn, &target, &relative);
ck_assert_ptr_eq(target, layout); ck_assert_ptr_eq(target, layout);
ck_assert(EINA_DBL_EQ(relative, 0.456)); ck_assert(EINA_DBL_EQ(relative, 0.456));
} }
EFL_END_TEST EFL_END_TEST
EFL_START_TEST (efl_ui_relative_layout_pack) EFL_START_TEST (efl_ui_relative_container_pack)
{ {
Eo *btn[3], *child; Eo *btn[3], *child;
Eina_Iterator *it; Eina_Iterator *it;
@ -363,12 +363,12 @@ EFL_START_TEST (efl_ui_relative_layout_pack)
} }
EFL_END_TEST EFL_END_TEST
void efl_ui_test_relative_layout(TCase *tc) void efl_ui_test_relative_container(TCase *tc)
{ {
tcase_add_checked_fixture(tc, layout_setup, NULL); tcase_add_checked_fixture(tc, layout_setup, NULL);
tcase_add_test(tc, efl_ui_relative_layout_class_check); tcase_add_test(tc, efl_ui_relative_container_class_check);
tcase_add_test(tc, efl_ui_relative_layout_layout_update); tcase_add_test(tc, efl_ui_relative_container_layout_update);
tcase_add_test(tc, efl_ui_relative_layout_layout_update_chain); tcase_add_test(tc, efl_ui_relative_container_layout_update_chain);
tcase_add_test(tc, efl_ui_relative_layout_relation_set); tcase_add_test(tc, efl_ui_relative_container_relation_set);
tcase_add_test(tc, efl_ui_relative_layout_pack); tcase_add_test(tc, efl_ui_relative_container_pack);
} }

View File

@ -134,7 +134,7 @@ efl_ui_suite_src = [
'efl_ui_test_box_stack.c', 'efl_ui_test_box_stack.c',
'efl_ui_test_table.c', 'efl_ui_test_table.c',
'efl_ui_test_grid.c', 'efl_ui_test_grid.c',
'efl_ui_test_relative_layout.c', 'efl_ui_test_relative_container.c',
'efl_ui_test_image.c', 'efl_ui_test_image.c',
'efl_ui_test_image_zoomable.c', 'efl_ui_test_image_zoomable.c',
'efl_ui_test_layout.c', 'efl_ui_test_layout.c',

View File

@ -43,7 +43,7 @@
"Efl.Ui.Tab_Page", "Efl.Ui.Tab_Page",
"Efl.Ui.Timepicker", "Efl.Ui.Timepicker",
"Efl.Ui.Navigation_Bar", "Efl.Ui.Navigation_Bar",
"Efl.Ui.Relative_Layout", "Efl.Ui.Relative_Container",
"Efl.Ui.Animation_View", "Efl.Ui.Animation_View",
"Efl.Ui.Table", "Efl.Ui.Table",
"Efl.Ui.Flip" "Efl.Ui.Flip"

View File

@ -8,7 +8,7 @@
/* spec-meta-start /* spec-meta-start
{"test-interface":"Efl.Pack", {"test-interface":"Efl.Pack",
"test-widgets": ["Efl.Ui.Table", "Efl.Ui.Relative_Layout"]} "test-widgets": ["Efl.Ui.Table", "Efl.Ui.Relative_Container"]}
spec-meta-end */ spec-meta-end */