Eolian: Integration of Box

This commit is contained in:
Daniel Zaoui 2014-03-20 07:58:37 +02:00
parent 5bbf7d9af5
commit a9fe9693c0
5 changed files with 412 additions and 355 deletions

View File

@ -557,7 +557,9 @@ BUILT_SOURCES = \
elm_atspi_object.eo.c \
elm_atspi_object.eo.h \
elm_bg.eo.c \
elm_bg.eo.h
elm_bg.eo.h \
elm_box.eo.c \
elm_box.eo.h
EXTRA_DIST += \
elm_widget.eo \
@ -576,7 +578,8 @@ EXTRA_DIST += \
elm_interface_atspi_component.eo \
elm_interface_atspi_window.eo \
elm_atspi_object.eo \
elm_bg.eo
elm_bg.eo \
elm_box.eo
nodist_includesunstable_HEADERS = \
elm_widget.eo.h \
@ -595,5 +598,6 @@ nodist_includesunstable_HEADERS = \
elm_interface_atspi_component.eo.h \
elm_interface_atspi_window.eo.h \
elm_atspi_object.eo.h \
elm_box.eo.h \
elm_bg.eo.h

View File

@ -7,8 +7,6 @@
#include "els_box.h"
#include "elm_widget_box.h"
EAPI Eo_Op ELM_OBJ_BOX_BASE_ID = EO_NOOP;
#define MY_CLASS ELM_OBJ_BOX_CLASS
#define MY_CLASS_NAME "Elm_Box"
#define MY_CLASS_NAME_LEGACY "elm_box"
@ -48,63 +46,46 @@ _child_removed_cb_proxy(void *data,
evas_object_smart_callback_call(box, SIG_CHILD_REMOVED, child);
}
static void
_elm_box_smart_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
EOLIAN static Eina_Bool
_elm_box_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Box_Data *_pd EINA_UNUSED)
{
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
*ret = EINA_TRUE;
return EINA_TRUE;
}
static void
_elm_box_smart_focus_next(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
EOLIAN static Eina_Bool
_elm_box_elm_widget_focus_next(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED, Elm_Focus_Direction dir, Evas_Object **next)
{
const Eina_List *items;
void *(*list_data_get)(const Eina_List *list);
Elm_Focus_Direction dir = va_arg(*list, Elm_Focus_Direction);
Evas_Object **next = va_arg(*list, Evas_Object **);
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
Eina_Bool int_ret;
if (ret) *ret = EINA_FALSE;
/* Focus chain */
/* TODO: Change this to use other chain */
if ((items = elm_widget_focus_custom_chain_get(obj)))
list_data_get = eina_list_data_get;
else
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
Evas_Object_Box_Data *bd =
evas_object_smart_data_get(wd->resize_obj);
items = bd->children;
list_data_get = _elm_box_list_data_get;
if (!items) return;
if (!items) return EINA_FALSE;
}
int_ret = elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
if (ret) *ret = int_ret;
return elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
}
static void
_elm_box_smart_focus_direction_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
EOLIAN static Eina_Bool
_elm_box_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Box_Data *_pd EINA_UNUSED)
{
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
*ret = EINA_TRUE;
return EINA_TRUE;
}
static void
_elm_box_smart_focus_direction(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
EOLIAN static Eina_Bool
_elm_box_elm_widget_focus_direction(Eo *obj EINA_UNUSED, Elm_Box_Data *_pd EINA_UNUSED, const Evas_Object *base, double degree, Evas_Object **direction, double *weight)
{
Evas_Object *base = va_arg(*list, Evas_Object *);
double degree = va_arg(*list, double);
Evas_Object **direction = va_arg(*list, Evas_Object **);
double *weight = va_arg(*list, double *);
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
if (ret) *ret = EINA_FALSE;
Eina_Bool int_ret;
const Eina_List *items;
void *(*list_data_get)(const Eina_List *list);
@ -112,34 +93,31 @@ _elm_box_smart_focus_direction(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_li
list_data_get = eina_list_data_get;
else
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
Evas_Object_Box_Data *bd =
evas_object_smart_data_get(wd->resize_obj);
items = bd->children;
list_data_get = _elm_box_list_data_get;
if (!items) return;
if (!items) return EINA_FALSE;
}
int_ret = elm_widget_focus_list_direction_get
return elm_widget_focus_list_direction_get
(obj, base, items, list_data_get, degree, direction, weight);
if (ret) *ret = int_ret;
}
static void
_elm_box_smart_theme(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
EOLIAN static Eina_Bool
_elm_box_elm_widget_theme_apply(Eo *obj, Elm_Box_Data *sd EINA_UNUSED)
{
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
if (ret) *ret = EINA_FALSE;
Eina_Bool int_ret = EINA_FALSE;
eo_do_super(obj, MY_CLASS, elm_obj_widget_theme_apply(&int_ret));
if (!int_ret) return;
if (!int_ret) return EINA_FALSE;
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
evas_object_smart_calculate(wd->resize_obj);
if (ret) *ret = EINA_TRUE;
return EINA_TRUE;
}
static void
@ -180,20 +158,17 @@ _on_size_hints_changed(void *data,
_sizing_eval(data);
}
static void
_elm_box_smart_sub_object_del(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
EOLIAN static Eina_Bool
_elm_box_elm_widget_sub_object_del(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED, Evas_Object *child)
{
Evas_Object *child = va_arg(*list, Evas_Object *);
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
if (ret) *ret = EINA_FALSE;
Eina_Bool int_ret = EINA_FALSE;
eo_do_super(obj, MY_CLASS, elm_obj_widget_sub_object_del(child, &int_ret));
if (!int_ret) return;
if (!int_ret) return EINA_FALSE;
_sizing_eval(obj);
if (ret) *ret = EINA_TRUE;
return EINA_TRUE;
}
static void
@ -392,8 +367,8 @@ _transition_layout_animation_exec(Evas_Object *obj,
}
}
static void
_elm_box_smart_add(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
EOLIAN static void
_elm_box_evas_smart_add(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED)
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
elm_widget_resize_object_set(obj,
@ -419,13 +394,12 @@ _elm_box_smart_add(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
elm_widget_highlight_ignore_set(obj, EINA_TRUE);
}
static void
_elm_box_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
EOLIAN static void
_elm_box_evas_smart_del(Eo *obj, Elm_Box_Data *sd)
{
Eina_List *l;
Evas_Object *child;
Elm_Box_Smart_Data *sd = _pd;
sd->delete_me = EINA_TRUE;
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
@ -457,8 +431,8 @@ elm_box_add(Evas_Object *parent)
return obj;
}
static void
_constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
EOLIAN static void
_elm_box_eo_base_constructor(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED)
{
eo_do_super(obj, MY_CLASS, eo_constructor());
eo_do(obj,
@ -466,129 +440,57 @@ _constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
evas_obj_smart_callbacks_descriptions_set(_smart_callbacks, NULL));
}
EAPI void
elm_box_horizontal_set(Evas_Object *obj,
Eina_Bool horizontal)
EOLIAN static void
_elm_box_horizontal_set(Eo *obj, Elm_Box_Data *sd, Eina_Bool horizontal)
{
ELM_BOX_CHECK(obj);
eo_do(obj, elm_obj_box_horizontal_set(horizontal));
}
static void
_horizontal_set(Eo *obj, void *_pd, va_list *list)
{
Eina_Bool horizontal = va_arg(*list, int);
Elm_Box_Smart_Data *sd = _pd;
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
sd->horizontal = !!horizontal;
evas_object_smart_calculate(wd->resize_obj);
}
EAPI Eina_Bool
elm_box_horizontal_get(const Evas_Object *obj)
EOLIAN static Eina_Bool
_elm_box_horizontal_get(Eo *obj EINA_UNUSED, Elm_Box_Data *sd)
{
ELM_BOX_CHECK(obj) EINA_FALSE;
Eina_Bool ret;
eo_do((Eo *) obj, elm_obj_box_horizontal_get(&ret));
return ret;
return sd->horizontal;
}
static void
_horizontal_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
EOLIAN static void
_elm_box_homogeneous_set(Eo *obj, Elm_Box_Data *sd, Eina_Bool homogeneous)
{
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
const Elm_Box_Smart_Data *sd = _pd;
*ret = sd->horizontal;
}
EAPI void
elm_box_homogeneous_set(Evas_Object *obj,
Eina_Bool homogeneous)
{
ELM_BOX_CHECK(obj);
eo_do(obj, elm_obj_box_homogeneous_set(homogeneous));
}
static void
_homogeneous_set(Eo *obj, void *_pd, va_list *list)
{
Eina_Bool homogeneous = va_arg(*list, int);
Elm_Box_Smart_Data *sd = _pd;
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
sd->homogeneous = !!homogeneous;
evas_object_smart_calculate(wd->resize_obj);
}
EAPI Eina_Bool
elm_box_homogeneous_get(const Evas_Object *obj)
EOLIAN static Eina_Bool
_elm_box_homogeneous_get(Eo *obj EINA_UNUSED, Elm_Box_Data *sd)
{
ELM_BOX_CHECK(obj) EINA_FALSE;
Eina_Bool ret;
eo_do((Eo *) obj, elm_obj_box_homogeneous_get(&ret));
return ret;
return sd->homogeneous;
}
static void
_homogeneous_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
EOLIAN static void
_elm_box_pack_start(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED, Evas_Object *subobj)
{
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
const Elm_Box_Smart_Data *sd = _pd;
*ret = sd->homogeneous;
}
EAPI void
elm_box_pack_start(Evas_Object *obj,
Evas_Object *subobj)
{
ELM_BOX_CHECK(obj);
eo_do(obj, elm_obj_box_pack_start(subobj));
}
static void
_pack_start(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
{
Evas_Object *subobj = va_arg(*list, Evas_Object *);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
elm_widget_sub_object_add(obj, subobj);
evas_object_box_prepend(wd->resize_obj, subobj);
}
EAPI void
elm_box_pack_end(Evas_Object *obj,
Evas_Object *subobj)
EOLIAN static void
_elm_box_pack_end(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED, Evas_Object *subobj)
{
ELM_BOX_CHECK(obj);
eo_do(obj, elm_obj_box_pack_end(subobj));
}
static void
_pack_end(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
{
Evas_Object *subobj = va_arg(*list, Evas_Object *);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
elm_widget_sub_object_add(obj, subobj);
evas_object_box_append(wd->resize_obj, subobj);
}
EAPI void
elm_box_pack_before(Evas_Object *obj,
Evas_Object *subobj,
Evas_Object *before)
EOLIAN static void
_elm_box_pack_before(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED, Evas_Object *subobj, Evas_Object *before)
{
ELM_BOX_CHECK(obj);
eo_do(obj, elm_obj_box_pack_before(subobj, before));
}
static void
_pack_before(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
{
Evas_Object *subobj = va_arg(*list, Evas_Object *);
Evas_Object *before = va_arg(*list, Evas_Object *);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
elm_widget_sub_object_add(obj, subobj);
@ -597,20 +499,9 @@ _pack_before(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
(wd->resize_obj, subobj, before);
}
EAPI void
elm_box_pack_after(Evas_Object *obj,
Evas_Object *subobj,
Evas_Object *after)
EOLIAN static void
_elm_box_pack_after(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED, Evas_Object *subobj, Evas_Object *after)
{
ELM_BOX_CHECK(obj);
eo_do(obj, elm_obj_box_pack_after(subobj, after));
}
static void
_pack_after(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
{
Evas_Object *subobj = va_arg(*list, Evas_Object *);
Evas_Object *after = va_arg(*list, Evas_Object *);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
elm_widget_sub_object_add(obj, subobj);
@ -618,49 +509,25 @@ _pack_after(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
(wd->resize_obj, subobj, after);
}
EAPI void
elm_box_clear(Evas_Object *obj)
{
ELM_BOX_CHECK(obj);
eo_do(obj, elm_obj_box_clear());
}
static void
_clear(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
EOLIAN static void
_elm_box_clear(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED)
{
/* EINA_TRUE means to delete objects as well */
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
evas_object_box_remove_all(wd->resize_obj, EINA_TRUE);
}
EAPI void
elm_box_unpack(Evas_Object *obj,
Evas_Object *subobj)
EOLIAN static void
_elm_box_unpack(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED, Evas_Object *subobj)
{
ELM_BOX_CHECK(obj);
eo_do(obj, elm_obj_box_unpack(subobj));
}
static void
_unpack(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
{
Evas_Object *subobj = va_arg(*list, Evas_Object *);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
if (evas_object_box_remove(wd->resize_obj, subobj))
elm_widget_sub_object_del(obj, subobj);
}
EAPI void
elm_box_unpack_all(Evas_Object *obj)
{
ELM_BOX_CHECK(obj);
eo_do(obj, elm_obj_box_unpack_all());
}
static void
_unpack_all(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
EOLIAN static void
_elm_box_unpack_all(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED)
{
Evas_Object_Box_Data *bd;
Evas_Object_Box_Option *opt;
@ -676,22 +543,9 @@ _unpack_all(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
evas_object_box_remove_all(wd->resize_obj, EINA_FALSE);
}
EAPI void
elm_box_layout_set(Evas_Object *obj,
Evas_Object_Box_Layout cb,
const void *data,
Ecore_Cb free_data)
EOLIAN static void
_elm_box_layout_set(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED, Evas_Object_Box_Layout cb, const void *data, Ecore_Cb free_data)
{
ELM_BOX_CHECK(obj);
eo_do(obj, elm_obj_box_layout_set(cb, data, free_data));
}
static void
_layout_set(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
{
Evas_Object_Box_Layout cb = va_arg(*list, Evas_Object_Box_Layout);
const void *data = va_arg(*list, const void *);
Ecore_Cb free_data = va_arg(*list, Ecore_Cb);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
if (cb)
evas_object_box_layout_set
@ -793,114 +647,51 @@ elm_box_transition_free(void *data)
free(data);
}
EAPI Eina_List *
elm_box_children_get(const Evas_Object *obj)
EOLIAN static Eina_List*
_elm_box_children_get(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED)
{
ELM_BOX_CHECK(obj) NULL;
Eina_List *ret = NULL;
eo_do((Eo *) obj, elm_obj_box_children_get(&ret));
return ret;
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
return evas_object_box_children_get(wd->resize_obj);
}
static void
_children_get(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
EOLIAN static void
_elm_box_padding_set(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED, Evas_Coord horizontal, Evas_Coord vertical)
{
Eina_List **ret = va_arg(*list, Eina_List **);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
*ret = evas_object_box_children_get(wd->resize_obj);
}
EAPI void
elm_box_padding_set(Evas_Object *obj,
Evas_Coord horizontal,
Evas_Coord vertical)
{
ELM_BOX_CHECK(obj);
eo_do(obj, elm_obj_box_padding_set(horizontal, vertical));
}
static void
_padding_set(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
{
Evas_Coord horizontal = va_arg(*list, Evas_Coord);
Evas_Coord vertical = va_arg(*list, Evas_Coord);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
evas_object_box_padding_set
(wd->resize_obj, horizontal, vertical);
}
EAPI void
elm_box_padding_get(const Evas_Object *obj,
Evas_Coord *horizontal,
Evas_Coord *vertical)
EOLIAN static void
_elm_box_padding_get(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED, Evas_Coord *horizontal, Evas_Coord *vertical)
{
ELM_BOX_CHECK(obj);
eo_do((Eo *) obj, elm_obj_box_padding_get(horizontal, vertical));
}
static void
_padding_get(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
{
Evas_Coord *horizontal = va_arg(*list, Evas_Coord *);
Evas_Coord *vertical = va_arg(*list, Evas_Coord *);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
evas_object_box_padding_get
(wd->resize_obj, horizontal, vertical);
}
EAPI void
elm_box_align_set(Evas_Object *obj,
double horizontal,
double vertical)
EOLIAN static void
_elm_box_align_set(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED, double horizontal, double vertical)
{
ELM_BOX_CHECK(obj);
eo_do(obj, elm_obj_box_align_set(horizontal, vertical));
}
static void
_align_set(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
{
double horizontal = va_arg(*list, double);
double vertical = va_arg(*list, double);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
evas_object_size_hint_align_set
(wd->resize_obj, horizontal, vertical);
}
EAPI void
elm_box_align_get(const Evas_Object *obj,
double *horizontal,
double *vertical)
EOLIAN static void
_elm_box_align_get(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED, double *horizontal, double *vertical)
{
ELM_BOX_CHECK(obj);
eo_do((Eo *) obj, elm_obj_box_align_get(horizontal, vertical));
}
static void
_align_get(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
{
double *horizontal = va_arg(*list, double *);
double *vertical = va_arg(*list, double *);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
evas_object_size_hint_align_get
(wd->resize_obj, horizontal, vertical);
}
EAPI void
elm_box_recalculate(Evas_Object *obj)
EOLIAN static void
_elm_box_recalculate(Eo *obj, Elm_Box_Data *sd)
{
ELM_BOX_CHECK(obj);
eo_do(obj, elm_obj_box_recalculate());
}
static void
_recalculate(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
{
Elm_Box_Smart_Data *sd = _pd;
if (sd->recalc) return;
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
@ -912,77 +703,9 @@ _recalculate(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
}
static void
_class_constructor(Eo_Class *klass)
_elm_box_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _elm_box_smart_add),
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DEL), _elm_box_smart_del),
EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_SUB_OBJECT_DEL), _elm_box_smart_sub_object_del),
EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_THEME_APPLY), _elm_box_smart_theme),
EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_NEXT_MANAGER_IS), _elm_box_smart_focus_next_manager_is),
EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_NEXT), _elm_box_smart_focus_next),
EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS), _elm_box_smart_focus_direction_manager_is),
EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_DIRECTION), _elm_box_smart_focus_direction),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_HORIZONTAL_SET), _horizontal_set),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_HORIZONTAL_GET), _horizontal_get),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_HOMOGENEOUS_SET), _homogeneous_set),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_HOMOGENEOUS_GET), _homogeneous_get),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_PACK_START), _pack_start),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_PACK_END), _pack_end),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_PACK_BEFORE), _pack_before),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_PACK_AFTER), _pack_after),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_CLEAR), _clear),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_UNPACK), _unpack),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_UNPACK_ALL), _unpack_all),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_LAYOUT_SET), _layout_set),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_CHILDREN_GET), _children_get),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_PADDING_SET), _padding_set),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_PADDING_GET), _padding_get),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_ALIGN_SET), _align_set),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_ALIGN_GET), _align_get),
EO_OP_FUNC(ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_RECALCULATE), _recalculate),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
}
static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_HORIZONTAL_SET, "Set the horizontal orientation."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_HORIZONTAL_GET, "Get the horizontal orientation."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_HOMOGENEOUS_SET, "Set the box to arrange its children homogeneously."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_HOMOGENEOUS_GET, "Get whether the box is using homogeneous mode or not."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_PACK_START, "Add an object to the beginning of the pack list."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_PACK_END, "Add an object at the end of the pack list."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_PACK_BEFORE, "Adds an object to the box before the indicated object."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_PACK_AFTER, "Adds an object to the box after the indicated object."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_CLEAR, "Clear the box of all children."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_UNPACK, "Unpack a box item."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_UNPACK_ALL, "Remove all items from the box, without deleting them."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_LAYOUT_SET, "Set the layout defining function to be used by the box."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_CHILDREN_GET, "Retrieve a list of the objects packed into the box."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_PADDING_SET, "Set the space (padding) between the box's elements."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_PADDING_GET, "Get the space (padding) between the box's elements."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_ALIGN_SET, "Set the alignment of the whole bounding box of contents."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_ALIGN_GET, "Get the alignment of the whole bounding box of contents."),
EO_OP_DESCRIPTION(ELM_OBJ_BOX_SUB_ID_RECALCULATE, "Force the box to recalculate its children packing."),
EO_OP_DESCRIPTION_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
MY_CLASS_NAME,
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(&ELM_OBJ_BOX_BASE_ID, op_desc, ELM_OBJ_BOX_SUB_ID_LAST),
NULL,
sizeof(Elm_Box_Smart_Data),
_class_constructor,
NULL
};
EO_DEFINE_CLASS(elm_obj_box_class_get, &class_desc, ELM_OBJ_WIDGET_CLASS, NULL);
#include "elm_box.eo.c"

