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:
parent
a5daa2b72f
commit
246485ca92
|
@ -155,7 +155,7 @@ elementary_test_src = [
|
|||
'test_win_indicator.c',
|
||||
'test_gesture_framework.c',
|
||||
'test_ui_tab_pager.c',
|
||||
'test_ui_relative_layout.c',
|
||||
'test_ui_relative_container.c',
|
||||
'test_ui_collection.c',
|
||||
'test_ui_collection_view.c',
|
||||
'test_ui_items.c',
|
||||
|
|
|
@ -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_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_collection_list(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 (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.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 Grid", test_efl_ui_collection_grid);
|
||||
ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection_View", test_efl_ui_collection_view);
|
||||
|
|
|
@ -57,20 +57,20 @@ _btn_clicked_to_cb(void *data, const Efl_Event *event)
|
|||
switch (opt)
|
||||
{
|
||||
case LEFT:
|
||||
efl_ui_relative_layout_relation_left_get(layout, btn, NULL, &relative);
|
||||
efl_ui_relative_layout_relation_left_set(layout, btn, to, relative);
|
||||
efl_ui_relative_container_relation_left_get(layout, btn, NULL, &relative);
|
||||
efl_ui_relative_container_relation_left_set(layout, btn, to, relative);
|
||||
break;
|
||||
case RIGHT:
|
||||
efl_ui_relative_layout_relation_right_get(layout, btn, NULL, &relative);
|
||||
efl_ui_relative_layout_relation_right_set(layout, btn, to, relative);
|
||||
efl_ui_relative_container_relation_right_get(layout, btn, NULL, &relative);
|
||||
efl_ui_relative_container_relation_right_set(layout, btn, to, relative);
|
||||
break;
|
||||
case TOP:
|
||||
efl_ui_relative_layout_relation_top_get(layout, btn, NULL, &relative);
|
||||
efl_ui_relative_layout_relation_top_set(layout, btn, to, relative);
|
||||
efl_ui_relative_container_relation_top_get(layout, btn, NULL, &relative);
|
||||
efl_ui_relative_container_relation_top_set(layout, btn, to, relative);
|
||||
break;
|
||||
case BOTTOM:
|
||||
efl_ui_relative_layout_relation_bottom_get(layout, btn, NULL, &relative);
|
||||
efl_ui_relative_layout_relation_bottom_set(layout, btn, to, relative);
|
||||
efl_ui_relative_container_relation_bottom_get(layout, btn, NULL, &relative);
|
||||
efl_ui_relative_container_relation_bottom_set(layout, btn, to, relative);
|
||||
break;
|
||||
}
|
||||
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)
|
||||
{
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -131,19 +131,19 @@ _setter_add(Eo *vbox, Eo *btn, Options option)
|
|||
{
|
||||
case 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;
|
||||
case 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;
|
||||
case 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;
|
||||
case 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;
|
||||
}
|
||||
btn_text = ((to == layout) ? "parent" : (char *)efl_text_get(to));
|
||||
|
@ -271,12 +271,12 @@ _button_frame_add(Eo *box, Eo *btn)
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
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));
|
||||
|
||||
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_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));
|
||||
|
||||
btn1 = efl_add(EFL_UI_BUTTON_CLASS, layout,
|
||||
efl_text_set(efl_added, "button1"),
|
||||
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_ui_relative_layout_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_right_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,
|
||||
efl_text_set(efl_added, "button2"),
|
||||
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_layout_relation_bottom_set(layout, efl_added, layout, 0.0));
|
||||
efl_ui_relative_container_relation_left_set(layout, efl_added, btn1, 1.0),
|
||||
efl_ui_relative_container_relation_bottom_set(layout, efl_added, layout, 0.0));
|
||||
|
||||
btn3 = efl_add(EFL_UI_BUTTON_CLASS, layout,
|
||||
efl_text_set(efl_added, "button3"),
|
||||
efl_ui_relative_layout_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_left_set(layout, efl_added, btn2, 0.0),
|
||||
efl_ui_relative_container_relation_top_set(layout, efl_added, btn2, 1.0));
|
||||
|
||||
_button_frame_add(hbox, btn1);
|
||||
_button_frame_add(hbox, btn2);
|
|
@ -169,5 +169,5 @@
|
|||
/efl_ui_list_view_example_3
|
||||
/efl_ui_theme_example_01
|
||||
/efl_ui_theme_example_02
|
||||
/efl_ui_relative_layout_example_01
|
||||
/efl_ui_relative_layout_example_02
|
||||
/efl_ui_relative_container_example_01
|
||||
/efl_ui_relative_container_example_02
|
||||
|
|
|
@ -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
|
||||
#include "elementary_config.h"
|
||||
|
@ -16,10 +16,10 @@ elm_main(int argc, char **argv)
|
|||
Eo *win, *layout, *btn1, *btn2, *btn3;
|
||||
|
||||
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));
|
||||
|
||||
layout = efl_add(EFL_UI_RELATIVE_LAYOUT_CLASS, win,
|
||||
layout = efl_add(EFL_UI_RELATIVE_CONTAINER_CLASS, win,
|
||||
efl_content_set(win, efl_added));
|
||||
|
||||
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_align_set(efl_added, 0, 0),
|
||||
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_layout_relation_bottom_set(layout, efl_added, layout, 0.0));
|
||||
efl_ui_relative_container_relation_right_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,
|
||||
efl_text_set(efl_added, "btn2"),
|
||||
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(0, 200)),
|
||||
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_layout_relation_bottom_set(layout, efl_added, layout, 0.0));
|
||||
efl_ui_relative_container_relation_left_set(layout, efl_added, btn1, 1.0),
|
||||
efl_ui_relative_container_relation_bottom_set(layout, efl_added, layout, 0.0));
|
||||
|
||||
btn3 = efl_add(EFL_UI_BUTTON_CLASS, layout,
|
||||
efl_text_set(efl_added, "btn3"),
|
||||
efl_ui_relative_layout_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_left_set(layout, efl_added, btn2, 0.0),
|
||||
efl_ui_relative_container_relation_top_set(layout, efl_added, btn2, 1.0));
|
||||
|
||||
efl_gfx_entity_size_set(win, EINA_SIZE2D(300, 300));
|
||||
|
|
@ -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
|
||||
#include "elementary_config.h"
|
||||
|
@ -16,10 +16,10 @@ elm_main(int argc, char **argv)
|
|||
Eo *win, *layout, *btn1, *btn2;
|
||||
|
||||
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));
|
||||
|
||||
layout = efl_add(EFL_UI_RELATIVE_LAYOUT_CLASS, win,
|
||||
layout = efl_add(EFL_UI_RELATIVE_CONTAINER_CLASS, win,
|
||||
efl_content_set(win, efl_added));
|
||||
|
||||
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_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_layout_relation_bottom_set(layout, btn1, btn2, 0.0);
|
||||
efl_ui_relative_container_relation_right_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_layout_relation_top_set(layout, btn2, btn1, 1.0);
|
||||
efl_ui_relative_container_relation_left_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));
|
||||
|
|
@ -222,7 +222,7 @@ EAPI Eina_Bool efl_ui_win_autodel_get(const Efl_Ui_Win *obj);
|
|||
#endif
|
||||
# include <efl_ui_win_inlined.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!
|
||||
typedef void (*Context_Item_Clicked_Cb)(void *data, Eo *obj, void *event_info);
|
||||
|
|
|
@ -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_NAME "Efl.Ui.Relative_Layout"
|
||||
#define MY_CLASS EFL_UI_RELATIVE_CONTAINER_CLASS
|
||||
#define MY_CLASS_NAME "Efl.Ui.Relative_Container"
|
||||
|
||||
#define LEFT 0
|
||||
#define RIGHT 1
|
||||
|
@ -11,15 +11,15 @@
|
|||
#define START (axis ? TOP : LEFT)
|
||||
#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
|
||||
_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);
|
||||
calc2 = EINA_INLIST_CONTAINER_GET(l2, 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_Container_Calc);
|
||||
|
||||
return calc2->comp_factor <= calc1->comp_factor ? -1 : 1;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ _chain_sort_cb(const void *l1, const void *l2)
|
|||
static void
|
||||
_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);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ _on_child_size_changed(void *data, const Efl_Event *event EINA_UNUSED)
|
|||
static void
|
||||
_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);
|
||||
}
|
||||
|
@ -43,42 +43,42 @@ _on_child_hints_changed(void *data, const Efl_Event *event EINA_UNUSED)
|
|||
static void
|
||||
_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_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_HINTS_CHANGED, _on_child_hints_changed },
|
||||
{ EFL_EVENT_DEL, _on_child_del }
|
||||
);
|
||||
|
||||
static Efl_Ui_Relative_Layout_Child *
|
||||
_efl_ui_relative_layout_register(Efl_Ui_Relative_Layout_Data *pd, Eo *child)
|
||||
static Efl_Ui_Relative_Container_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))
|
||||
return NULL;
|
||||
|
||||
rc = calloc(1, sizeof(Efl_Ui_Relative_Layout_Child));
|
||||
rc = calloc(1, sizeof(Efl_Ui_Relative_Container_Child));
|
||||
if (!rc) return NULL;
|
||||
|
||||
rc->obj = child;
|
||||
rc->layout = pd->obj;
|
||||
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].relative = 1.0;
|
||||
rc->rel[RIGHT].relative_position = 1.0;
|
||||
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].relative = 1.0;
|
||||
rc->rel[BOTTOM].relative_position = 1.0;
|
||||
|
||||
efl_key_data_set(child, "_elm_leaveme", pd->obj);
|
||||
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_change(pd->obj);
|
||||
|
||||
|
@ -87,22 +87,22 @@ _efl_ui_relative_layout_register(Efl_Ui_Relative_Layout_Data *pd, Eo *child)
|
|||
return rc;
|
||||
}
|
||||
|
||||
static Efl_Ui_Relative_Layout_Child *
|
||||
_relative_child_get(Efl_Ui_Relative_Layout_Data *pd, Eo *child)
|
||||
static Efl_Ui_Relative_Container_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);
|
||||
if (!rc)
|
||||
rc = _efl_ui_relative_layout_register(pd, child);
|
||||
rc = _efl_ui_relative_container_register(pd, child);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static Efl_Ui_Relative_Layout_Child *
|
||||
_relative_child_find(Efl_Ui_Relative_Layout_Data *pd, Eo *target)
|
||||
static Efl_Ui_Relative_Container_Child *
|
||||
_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)
|
||||
return pd->base;
|
||||
|
@ -118,9 +118,9 @@ _relative_child_find(Efl_Ui_Relative_Layout_Data *pd, Eo *target)
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
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
|
||||
_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;
|
||||
int space, min_sum = 0;
|
||||
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);
|
||||
|
||||
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 +
|
||||
(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))
|
||||
cur_pos += (space - min_sum) * head->calc.align[axis];
|
||||
else
|
||||
{
|
||||
Efl_Ui_Relative_Layout_Calc *calc;
|
||||
Efl_Ui_Relative_Container_Calc *calc;
|
||||
double weight_len, orig_space = space, orig_weight = weight_sum;
|
||||
|
||||
// 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.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];
|
||||
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];
|
||||
child->calc.m0[axis] += -child->calc.min[axis] +
|
||||
(head->calc.to[START]->calc.m0[axis] * head->rel[START].relative) +
|
||||
(tail->calc.to[END]->calc.m0[axis] * (1 - tail->rel[END].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_position));
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
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)
|
||||
return;
|
||||
|
@ -348,10 +348,10 @@ _child_calc(Efl_Ui_Relative_Layout_Child *child, Eina_Bool axis)
|
|||
_child_calc(calc->to[END], axis);
|
||||
|
||||
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->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;
|
||||
}
|
||||
|
||||
|
@ -381,18 +381,18 @@ _child_calc(Efl_Ui_Relative_Layout_Child *child, Eina_Bool axis)
|
|||
return;
|
||||
|
||||
//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->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->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]) &&
|
||||
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
|
||||
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];
|
||||
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))) ?
|
||||
|
@ -400,7 +400,7 @@ _child_calc(Efl_Ui_Relative_Layout_Child *child, Eina_Bool axis)
|
|||
}
|
||||
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
|
||||
_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_object_clipper_set(child->obj, 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);
|
||||
|
||||
if (!efl_invalidated_get(child->obj))
|
||||
|
@ -425,9 +425,9 @@ _hash_free_cb(void *data)
|
|||
static void
|
||||
_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);
|
||||
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,
|
||||
void *data, void *fdata)
|
||||
{
|
||||
Efl_Ui_Relative_Layout_Child *child = data;
|
||||
Efl_Ui_Relative_Layout_Calc *calc = &(child->calc);
|
||||
Efl_Ui_Relative_Layout_Data *pd = fdata;
|
||||
Efl_Ui_Relative_Container_Child *child = data;
|
||||
Efl_Ui_Relative_Container_Calc *calc = &(child->calc);
|
||||
Efl_Ui_Relative_Container_Data *pd = fdata;
|
||||
Eina_Rect want;
|
||||
int axis, layout_min;
|
||||
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)
|
||||
{
|
||||
Eina_Size2D max, min, aspect;
|
||||
Efl_Ui_Relative_Layout_Child *child = data;
|
||||
Efl_Ui_Relative_Layout_Calc *calc = &(child->calc);
|
||||
Efl_Ui_Relative_Layout_Data *pd = fdata;
|
||||
Efl_Ui_Relative_Container_Child *child = data;
|
||||
Efl_Ui_Relative_Container_Calc *calc = &(child->calc);
|
||||
Efl_Ui_Relative_Container_Data *pd = fdata;
|
||||
|
||||
calc->to[LEFT] = _relative_child_find(pd, child->rel[LEFT].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
|
||||
_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);
|
||||
}
|
||||
|
||||
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);
|
||||
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
|
||||
_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);
|
||||
}
|
||||
|
||||
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_pack_layout_update(obj);
|
||||
}
|
||||
|
||||
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_canvas_group_change(obj);
|
||||
}
|
||||
|
||||
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_canvas_group_change(obj);
|
||||
}
|
||||
|
||||
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);
|
||||
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_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));
|
||||
|
||||
elm_widget_highlight_ignore_set(obj, EINA_TRUE);
|
||||
}
|
||||
|
||||
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));
|
||||
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->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;
|
||||
|
||||
pd->base->obj = obj;
|
||||
pd->base->layout = 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].relative = 1.0;
|
||||
pd->base->rel[RIGHT].relative_position = 1.0;
|
||||
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].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.mj[0] = pd->base->calc.mj[1] = 1.0;
|
||||
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
|
||||
_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));
|
||||
|
||||
|
@ -642,26 +642,26 @@ _efl_ui_relative_layout_efl_object_invalidate(Eo *obj, Efl_Ui_Relative_Layout_Da
|
|||
}
|
||||
|
||||
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_ui_relative_layout_hints_changed_cb, NULL);
|
||||
_efl_ui_relative_container_hints_changed_cb, NULL);
|
||||
eina_hash_free(pd->children);
|
||||
if (pd->base) free(pd->base);
|
||||
efl_destructor(efl_super(obj, MY_CLASS));
|
||||
}
|
||||
|
||||
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_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
|
||||
_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))
|
||||
{
|
||||
|
@ -675,7 +675,7 @@ _efl_ui_relative_layout_efl_pack_unpack(Eo *obj, Efl_Ui_Relative_Layout_Data *pd
|
|||
}
|
||||
|
||||
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);
|
||||
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
|
||||
_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_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
|
||||
_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))
|
||||
return EINA_FALSE;
|
||||
|
@ -708,54 +708,54 @@ _efl_ui_relative_layout_content_iterator_next(Efl_Ui_Relative_Layout_Content_Ite
|
|||
}
|
||||
|
||||
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
|
||||
_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);
|
||||
free(it);
|
||||
}
|
||||
|
||||
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));
|
||||
if (!it) return NULL;
|
||||
|
||||
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->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(
|
||||
_efl_ui_relative_layout_content_iterator_get_container);
|
||||
it->iterator.free = FUNC_ITERATOR_FREE(_efl_ui_relative_layout_content_iterator_free);
|
||||
_efl_ui_relative_container_content_iterator_get_container);
|
||||
it->iterator.free = FUNC_ITERATOR_FREE(_efl_ui_relative_container_content_iterator_free);
|
||||
|
||||
return &it->iterator;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
EFL_UI_RELATIVE_LAYOUT_RELATION_SET_GET(left, LEFT);
|
||||
EFL_UI_RELATIVE_LAYOUT_RELATION_SET_GET(right, RIGHT);
|
||||
EFL_UI_RELATIVE_LAYOUT_RELATION_SET_GET(top, TOP);
|
||||
EFL_UI_RELATIVE_LAYOUT_RELATION_SET_GET(bottom, BOTTOM);
|
||||
EFL_UI_RELATIVE_CONTAINER_RELATION_SET_GET(left, LEFT);
|
||||
EFL_UI_RELATIVE_CONTAINER_RELATION_SET_GET(right, RIGHT);
|
||||
EFL_UI_RELATIVE_CONTAINER_RELATION_SET_GET(top, TOP);
|
||||
EFL_UI_RELATIVE_CONTAINER_RELATION_SET_GET(bottom, BOTTOM);
|
||||
|
||||
/* Internal EO APIs and hidden overrides */
|
||||
|
||||
#define EFL_UI_RELATIVE_LAYOUT_EXTRA_OPS \
|
||||
EFL_CANVAS_GROUP_ADD_OPS(efl_ui_relative_layout)
|
||||
#define EFL_UI_RELATIVE_CONTAINER_EXTRA_OPS \
|
||||
EFL_CANVAS_GROUP_ADD_OPS(efl_ui_relative_container)
|
||||
|
||||
#include "efl_ui_relative_layout.eo.c"
|
||||
#include "efl_ui_relative_container.eo.c"
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef EFL_UI_RELATIVE_LAYOUT_PRIVATE_H
|
||||
#define EFL_UI_RELATIVE_LAYOUT_PRIVATE_H
|
||||
#ifndef EFL_UI_RELATIVE_CONTAINER_PRIVATE_H
|
||||
#define EFL_UI_RELATIVE_CONTAINER_PRIVATE_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "elementary_config.h"
|
||||
|
@ -10,20 +10,20 @@
|
|||
#include <Elementary.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_DONE,
|
||||
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_Layout_Child Efl_Ui_Relative_Layout_Child;
|
||||
typedef struct _Efl_Ui_Relative_Layout_Calc Efl_Ui_Relative_Layout_Calc;
|
||||
typedef struct _Efl_Ui_Relative_Layout_Relation Efl_Ui_Relative_Layout_Relation;
|
||||
typedef struct _Efl_Ui_Relative_Layout_Content_Iterator Efl_Ui_Relative_Layout_Content_Iterator;
|
||||
typedef struct _Efl_Ui_Relative_Container_Data Efl_Ui_Relative_Container_Data;
|
||||
typedef struct _Efl_Ui_Relative_Container_Child Efl_Ui_Relative_Container_Child;
|
||||
typedef struct _Efl_Ui_Relative_Container_Calc Efl_Ui_Relative_Container_Calc;
|
||||
typedef struct _Efl_Ui_Relative_Container_Relation Efl_Ui_Relative_Container_Relation;
|
||||
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;
|
||||
|
||||
|
@ -42,7 +42,7 @@ struct _Efl_Ui_Relative_Layout_Calc
|
|||
* align is greater than relative, (min * ((1 - align) / (1 - relative))) otherwise.
|
||||
* mi, mj are transformed relative based on layout min size. they are
|
||||
* 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 |
|
||||
* | min | 100 | 100 |
|
||||
* |left.target | layout| obj1 |
|
||||
|
@ -52,7 +52,7 @@ struct _Efl_Ui_Relative_Layout_Calc
|
|||
* | mi | 0.0 | 0.25 |
|
||||
* | 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
|
||||
* 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
|
||||
|
@ -70,71 +70,71 @@ struct _Efl_Ui_Relative_Layout_Calc
|
|||
double length;
|
||||
} space[2], want[2];
|
||||
|
||||
Efl_Ui_Relative_Layout_Calc_State state[2];
|
||||
Efl_Ui_Relative_Layout_Calc_State chain_state[2];
|
||||
Efl_Ui_Relative_Layout_Child *to[4];
|
||||
Efl_Ui_Relative_Container_Calc_State state[2];
|
||||
Efl_Ui_Relative_Container_Calc_State chain_state[2];
|
||||
Efl_Ui_Relative_Container_Child *to[4];
|
||||
};
|
||||
|
||||
struct _Efl_Ui_Relative_Layout_Data
|
||||
struct _Efl_Ui_Relative_Container_Data
|
||||
{
|
||||
Eo *obj;
|
||||
Eo *clipper;
|
||||
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;
|
||||
double relative;
|
||||
double relative_position;
|
||||
};
|
||||
|
||||
struct _Efl_Ui_Relative_Layout_Child
|
||||
struct _Efl_Ui_Relative_Container_Child
|
||||
{
|
||||
Eo *obj;
|
||||
Eo *layout;
|
||||
Efl_Ui_Relative_Layout_Relation rel[4];
|
||||
Efl_Ui_Relative_Layout_Calc calc;
|
||||
Efl_Ui_Relative_Container_Relation rel[4];
|
||||
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 *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 \
|
||||
_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; \
|
||||
rc = _relative_child_get(pd, child); \
|
||||
if (!rc) return; \
|
||||
if (target) rc->rel[DIRECTION].to = target; \
|
||||
if (relative < 0) relative = 0; \
|
||||
else if (relative > 1) relative = 1; \
|
||||
rc->rel[DIRECTION].relative = relative; \
|
||||
if (relative_position < 0) relative_position = 0; \
|
||||
else if (relative_position > 1) relative_position = 1; \
|
||||
rc->rel[DIRECTION].relative_position = relative_position; \
|
||||
efl_pack_layout_request(obj); \
|
||||
} \
|
||||
\
|
||||
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; \
|
||||
double rel_relative = 0.0; \
|
||||
rc = eina_hash_find(pd->children, &child); \
|
||||
if (rc) \
|
||||
{ \
|
||||
rel_to = rc->rel[DIRECTION].to; \
|
||||
rel_relative = rc->rel[DIRECTION].relative; \
|
||||
rel_relative = rc->rel[DIRECTION].relative_position; \
|
||||
} \
|
||||
else \
|
||||
ERR("child(%p(%s)) is not registered", child, efl_class_name_get(child)); \
|
||||
if (target) *target = rel_to; \
|
||||
if (relative) *relative = rel_relative; \
|
||||
if (relative_position) *relative_position = rel_relative; \
|
||||
}
|
||||
|
||||
#endif
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -168,7 +168,7 @@ pub_eo_files = [
|
|||
'efl_ui_caching_factory.eo',
|
||||
'efl_ui_widget_factory.eo',
|
||||
'efl_ui_property_bind_part.eo',
|
||||
'efl_ui_relative_layout.eo',
|
||||
'efl_ui_relative_container.eo',
|
||||
'efl_ui_action_connector.eo',
|
||||
'efl_ui_format.eo',
|
||||
'efl_ui_item_clickable.eo',
|
||||
|
@ -373,7 +373,7 @@ elementary_headers_unstable = [
|
|||
'efl_ui_tab_pager_private.h',
|
||||
'efl_ui_tab_bar_private.h',
|
||||
'efl_ui_tab_page_private.h',
|
||||
'efl_ui_relative_layout_private.h'
|
||||
'efl_ui_relative_container_private.h'
|
||||
]
|
||||
|
||||
elementary_pub_headers = [
|
||||
|
@ -931,7 +931,7 @@ elementary_src = [
|
|||
'efl_ui_homogeneous_model.c',
|
||||
'efl_ui_exact_model.c',
|
||||
'efl_ui_average_model.c',
|
||||
'efl_ui_relative_layout.c',
|
||||
'efl_ui_relative_container.c',
|
||||
'efl_ui_action_connector.c',
|
||||
'efl_ui_format.c',
|
||||
'efl_ui_scroll_util.c',
|
||||
|
|
|
@ -19,7 +19,7 @@ static const Efl_Test_Case etc[] = {
|
|||
{ "efl_ui_box_stack", efl_ui_test_box_stack},
|
||||
{ "efl_ui_table", efl_ui_test_table},
|
||||
{ "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_zoomable", efl_ui_test_image_zoomable},
|
||||
{ "efl_ui_layout", efl_ui_test_layout},
|
||||
|
|
|
@ -25,7 +25,7 @@ void efl_ui_test_box_flow(TCase *tc);
|
|||
void efl_ui_test_box_stack(TCase *tc);
|
||||
void efl_ui_test_table(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_image_zoomable(TCase *tc);
|
||||
void efl_ui_test_layout(TCase *tc);
|
||||
|
|
|
@ -212,24 +212,24 @@ layout_setup()
|
|||
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
|
||||
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(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;
|
||||
|
||||
class = efl_class_name_get(layout);
|
||||
|
||||
ck_assert(class != NULL);
|
||||
ck_assert(!strcmp(class, "Efl.Ui.Relative_Layout"));
|
||||
ck_assert(!strcmp(class, "Efl.Ui.Relative_Container"));
|
||||
}
|
||||
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));
|
||||
|
||||
|
@ -243,7 +243,7 @@ EFL_START_TEST (efl_ui_relative_layout_layout_update)
|
|||
}
|
||||
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;
|
||||
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_index3 = ((sizeof(hints3) / sizeof(Hint)) / 3);
|
||||
|
||||
efl_ui_relative_layout_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_bottom_set(layout, btn, btn2, 0.0);
|
||||
efl_ui_relative_container_relation_top_set(layout, btn2, btn, 1.0);
|
||||
|
||||
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);
|
||||
efl_ui_relative_layout_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_bottom_set(layout, btn2, btn3, 0.0);
|
||||
efl_ui_relative_container_relation_top_set(layout, btn3, btn2, 1.0);
|
||||
|
||||
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_START_TEST (efl_ui_relative_layout_relation_set)
|
||||
EFL_START_TEST (efl_ui_relative_container_relation_set)
|
||||
{
|
||||
Eo *btn;
|
||||
Eo *target = NULL;
|
||||
|
@ -290,48 +290,48 @@ EFL_START_TEST (efl_ui_relative_layout_relation_set)
|
|||
btn = efl_add(EFL_UI_BUTTON_CLASS, layout);
|
||||
|
||||
// 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(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(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(EINA_DBL_EQ(relative, 0.0));
|
||||
|
||||
// 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(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(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(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(EINA_DBL_EQ(relative, 1.0));
|
||||
|
||||
// positive test
|
||||
efl_ui_relative_layout_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_set(layout, btn, layout, 0.123);
|
||||
efl_ui_relative_container_relation_top_get(layout, btn, &target, &relative);
|
||||
ck_assert_ptr_eq(target, layout);
|
||||
ck_assert(EINA_DBL_EQ(relative, 0.123));
|
||||
|
||||
efl_ui_relative_layout_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_set(layout, btn, NULL, 0.456);
|
||||
efl_ui_relative_container_relation_top_get(layout, btn, &target, &relative);
|
||||
ck_assert_ptr_eq(target, layout);
|
||||
ck_assert(EINA_DBL_EQ(relative, 0.456));
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
EFL_START_TEST (efl_ui_relative_layout_pack)
|
||||
EFL_START_TEST (efl_ui_relative_container_pack)
|
||||
{
|
||||
Eo *btn[3], *child;
|
||||
Eina_Iterator *it;
|
||||
|
@ -363,12 +363,12 @@ EFL_START_TEST (efl_ui_relative_layout_pack)
|
|||
}
|
||||
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_test(tc, efl_ui_relative_layout_class_check);
|
||||
tcase_add_test(tc, efl_ui_relative_layout_layout_update);
|
||||
tcase_add_test(tc, efl_ui_relative_layout_layout_update_chain);
|
||||
tcase_add_test(tc, efl_ui_relative_layout_relation_set);
|
||||
tcase_add_test(tc, efl_ui_relative_layout_pack);
|
||||
tcase_add_test(tc, efl_ui_relative_container_class_check);
|
||||
tcase_add_test(tc, efl_ui_relative_container_layout_update);
|
||||
tcase_add_test(tc, efl_ui_relative_container_layout_update_chain);
|
||||
tcase_add_test(tc, efl_ui_relative_container_relation_set);
|
||||
tcase_add_test(tc, efl_ui_relative_container_pack);
|
||||
}
|
|
@ -134,7 +134,7 @@ efl_ui_suite_src = [
|
|||
'efl_ui_test_box_stack.c',
|
||||
'efl_ui_test_table.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_zoomable.c',
|
||||
'efl_ui_test_layout.c',
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
"Efl.Ui.Tab_Page",
|
||||
"Efl.Ui.Timepicker",
|
||||
"Efl.Ui.Navigation_Bar",
|
||||
"Efl.Ui.Relative_Layout",
|
||||
"Efl.Ui.Relative_Container",
|
||||
"Efl.Ui.Animation_View",
|
||||
"Efl.Ui.Table",
|
||||
"Efl.Ui.Flip"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
/* spec-meta-start
|
||||
{"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 */
|
||||
|
||||
|
|
Loading…
Reference in New Issue