2016-04-11 22:10:05 -07:00
|
|
|
#include "efl_ui_box_private.h"
|
|
|
|
|
2016-04-17 21:54:46 -07:00
|
|
|
#define MY_CLASS EFL_UI_BOX_CLASS
|
|
|
|
#define MY_CLASS_NAME "Efl.Ui.Box"
|
|
|
|
|
2016-04-11 22:10:05 -07:00
|
|
|
/* COPIED FROM ELM_BOX
|
|
|
|
* - removed transition stuff (TODO: add back - needs clean API first)
|
|
|
|
*/
|
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
#define EFL_UI_BOX_DATA_GET(o, sd) \
|
|
|
|
Efl_Ui_Box_Data *sd = efl_data_scope_get(o, EFL_UI_BOX_CLASS)
|
|
|
|
|
|
|
|
void _efl_ui_box_custom_layout(Efl_Ui_Box *ui_box, Efl_Ui_Box_Data *pd);
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2019-04-12 03:18:04 -07:00
|
|
|
_on_child_size_changed(void *data, const Efl_Event *event EINA_UNUSED)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
Eo *box = data;
|
|
|
|
efl_pack_layout_request(box);
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2019-04-12 03:18:04 -07:00
|
|
|
_on_child_del(void *data, const Efl_Event *event)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
Eo *box = data;
|
|
|
|
EFL_UI_BOX_DATA_GET(box, sd);
|
2016-04-19 01:43:28 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
sd->children = eina_list_remove(sd->children, event->object);
|
|
|
|
|
|
|
|
efl_pack_layout_request(box);
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-04-12 03:18:04 -07:00
|
|
|
_on_child_hints_changed(void *data, const Efl_Event *event EINA_UNUSED)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
Eo *box = data;
|
|
|
|
efl_pack_layout_request(box);
|
|
|
|
}
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
EFL_CALLBACKS_ARRAY_DEFINE(efl_ui_box_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 }
|
|
|
|
);
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
static inline Eina_Bool
|
|
|
|
_efl_ui_box_child_register(Eo *obj, Efl_Ui_Box_Data *pd, Efl_Gfx_Entity *subobj)
|
|
|
|
{
|
|
|
|
if (!subobj || (efl_canvas_object_render_parent_get(subobj) == obj))
|
2019-04-01 05:45:19 -07:00
|
|
|
{
|
|
|
|
ERR("subobj %p %s is already added to this", subobj, efl_class_name_get(subobj) );
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2019-04-26 05:16:30 -07:00
|
|
|
if (!efl_ui_widget_internal_get(obj))
|
|
|
|
{
|
|
|
|
if (!efl_ui_widget_sub_object_add(obj, subobj))
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
efl_key_data_set(subobj, "_elm_leaveme", obj);
|
|
|
|
efl_canvas_group_member_add(obj, subobj);
|
|
|
|
efl_canvas_object_clipper_set(subobj, pd->clipper);
|
|
|
|
efl_pack_layout_request(obj);
|
|
|
|
|
|
|
|
efl_event_callback_array_add(subobj, efl_ui_box_callbacks(), obj);
|
|
|
|
efl_event_callback_call(obj, EFL_CONTAINER_EVENT_CONTENT_ADDED, subobj);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
static inline Eina_Bool
|
|
|
|
_efl_ui_box_child_unregister(Eo *obj, Efl_Ui_Box_Data *pd EINA_UNUSED, Efl_Gfx_Entity *subobj)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-04-01 05:45:19 -07:00
|
|
|
if (efl_canvas_object_render_parent_get(subobj) != obj)
|
|
|
|
{
|
|
|
|
ERR("subobj %p %s is not part of this widget", subobj, efl_class_name_get(subobj) );
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2019-04-26 05:16:30 -07:00
|
|
|
|
|
|
|
if (!subobj)
|
2019-04-12 03:18:04 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
|
2019-04-26 05:16:30 -07:00
|
|
|
if (!efl_ui_widget_internal_get(obj))
|
|
|
|
{
|
|
|
|
if (!_elm_widget_sub_object_redirect_to_top(obj, subobj))
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
efl_canvas_group_member_remove(obj, subobj);
|
|
|
|
efl_canvas_object_clipper_set(subobj, NULL);
|
|
|
|
efl_key_data_set(subobj, "_elm_leaveme", NULL);
|
|
|
|
efl_pack_layout_request(obj);
|
|
|
|
|
|
|
|
efl_event_callback_array_del(subobj, efl_ui_box_callbacks(), obj);
|
|
|
|
efl_event_callback_call(obj, EFL_CONTAINER_EVENT_CONTENT_REMOVED, subobj);
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
return EINA_TRUE;
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
Efl.Ui.Box: Implement way to override layout function
So, since we don't have function pointers, all the solutions
to reimplementing the layout function are quite convoluted:
1. use events
2. reimplement layout func
3. use an extra object
4. use a generic class (non instanciated)
Promises don't apply here (layout will run multiple times).
Problems:
1. Multiple event callbacks will be called, resulting in
potential performance impact, extra events, etc...
Also, there is no way to define standard implementations
that would be provided by the framework.
2. Reimplementation of a function requires extra EO work
(create an EO class, etc...), doesn't allow on-the-fly
change of the layout method.
3. Probably the best solution is to have an object implementing
the layout. But this means creating an extra object along
with the container.
4. To avoid the extra object, use a class, and reimplement
a @class function. This unfortunately requires extra
EO work.
Solution 4. has been selected, but it's not very nice...
2016-04-12 00:20:54 -07:00
|
|
|
static void
|
2019-04-12 03:18:04 -07:00
|
|
|
_efl_ui_box_size_hints_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev)
|
Efl.Ui.Box: Implement way to override layout function
So, since we don't have function pointers, all the solutions
to reimplementing the layout function are quite convoluted:
1. use events
2. reimplement layout func
3. use an extra object
4. use a generic class (non instanciated)
Promises don't apply here (layout will run multiple times).
Problems:
1. Multiple event callbacks will be called, resulting in
potential performance impact, extra events, etc...
Also, there is no way to define standard implementations
that would be provided by the framework.
2. Reimplementation of a function requires extra EO work
(create an EO class, etc...), doesn't allow on-the-fly
change of the layout method.
3. Probably the best solution is to have an object implementing
the layout. But this means creating an extra object along
with the container.
4. To avoid the extra object, use a class, and reimplement
a @class function. This unfortunately requires extra
EO work.
Solution 4. has been selected, but it's not very nice...
2016-04-12 00:20:54 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
efl_pack_layout_request(ev->object);
|
Efl.Ui.Box: Implement way to override layout function
So, since we don't have function pointers, all the solutions
to reimplementing the layout function are quite convoluted:
1. use events
2. reimplement layout func
3. use an extra object
4. use a generic class (non instanciated)
Promises don't apply here (layout will run multiple times).
Problems:
1. Multiple event callbacks will be called, resulting in
potential performance impact, extra events, etc...
Also, there is no way to define standard implementations
that would be provided by the framework.
2. Reimplementation of a function requires extra EO work
(create an EO class, etc...), doesn't allow on-the-fly
change of the layout method.
3. Probably the best solution is to have an object implementing
the layout. But this means creating an extra object along
with the container.
4. To avoid the extra object, use a class, and reimplement
a @class function. This unfortunately requires extra
EO work.
Solution 4. has been selected, but it's not very nice...
2016-04-12 00:20:54 -07:00
|
|
|
}
|
|
|
|
|
2019-02-13 05:39:20 -08:00
|
|
|
EOLIAN static void
|
2019-03-08 05:22:12 -08:00
|
|
|
_efl_ui_box_homogeneous_set(Eo *obj, Efl_Ui_Box_Data *pd, Eina_Bool homogeneous)
|
2019-02-13 05:39:20 -08:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
homogeneous = !!homogeneous;
|
|
|
|
|
|
|
|
if (pd->homogeneous == homogeneous)
|
2019-03-08 05:22:12 -08:00
|
|
|
return;
|
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
pd->homogeneous = homogeneous;
|
2019-03-08 05:22:12 -08:00
|
|
|
efl_pack_layout_request(obj);
|
2019-02-13 05:39:20 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_efl_ui_box_homogeneous_get(const Eo *obj EINA_UNUSED, Efl_Ui_Box_Data *pd)
|
|
|
|
{
|
|
|
|
return pd->homogeneous;
|
|
|
|
}
|
|
|
|
|
Efl.Ui.Box: Implement way to override layout function
So, since we don't have function pointers, all the solutions
to reimplementing the layout function are quite convoluted:
1. use events
2. reimplement layout func
3. use an extra object
4. use a generic class (non instanciated)
Promises don't apply here (layout will run multiple times).
Problems:
1. Multiple event callbacks will be called, resulting in
potential performance impact, extra events, etc...
Also, there is no way to define standard implementations
that would be provided by the framework.
2. Reimplementation of a function requires extra EO work
(create an EO class, etc...), doesn't allow on-the-fly
change of the layout method.
3. Probably the best solution is to have an object implementing
the layout. But this means creating an extra object along
with the container.
4. To avoid the extra object, use a class, and reimplement
a @class function. This unfortunately requires extra
EO work.
Solution 4. has been selected, but it's not very nice...
2016-04-12 00:20:54 -07:00
|
|
|
EOLIAN static void
|
2019-04-12 03:18:04 -07:00
|
|
|
_efl_ui_box_efl_pack_layout_layout_update(Eo *obj, Efl_Ui_Box_Data *pd)
|
Efl.Ui.Box: Implement way to override layout function
So, since we don't have function pointers, all the solutions
to reimplementing the layout function are quite convoluted:
1. use events
2. reimplement layout func
3. use an extra object
4. use a generic class (non instanciated)
Promises don't apply here (layout will run multiple times).
Problems:
1. Multiple event callbacks will be called, resulting in
potential performance impact, extra events, etc...
Also, there is no way to define standard implementations
that would be provided by the framework.
2. Reimplementation of a function requires extra EO work
(create an EO class, etc...), doesn't allow on-the-fly
change of the layout method.
3. Probably the best solution is to have an object implementing
the layout. But this means creating an extra object along
with the container.
4. To avoid the extra object, use a class, and reimplement
a @class function. This unfortunately requires extra
EO work.
Solution 4. has been selected, but it's not very nice...
2016-04-12 00:20:54 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
_efl_ui_box_custom_layout(obj, pd);
|
Efl.Ui.Box: Implement way to override layout function
So, since we don't have function pointers, all the solutions
to reimplementing the layout function are quite convoluted:
1. use events
2. reimplement layout func
3. use an extra object
4. use a generic class (non instanciated)
Promises don't apply here (layout will run multiple times).
Problems:
1. Multiple event callbacks will be called, resulting in
potential performance impact, extra events, etc...
Also, there is no way to define standard implementations
that would be provided by the framework.
2. Reimplementation of a function requires extra EO work
(create an EO class, etc...), doesn't allow on-the-fly
change of the layout method.
3. Probably the best solution is to have an object implementing
the layout. But this means creating an extra object along
with the container.
4. To avoid the extra object, use a class, and reimplement
a @class function. This unfortunately requires extra
EO work.
Solution 4. has been selected, but it's not very nice...
2016-04-12 00:20:54 -07:00
|
|
|
}
|
|
|
|
|
2016-04-11 22:10:05 -07:00
|
|
|
EOLIAN static void
|
2019-04-12 03:18:04 -07:00
|
|
|
_efl_ui_box_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Box_Data *_pd EINA_UNUSED)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-07-30 10:11:48 -07:00
|
|
|
efl_canvas_group_need_recalculate_set(obj, EINA_FALSE);
|
2019-04-12 03:18:04 -07:00
|
|
|
efl_pack_layout_update(obj);
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-04-12 03:18:04 -07:00
|
|
|
_efl_ui_box_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Box_Data *_pd EINA_UNUSED, Eina_Size2D sz)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), sz);
|
2019-07-17 10:12:23 -07:00
|
|
|
efl_pack_layout_request(obj);
|
2019-04-12 03:18:04 -07:00
|
|
|
}
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_box_efl_gfx_entity_position_set(Eo *obj, Efl_Ui_Box_Data *_pd EINA_UNUSED, Eina_Position2D pos)
|
|
|
|
{
|
|
|
|
efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos);
|
|
|
|
efl_canvas_group_change(obj);
|
|
|
|
}
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_box_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Box_Data *pd)
|
|
|
|
{
|
|
|
|
pd->clipper = efl_add(EFL_CANVAS_RECTANGLE_CLASS, obj);
|
|
|
|
evas_object_static_clip_set(pd->clipper, EINA_TRUE);
|
|
|
|
efl_gfx_entity_geometry_set(pd->clipper, EINA_RECT(-49999, -49999, 99999, 99999));
|
|
|
|
efl_canvas_group_member_add(obj, pd->clipper);
|
|
|
|
efl_ui_widget_sub_object_add(obj, pd->clipper);
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
efl_ui_widget_focus_allow_set(obj, EINA_FALSE);
|
2016-04-11 22:10:05 -07:00
|
|
|
elm_widget_highlight_ignore_set(obj, EINA_TRUE);
|
2019-04-12 03:18:04 -07:00
|
|
|
|
|
|
|
efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_HINTS_CHANGED,
|
|
|
|
_efl_ui_box_size_hints_changed_cb, NULL);
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-04-12 03:18:04 -07:00
|
|
|
_efl_ui_box_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Box_Data *_pd EINA_UNUSED)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
efl_event_callback_del(obj, EFL_GFX_ENTITY_EVENT_HINTS_CHANGED,
|
|
|
|
_efl_ui_box_size_hints_changed_cb, NULL);
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_efl_ui_box_efl_object_constructor(Eo *obj, Efl_Ui_Box_Data *pd)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME);
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_access_type_set(obj, EFL_ACCESS_TYPE_SKIPPED);
|
|
|
|
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_FILLER);
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2019-05-24 09:30:31 -07:00
|
|
|
pd->dir = EFL_UI_LAYOUT_ORIENTATION_VERTICAL;
|
2016-04-15 01:06:14 -07:00
|
|
|
pd->align.h = 0.5;
|
|
|
|
pd->align.v = 0.5;
|
2019-07-17 10:12:23 -07:00
|
|
|
pd->full_recalc = EINA_TRUE;
|
2016-04-11 22:10:05 -07:00
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2019-04-26 01:57:24 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_box_efl_object_invalidate(Eo *obj, Efl_Ui_Box_Data *pd)
|
|
|
|
{
|
|
|
|
Eo *child;
|
|
|
|
|
|
|
|
efl_invalidate(efl_super(obj, MY_CLASS));
|
|
|
|
|
|
|
|
EINA_LIST_FREE(pd->children, child)
|
|
|
|
{
|
|
|
|
efl_event_callback_array_del(child, efl_ui_box_callbacks(), obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-11 22:10:05 -07:00
|
|
|
/* CLEAN API BELOW */
|
|
|
|
|
|
|
|
EOLIAN static int
|
2019-04-12 03:18:04 -07:00
|
|
|
_efl_ui_box_efl_container_content_count(Eo *obj EINA_UNUSED, Efl_Ui_Box_Data *pd)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
return eina_list_count(pd->children);
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
2016-04-25 23:21:21 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2016-04-19 01:43:28 -07:00
|
|
|
_efl_ui_box_efl_pack_pack_clear(Eo *obj, Efl_Ui_Box_Data *pd)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
Eo *child;
|
|
|
|
EINA_LIST_FREE(pd->children, child)
|
|
|
|
{
|
|
|
|
efl_event_callback_array_del(child, efl_ui_box_callbacks(), obj);
|
|
|
|
efl_del(child);
|
|
|
|
}
|
2016-04-25 23:21:21 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
efl_pack_layout_request(obj);
|
2016-04-25 23:21:21 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
return EINA_TRUE;
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
2016-04-25 23:21:21 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2016-04-11 22:10:05 -07:00
|
|
|
_efl_ui_box_efl_pack_unpack_all(Eo *obj, Efl_Ui_Box_Data *pd)
|
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
Eo *child;
|
|
|
|
Eina_Bool ret = EINA_TRUE;
|
2016-04-25 23:21:21 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
EINA_LIST_FREE(pd->children, child)
|
|
|
|
ret &= _efl_ui_box_child_unregister(obj, pd, child);
|
2016-04-25 23:21:21 -07:00
|
|
|
|
|
|
|
return ret;
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-04-05 01:47:26 -07:00
|
|
|
_efl_ui_box_efl_pack_unpack(Eo *obj, Efl_Ui_Box_Data *pd, Efl_Gfx_Entity *subobj)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
if (!_efl_ui_box_child_unregister(obj, pd, subobj))
|
|
|
|
return EINA_FALSE;
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
pd->children = eina_list_remove(pd->children, subobj);
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
return EINA_TRUE;
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
2016-04-25 23:21:21 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-05 01:47:26 -07:00
|
|
|
_efl_ui_box_efl_pack_pack(Eo *obj, Efl_Ui_Box_Data *pd EINA_UNUSED, Efl_Gfx_Entity *subobj)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2016-04-25 23:21:21 -07:00
|
|
|
return efl_pack_end(obj, subobj);
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
2016-04-25 23:21:21 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2019-04-12 03:18:04 -07:00
|
|
|
_efl_ui_box_efl_pack_linear_pack_end(Eo *obj, Efl_Ui_Box_Data *pd, Efl_Gfx_Entity *subobj)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
if (!_efl_ui_box_child_register(obj, pd, subobj))
|
|
|
|
return EINA_FALSE;
|
2016-04-25 23:21:21 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
pd->children = eina_list_append(pd->children, subobj);
|
2016-04-25 23:21:21 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
return EINA_TRUE;
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
2016-04-25 23:21:21 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2019-04-12 03:18:04 -07:00
|
|
|
_efl_ui_box_efl_pack_linear_pack_begin(Eo *obj, Efl_Ui_Box_Data *pd, Efl_Gfx_Entity *subobj)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
if (!_efl_ui_box_child_register(obj, pd, subobj))
|
|
|
|
return EINA_FALSE;
|
2016-04-25 23:21:21 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
pd->children = eina_list_prepend(pd->children, subobj);
|
2016-04-25 23:21:21 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
return EINA_TRUE;
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-04-12 03:18:04 -07:00
|
|
|
_efl_ui_box_efl_pack_linear_pack_before(Eo *obj, Efl_Ui_Box_Data *pd, Efl_Gfx_Entity *subobj, const Efl_Gfx_Entity *existing)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-09-06 09:43:32 -07:00
|
|
|
if (existing) EINA_SAFETY_ON_FALSE_RETURN_VAL(eina_list_data_find(pd->children, existing), EINA_FALSE);
|
2019-09-06 04:55:28 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
if (!_efl_ui_box_child_register(obj, pd, subobj))
|
2016-04-11 22:10:05 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
pd->children = eina_list_prepend_relative(pd->children, subobj, existing);
|
2016-04-11 22:10:05 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2019-04-12 03:18:04 -07:00
|
|
|
_efl_ui_box_efl_pack_linear_pack_after(Eo *obj, Efl_Ui_Box_Data *pd, Efl_Gfx_Entity *subobj, const Efl_Gfx_Entity *existing)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-09-06 09:43:32 -07:00
|
|
|
if (existing) EINA_SAFETY_ON_FALSE_RETURN_VAL(eina_list_data_find(pd->children, existing), EINA_FALSE);
|
2019-09-06 04:55:28 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
if (!_efl_ui_box_child_register(obj, pd, subobj))
|
2016-04-11 22:10:05 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
pd->children = eina_list_append_relative(pd->children, subobj, existing);
|
2016-04-11 22:10:05 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2016-04-25 23:21:21 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2019-04-12 03:18:04 -07:00
|
|
|
_efl_ui_box_efl_pack_linear_pack_at(Eo *obj, Efl_Ui_Box_Data *pd, Efl_Gfx_Entity *subobj, int index)
|
2016-04-19 01:43:28 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
int count = eina_list_count(pd->children);
|
|
|
|
|
|
|
|
if (index < -count)
|
2016-04-25 23:21:21 -07:00
|
|
|
return efl_pack_begin(obj, subobj);
|
2019-04-12 03:18:04 -07:00
|
|
|
|
|
|
|
if (index >= count)
|
2016-04-25 23:21:21 -07:00
|
|
|
return efl_pack_end(obj, subobj);
|
2016-04-19 01:43:28 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
if (index < 0)
|
|
|
|
index += count;
|
|
|
|
|
|
|
|
if (!_efl_ui_box_child_register(obj, pd, subobj))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
pd->children = eina_list_prepend_relative_list(pd->children, subobj,
|
|
|
|
eina_list_nth_list(pd->children, index));
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
EOLIAN static Efl_Gfx_Entity *
|
2019-04-12 03:18:04 -07:00
|
|
|
_efl_ui_box_efl_pack_linear_pack_content_get(Eo *obj EINA_UNUSED, Efl_Ui_Box_Data *pd, int index)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
int count = eina_list_count(pd->children);
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
if (index <= -count)
|
|
|
|
return eina_list_data_get(pd->children);
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
if (index >= count)
|
|
|
|
return eina_list_last_data_get(pd->children);
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
if (index < 0)
|
|
|
|
index += count;
|
2016-04-11 22:10:05 -07:00
|
|
|
|
2019-04-12 03:18:04 -07:00
|
|
|
return eina_list_nth(pd->children, index);
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
EOLIAN static Efl_Gfx_Entity *
|
2019-04-12 03:18:04 -07:00
|
|
|
_efl_ui_box_efl_pack_linear_pack_unpack_at(Eo *obj, Efl_Ui_Box_Data *pd EINA_UNUSED, int index)
|
2016-04-21 19:17:03 -07:00
|
|
|
{
|
2018-04-05 01:47:26 -07:00
|
|
|
Efl_Gfx_Entity *content;
|
2016-04-21 19:17:03 -07:00
|
|
|
|
2016-04-25 23:21:21 -07:00
|
|
|
content = efl_pack_content_get(obj, index);
|
2016-04-21 19:17:03 -07:00
|
|
|
if (!content) return NULL;
|
|
|
|
|
|
|
|
if (!efl_pack_unpack(obj, content))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
|
2016-04-19 01:43:28 -07:00
|
|
|
EOLIAN static int
|
2019-04-12 03:18:04 -07:00
|
|
|
_efl_ui_box_efl_pack_linear_pack_index_get(Eo *obj EINA_UNUSED, Efl_Ui_Box_Data *pd, const Efl_Gfx_Entity *subobj)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
return eina_list_data_idx(pd->children, (Efl_Gfx_Entity *)subobj);
|
2016-04-19 01:43:28 -07:00
|
|
|
}
|
|
|
|
|
2016-04-11 22:10:05 -07:00
|
|
|
EOLIAN static void
|
2019-07-17 10:12:23 -07:00
|
|
|
_efl_ui_box_efl_pack_layout_layout_request(Eo *obj, Efl_Ui_Box_Data *pd)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-07-17 10:12:23 -07:00
|
|
|
pd->full_recalc = EINA_TRUE;
|
2019-04-12 03:18:04 -07:00
|
|
|
efl_canvas_group_need_recalculate_set(obj, EINA_TRUE);
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Iterator *
|
2019-04-12 03:18:04 -07:00
|
|
|
_efl_ui_box_efl_container_content_iterate(Eo *obj EINA_UNUSED, Efl_Ui_Box_Data *pd)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
return eina_list_iterator_new(pd->children);
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-05-24 09:30:31 -07:00
|
|
|
_efl_ui_box_efl_ui_layout_orientable_orientation_set(Eo *obj, Efl_Ui_Box_Data *pd, Efl_Ui_Layout_Orientation dir)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
if (pd->dir == dir) return;
|
|
|
|
|
2016-04-11 22:10:05 -07:00
|
|
|
switch (dir)
|
|
|
|
{
|
2019-05-24 09:30:31 -07:00
|
|
|
case EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL:
|
|
|
|
pd->dir = EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL;
|
2016-04-11 22:10:05 -07:00
|
|
|
break;
|
|
|
|
|
2019-05-24 09:30:31 -07:00
|
|
|
case EFL_UI_LAYOUT_ORIENTATION_VERTICAL:
|
|
|
|
case EFL_UI_LAYOUT_ORIENTATION_DEFAULT:
|
2016-04-11 22:10:05 -07:00
|
|
|
default:
|
2019-05-24 09:30:31 -07:00
|
|
|
pd->dir = EFL_UI_LAYOUT_ORIENTATION_VERTICAL;
|
2016-04-11 22:10:05 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
efl_pack_layout_request(obj);
|
|
|
|
}
|
|
|
|
|
2019-05-24 09:30:31 -07:00
|
|
|
EOLIAN static Efl_Ui_Layout_Orientation
|
|
|
|
_efl_ui_box_efl_ui_layout_orientable_orientation_get(const Eo *obj EINA_UNUSED, Efl_Ui_Box_Data *pd)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2017-08-09 06:36:29 -07:00
|
|
|
return pd->dir;
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-04-24 06:41:39 -07:00
|
|
|
_efl_ui_box_efl_gfx_arrangement_content_padding_set(Eo *obj, Efl_Ui_Box_Data *pd, double h, double v, Eina_Bool scalable)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
2019-04-12 03:18:04 -07:00
|
|
|
scalable = !!scalable;
|
2016-04-11 22:10:05 -07:00
|
|
|
if (h < 0) h = 0;
|
|
|
|
if (v < 0) v = 0;
|
2019-04-12 03:18:04 -07:00
|
|
|
|
|
|
|
if (EINA_DBL_EQ(pd->pad.h, h) && EINA_DBL_EQ(pd->pad.v, v) &&
|
|
|
|
(pd->pad.scalable == scalable))
|
|
|
|
return;
|
|
|
|
|
2016-04-11 22:10:05 -07:00
|
|
|
pd->pad.h = h;
|
|
|
|
pd->pad.v = v;
|
2019-04-12 03:18:04 -07:00
|
|
|
pd->pad.scalable = scalable;
|
|
|
|
|
|
|
|
efl_pack_layout_request(obj);
|
2016-04-11 22:10:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-04-24 06:41:39 -07:00
|
|
|
_efl_ui_box_efl_gfx_arrangement_content_padding_get(const Eo *obj EINA_UNUSED, Efl_Ui_Box_Data *pd, double *h, double *v, Eina_Bool *scalable)
|
2016-04-11 22:10:05 -07:00
|
|
|
{
|
|
|
|
if (scalable) *scalable = pd->pad.scalable;
|
|
|
|
if (h) *h = pd->pad.h;
|
|
|
|
if (v) *v = pd->pad.v;
|
|
|
|
}
|
|
|
|
|
2016-04-15 01:06:14 -07:00
|
|
|
EOLIAN static void
|
2019-04-24 06:41:39 -07:00
|
|
|
_efl_ui_box_efl_gfx_arrangement_content_align_set(Eo *obj, Efl_Ui_Box_Data *pd, double h, double v)
|
2016-04-15 01:06:14 -07:00
|
|
|
{
|
|
|
|
if (h < 0) h = -1;
|
2019-04-12 03:18:04 -07:00
|
|
|
else if (h > 1) h = 1;
|
2016-04-15 01:06:14 -07:00
|
|
|
if (v < 0) v = -1;
|
2019-04-12 03:18:04 -07:00
|
|
|
else if (v > 1) v = 1;
|
|
|
|
|
|
|
|
if (EINA_DBL_EQ(pd->align.h, h) && EINA_DBL_EQ(pd->align.v, v))
|
|
|
|
return;
|
|
|
|
|
2016-04-15 01:06:14 -07:00
|
|
|
pd->align.h = h;
|
|
|
|
pd->align.v = v;
|
|
|
|
|
|
|
|
efl_pack_layout_request(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-04-24 06:41:39 -07:00
|
|
|
_efl_ui_box_efl_gfx_arrangement_content_align_get(const Eo *obj EINA_UNUSED, Efl_Ui_Box_Data *pd, double *h, double *v)
|
2016-04-15 01:06:14 -07:00
|
|
|
{
|
|
|
|
if (h) *h = pd->align.h;
|
|
|
|
if (v) *v = pd->align.v;
|
|
|
|
}
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
|
|
|
#define EFL_UI_BOX_EXTRA_OPS \
|
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_box)
|
|
|
|
|
2016-04-11 22:10:05 -07:00
|
|
|
#include "efl_ui_box.eo.c"
|