View File

@ -0,0 +1,325 @@
class Elm_Box (Elm_Widget)
{
eo_prefix: elm_obj_box;
properties {
homogeneous {
set {
/*@
Set the box to arrange its children homogeneously
If enabled, homogeneous layout makes all items the same size, according
to the size of the largest of its children.
@note This flag is ignored if a custom layout function is set.
@ingroup Box */
}
get {
/*@
Get whether the box is using homogeneous mode or not
@return @c EINA_TRUE if it's homogeneous, @c EINA_FALSE otherwise
@ingroup Box */
}
values {
Eina_Bool homogeneous; /*@ The homogeneous flag */
}
}
align {
set {
/*@
Set the alignment of the whole bounding box of contents.
Sets how the bounding box containing all the elements of the box, after
their sizes and position has been calculated, will be aligned within
the space given for the whole box widget.
@ingroup Box */
}
get {
/*@
Get the alignment of the whole bounding box of contents.
@see elm_box_align_set()
@ingroup Box */
}
values {
double horizontal; /*@ The horizontal alignment of elements */
double vertical; /*@ The vertical alignment of elements */
}
}
horizontal {
set {
/*@
Set the horizontal orientation
By default, box object arranges their contents vertically from top to
bottom.
By calling this function with @p horizontal as @c EINA_TRUE, the box will
become horizontal, arranging contents from left to right.
@note This flag is ignored if a custom layout function is set.
@ingroup Box */
}
get {
/*@
Get the horizontal orientation
@return @c EINA_TRUE if the box is set to horizontal mode, @c EINA_FALSE otherwise */
}
values {
Eina_Bool horizontal; /*@ The horizontal flag (@c EINA_TRUE = horizontal,
@c EINA_FALSE = vertical) */
}
}
padding {
set {
/*@
Set the space (padding) between the box's elements.
Extra space in pixels that will be added between a box child and its
neighbors after its containing cell has been calculated. This padding
is set for all elements in the box, besides any possible padding that
individual elements may have through their size hints.
@ingroup Box */
}
get {
/*@
Get the space (padding) between the box's elements.
@see elm_box_padding_set()
@ingroup Box */
}
values {
Evas_Coord horizontal; /*@ The horizontal space between elements */
Evas_Coord vertical; /*@ The vertical space between elements */
}
}
layout {
set {
/*@
Set the layout defining function to be used by the box
Whenever anything changes that requires the box in @p obj to recalculate
the size and position of its elements, the function @p cb will be called
to determine what the layout of the children will be.
Once a custom function is set, everything about the children layout
is defined by it. The flags set by elm_box_horizontal_set() and
elm_box_homogeneous_set() no longer have any meaning, and the values
given by elm_box_padding_set() and elm_box_align_set() are up to this
layout function to decide if they are used and how. These last two
will be found in the @c priv parameter, of type @c Evas_Object_Box_Data,
passed to @p cb. The @c Evas_Object the function receives is not the
Elementary widget, but the internal Evas Box it uses, so none of the
functions described here can be used on it.
Any of the layout functions in @c Evas can be used here, as well as the
special elm_box_layout_transition().
The final @p data argument received by @p cb is the same @p data passed
here, and the @p free_data function will be called to free it
whenever the box is destroyed or another layout function is set.
Setting @p cb to NULL will revert back to the default layout function.
@see elm_box_layout_transition()
@ingroup Box */
}
values {
Evas_Object_Box_Layout cb; /*@ The callback function used for layout */
const void *data; /*@ Data that will be passed to layout function */
Ecore_Cb free_data; /*@ Function called to free @p data */
}
}
children {
get {
/*@
Retrieve a list of the objects packed into the box
Returns a new @c Eina_List with a pointer to @c Evas_Object in its nodes.
The order of the list corresponds to the packing order the box uses.
You must free this list with eina_list_free() once you are done with it.
@ingroup Box */
return Eina_List *;
}
}
}
methods {
pack_end {
/*@
Add an object at the end of the pack list
Pack @p subobj into the box @p obj, placing it last in the list of
children objects. The actual position the object will get on screen
depends on the layout used. If no custom layout is set, it will be at
the bottom or right, depending if the box is vertical or horizontal,
respectively.
@see elm_box_pack_start()
@see elm_box_pack_before()
@see elm_box_pack_after()
@see elm_box_unpack()
@see elm_box_unpack_all()
@see elm_box_clear()
@ingroup Box */
params {
@in Evas_Object *subobj; /*@ The object to add to the box */
}
}
unpack_all {
/*@
Remove all items from the box, without deleting them
Clear the box from all children, but don't delete the respective objects.
If no other references of the box children exist, the objects will never
be deleted, and thus the application will leak the memory. Make sure
when using this function that you hold a reference to all the objects
in the box @p obj.
@see elm_box_clear()
@see elm_box_unpack()
@ingroup Box */
}
unpack {
/*@
Unpack a box item
Remove the object given by @p subobj from the box @p obj without
deleting it.
@see elm_box_unpack_all()
@see elm_box_clear()
@ingroup Box */
params {
@in Evas_Object *subobj; /*@ The object to unpack */
}
}
pack_after {
/*@
Adds an object to the box after the indicated object
This will add the @p subobj to the box indicated after the object
indicated with @p after. If @p after is not already in the box, results
are undefined. After means either to the right of the indicated object or
below it depending on orientation.
@see elm_box_pack_start()
@see elm_box_pack_end()
@see elm_box_pack_before()
@see elm_box_unpack()
@see elm_box_unpack_all()
@see elm_box_clear()
@ingroup Box */
params {
@in Evas_Object *subobj; /*@ The object to add to the box */
@in Evas_Object *after; /*@ The object after which to add it */
}
}
pack_start {
/*@
Add an object to the beginning of the pack list
Pack @p subobj into the box @p obj, placing it first in the list of
children objects. The actual position the object will get on screen
depends on the layout used. If no custom layout is set, it will be at
the top or left, depending if the box is vertical or horizontal,
respectively.
@see elm_box_pack_end()
@see elm_box_pack_before()
@see elm_box_pack_after()
@see elm_box_unpack()
@see elm_box_unpack_all()
@see elm_box_clear()
@ingroup Box */
params {
@in Evas_Object *subobj; /*@ The object to add to the box */
}
}
recalculate {
/*@
Force the box to recalculate its children packing.
If any children was added or removed, box will not calculate the
values immediately rather leaving it to the next main loop
iteration. While this is great as it would save lots of
recalculation, whenever you need to get the position of a just
added item you must force recalculate before doing so.
@ingroup Box */
}
pack_before {
/*@
Adds an object to the box before the indicated object
This will add the @p subobj to the box indicated before the object
indicated with @p before. If @p before is not already in the box, results
are undefined. Before means either to the left of the indicated object or
above it depending on orientation.
@see elm_box_pack_start()
@see elm_box_pack_end()
@see elm_box_pack_after()
@see elm_box_unpack()
@see elm_box_unpack_all()
@see elm_box_clear()
@ingroup Box */
params {
@in Evas_Object *subobj; /*@ The object to add to the box */
@in Evas_Object *before; /*@ The object before which to add it */
}
}
clear {
/*@
Clear the box of all children
Remove all the elements contained by the box, deleting the respective
objects.
@see elm_box_unpack()
@see elm_box_unpack_all()
@ingroup Box */
}
}
implements {
class::constructor;
Eo_Base::constructor;
Evas_Smart::add;
Evas_Smart::del;
Elm_Widget::focus_direction;
Elm_Widget::focus_next_manager_is;
Elm_Widget::focus_direction_manager_is;
Elm_Widget::focus_next;
Elm_Widget::theme_apply;
Elm_Widget::sub_object_del;
}
events {
child,added;
child,removed;
}
}

View File

@ -1,3 +1,6 @@
#include "elm_box.eo.h"
#if 0
#define ELM_OBJ_BOX_CLASS elm_obj_box_class_get()
const Eo_Class *elm_obj_box_class_get(void) EINA_CONST;
@ -286,3 +289,5 @@ enum
* @ingroup Box
*/
#define elm_obj_box_recalculate() ELM_OBJ_BOX_ID(ELM_OBJ_BOX_SUB_ID_RECALCULATE)
#endif

View File

@ -17,8 +17,8 @@
/**
* Base widget smart data extended with box instance data.
*/
typedef struct _Elm_Box_Smart_Data Elm_Box_Smart_Data;
struct _Elm_Box_Smart_Data
typedef struct _Elm_Box_Data Elm_Box_Data;
struct _Elm_Box_Data
{
Eina_Bool homogeneous : 1;
Eina_Bool delete_me : 1;
@ -64,7 +64,7 @@ struct _Transition_Animation_Data
*/
#define ELM_BOX_DATA_GET(o, sd) \
Elm_Box_Smart_Data * sd = eo_data_scope_get(o, ELM_OBJ_BOX_CLASS)
Elm_Box_Data * sd = eo_data_scope_get(o, ELM_OBJ_BOX_CLASS)
#define ELM_BOX_DATA_GET_OR_RETURN(o, ptr) \
ELM_BOX_DATA_GET(o, ptr); \