From 28e547fd6dd66e0edd6778beed3a92fbf7a08e65 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 5 Mar 2019 17:00:37 -0500 Subject: [PATCH] elm_box: remove all legacy usage from eo files this takes the current generated output from eolian for legacy code in efl and adds it to the tree, then removes legacy references from the corresponding eo files. in the case where the entire eo file was for a legacy object, that eo file has been removed from the tree ref T7724 Reviewed-by: Daniel Kolesa Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D8154 --- src/Makefile_Elementary.am | 5 +- src/lib/elementary/elm_box.c | 4 +- src/lib/elementary/elm_box.eo | 258 --------------------- src/lib/elementary/elm_box_eo.c | 199 ++++++++++++++++ src/lib/elementary/elm_box_eo.h | 305 +++++++++++++++++++++++++ src/lib/elementary/elm_box_eo.legacy.c | 102 +++++++++ src/lib/elementary/elm_box_eo.legacy.h | 280 +++++++++++++++++++++++ src/lib/elementary/elm_box_legacy.h | 2 +- src/lib/elementary/meson.build | 3 +- 9 files changed, 895 insertions(+), 263 deletions(-) delete mode 100644 src/lib/elementary/elm_box.eo create mode 100644 src/lib/elementary/elm_box_eo.c create mode 100644 src/lib/elementary/elm_box_eo.h create mode 100644 src/lib/elementary/elm_box_eo.legacy.c create mode 100644 src/lib/elementary/elm_box_eo.legacy.h diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 93caa5b34c..f69d22cf00 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -249,7 +249,6 @@ elm_legacy_eolian_files = \ lib/elementary/elm_actionslider_part.eo \ lib/elementary/elm_bubble_part.eo \ lib/elementary/elm_fileselector_part.eo \ - lib/elementary/elm_box.eo \ lib/elementary/elm_bubble.eo \ lib/elementary/elm_diskselector.eo \ lib/elementary/elm_diskselector_item.eo \ @@ -333,6 +332,8 @@ lib/elementary/elm_access_eo.c \ lib/elementary/elm_access_eo.legacy.c \ lib/elementary/elm_actionslider_eo.c \ lib/elementary/elm_actionslider_eo.legacy.c \ +lib/elementary/elm_box_eo.c \ +lib/elementary/elm_box_eo.legacy.c \ lib/elementary/elm_hoversel_eo.c \ lib/elementary/elm_hoversel_item_eo.c \ lib/elementary/elm_hoversel_item_eo.legacy.c @@ -385,6 +386,8 @@ lib/elementary/elm_access_eo.h \ lib/elementary/elm_access_eo.legacy.h \ lib/elementary/elm_actionslider_eo.h \ lib/elementary/elm_actionslider_eo.legacy.h \ +lib/elementary/elm_box_eo.h \ +lib/elementary/elm_box_eo.legacy.h \ lib/elementary/elm_hoversel_eo.h \ lib/elementary/elm_hoversel_eo.legacy.h \ lib/elementary/elm_hoversel_item_eo.h \ diff --git a/src/lib/elementary/elm_box.c b/src/lib/elementary/elm_box.c index 24a452618f..bd6a00d26b 100644 --- a/src/lib/elementary/elm_box.c +++ b/src/lib/elementary/elm_box.c @@ -6,7 +6,7 @@ #define EFL_UI_FOCUS_COMPOSITION_PROTECTED #include -#include +#include #include "elm_priv.h" #include "els_box.h" #include "elm_widget_box.h" @@ -666,4 +666,4 @@ _elm_box_class_constructor(Efl_Class *klass) #define ELM_BOX_EXTRA_OPS \ EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_box) -#include "elm_box.eo.c" +#include "elm_box_eo.c" diff --git a/src/lib/elementary/elm_box.eo b/src/lib/elementary/elm_box.eo deleted file mode 100644 index 5bda1dc249..0000000000 --- a/src/lib/elementary/elm_box.eo +++ /dev/null @@ -1,258 +0,0 @@ -class Elm.Box extends Efl.Ui.Widget implements Efl.Ui.Focus.Composition, Efl.Ui.Legacy -{ - [[Elementary box class]] - legacy_prefix: elm_box; - eo_prefix: elm_obj_box; - event_prefix: elm_box; - methods { - @property 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. - - ]] - } - get { - [[Get whether the box is using homogeneous mode or not ($true if - it's homogeneous, $false otherwise)]] - } - values { - homogeneous: bool; [[The homogeneous flag]] - } - } - @property 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. - - ]] - } - get { - [[Get the alignment of the whole bounding box of contents. - - See also @.align.set. - - ]] - } - values { - horizontal: double; [[The horizontal alignment of elements]] - vertical: double; [[The vertical alignment of elements]] - } - } - @property horizontal { - set { - [[Set the horizontal orientation - - By default, box object arranges their contents vertically from top to - bottom. - By calling this function with $horizontal as $true, the box will - become horizontal, arranging contents from left to right. - - Note: This flag is ignored if a custom layout function is set. - - ]] - } - get { - [[Get the horizontal orientation ($true if the box is set to - horizontal mode, $false otherwise)]] - } - values { - horizontal: bool; [[The horizontal flag]] - } - } - @property 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. - - ]] - } - get { - [[Get the space (padding) between the box's elements. - - See also @.padding.set. - - ]] - } - values { - horizontal: int; [[The horizontal space between elements]] - vertical: int; [[The vertical space between elements]] - } - } - @property children { - get { - [[Get a list of the objects packed into the box - - Returns a new $list with a pointer to $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. - - ]] - return: list @owned @warn_unused; [[List of children]] - } - } - pack_end { - [[Add an object at the end of the pack list - - Pack $subobj into the box $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 also @.pack_start, - @.pack_before, - @.pack_after, - @.unpack, - @.unpack_all, - @.clear. - ]] - - params { - @in subobj: Efl.Canvas.Object; [[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 $obj. - - See also @.clear, - @.unpack. - ]] - } - unpack { - [[Unpack a box item - - Remove the object given by $subobj from the box $obj without - deleting it. - - See also @.unpack_all, - @.clear. - - ]] - - params { - @in subobj: Efl.Canvas.Object; [[The object to unpack]] - } - } - pack_after { - [[Adds an object to the box after the indicated object - - This will add the $subobj to the box indicated after the object - indicated with $after. If $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 also @.pack_start, - @.pack_end, - @.pack_before, - @.unpack, - @.unpack_all, - @.clear. - - ]] - - params { - @in subobj: Efl.Canvas.Object; [[The object to add to the box]] - @in after: Efl.Canvas.Object; [[The object after which to add it]] - } - } - pack_start { - [[Add an object to the beginning of the pack list - - Pack $subobj into the box $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 also @.pack_end, - @.pack_before, - @.pack_after, - @.unpack, - @.unpack_all, - @.clear. - - ]] - - params { - @in subobj: Efl.Canvas.Object; [[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. - - ]] - - } - pack_before { - [[Adds an object to the box before the indicated object - - This will add the $subobj to the box indicated before the object - indicated with $before. If $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 also @.pack_start, - @.pack_end, - @.pack_after, - @.unpack, - @.unpack_all, - @.clear. - - ]] - - params { - @in subobj: Efl.Canvas.Object; [[The object to add to the box]] - @in before: Efl.Canvas.Object; [[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 also @.unpack, - @.unpack_all. - - ]] - - } - } - implements { - class.constructor; - Efl.Object.constructor; - Efl.Canvas.Group.group_calculate; - Efl.Ui.Widget.theme_apply; - Efl.Ui.Widget.widget_sub_object_del; - Efl.Ui.Focus.Composition.prepare; - } - events { - child,added: Efl.Object; [[Called when child was added]] - child,removed: Efl.Object; [[Called when child was removed]] - } -} diff --git a/src/lib/elementary/elm_box_eo.c b/src/lib/elementary/elm_box_eo.c new file mode 100644 index 0000000000..b99a6d1caa --- /dev/null +++ b/src/lib/elementary/elm_box_eo.c @@ -0,0 +1,199 @@ +EWAPI const Efl_Event_Description _ELM_BOX_EVENT_CHILD_ADDED = + EFL_EVENT_DESCRIPTION("child,added"); +EWAPI const Efl_Event_Description _ELM_BOX_EVENT_CHILD_REMOVED = + EFL_EVENT_DESCRIPTION("child,removed"); + +void _elm_box_homogeneous_set(Eo *obj, Elm_Box_Data *pd, Eina_Bool homogeneous); + + +static Eina_Error +__eolian_elm_box_homogeneous_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; Eina_Bool cval; + if (!eina_value_bool_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_box_homogeneous_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_box_homogeneous_set, EFL_FUNC_CALL(homogeneous), Eina_Bool homogeneous); + +Eina_Bool _elm_box_homogeneous_get(const Eo *obj, Elm_Box_Data *pd); + + +static Eina_Value +__eolian_elm_box_homogeneous_get_reflect(Eo *obj) +{ + Eina_Bool val = elm_obj_box_homogeneous_get(obj); + return eina_value_bool_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_box_homogeneous_get, Eina_Bool, 0); + +void _elm_box_align_set(Eo *obj, Elm_Box_Data *pd, double horizontal, double vertical); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_box_align_set, EFL_FUNC_CALL(horizontal, vertical), double horizontal, double vertical); + +void _elm_box_align_get(const Eo *obj, Elm_Box_Data *pd, double *horizontal, double *vertical); + +EOAPI EFL_VOID_FUNC_BODYV_CONST(elm_obj_box_align_get, EFL_FUNC_CALL(horizontal, vertical), double *horizontal, double *vertical); + +void _elm_box_horizontal_set(Eo *obj, Elm_Box_Data *pd, Eina_Bool horizontal); + + +static Eina_Error +__eolian_elm_box_horizontal_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; Eina_Bool cval; + if (!eina_value_bool_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_box_horizontal_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_box_horizontal_set, EFL_FUNC_CALL(horizontal), Eina_Bool horizontal); + +Eina_Bool _elm_box_horizontal_get(const Eo *obj, Elm_Box_Data *pd); + + +static Eina_Value +__eolian_elm_box_horizontal_get_reflect(Eo *obj) +{ + Eina_Bool val = elm_obj_box_horizontal_get(obj); + return eina_value_bool_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_box_horizontal_get, Eina_Bool, 0); + +void _elm_box_padding_set(Eo *obj, Elm_Box_Data *pd, int horizontal, int vertical); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_box_padding_set, EFL_FUNC_CALL(horizontal, vertical), int horizontal, int vertical); + +void _elm_box_padding_get(const Eo *obj, Elm_Box_Data *pd, int *horizontal, int *vertical); + +EOAPI EFL_VOID_FUNC_BODYV_CONST(elm_obj_box_padding_get, EFL_FUNC_CALL(horizontal, vertical), int *horizontal, int *vertical); + +Eina_List *_elm_box_children_get(const Eo *obj, Elm_Box_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_box_children_get, Eina_List *, NULL); + +void _elm_box_pack_end(Eo *obj, Elm_Box_Data *pd, Efl_Canvas_Object *subobj); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_box_pack_end, EFL_FUNC_CALL(subobj), Efl_Canvas_Object *subobj); + +void _elm_box_unpack_all(Eo *obj, Elm_Box_Data *pd); + +EOAPI EFL_VOID_FUNC_BODY(elm_obj_box_unpack_all); + +void _elm_box_unpack(Eo *obj, Elm_Box_Data *pd, Efl_Canvas_Object *subobj); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_box_unpack, EFL_FUNC_CALL(subobj), Efl_Canvas_Object *subobj); + +void _elm_box_pack_after(Eo *obj, Elm_Box_Data *pd, Efl_Canvas_Object *subobj, Efl_Canvas_Object *after); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_box_pack_after, EFL_FUNC_CALL(subobj, after), Efl_Canvas_Object *subobj, Efl_Canvas_Object *after); + +void _elm_box_pack_start(Eo *obj, Elm_Box_Data *pd, Efl_Canvas_Object *subobj); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_box_pack_start, EFL_FUNC_CALL(subobj), Efl_Canvas_Object *subobj); + +void _elm_box_recalculate(Eo *obj, Elm_Box_Data *pd); + +EOAPI EFL_VOID_FUNC_BODY(elm_obj_box_recalculate); + +void _elm_box_pack_before(Eo *obj, Elm_Box_Data *pd, Efl_Canvas_Object *subobj, Efl_Canvas_Object *before); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_box_pack_before, EFL_FUNC_CALL(subobj, before), Efl_Canvas_Object *subobj, Efl_Canvas_Object *before); + +void _elm_box_clear(Eo *obj, Elm_Box_Data *pd); + +EOAPI EFL_VOID_FUNC_BODY(elm_obj_box_clear); + +Efl_Object *_elm_box_efl_object_constructor(Eo *obj, Elm_Box_Data *pd); + + +void _elm_box_efl_canvas_group_group_calculate(Eo *obj, Elm_Box_Data *pd); + + +Eina_Error _elm_box_efl_ui_widget_theme_apply(Eo *obj, Elm_Box_Data *pd); + + +Eina_Bool _elm_box_efl_ui_widget_widget_sub_object_del(Eo *obj, Elm_Box_Data *pd, Efl_Canvas_Object *sub_obj); + + +void _elm_box_efl_ui_focus_composition_prepare(Eo *obj, Elm_Box_Data *pd); + + +static Eina_Bool +_elm_box_class_initializer(Efl_Class *klass) +{ + const Efl_Object_Ops *opsp = NULL; + + const Efl_Object_Property_Reflection_Ops *ropsp = NULL; + +#ifndef ELM_BOX_EXTRA_OPS +#define ELM_BOX_EXTRA_OPS +#endif + + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(elm_obj_box_homogeneous_set, _elm_box_homogeneous_set), + EFL_OBJECT_OP_FUNC(elm_obj_box_homogeneous_get, _elm_box_homogeneous_get), + EFL_OBJECT_OP_FUNC(elm_obj_box_align_set, _elm_box_align_set), + EFL_OBJECT_OP_FUNC(elm_obj_box_align_get, _elm_box_align_get), + EFL_OBJECT_OP_FUNC(elm_obj_box_horizontal_set, _elm_box_horizontal_set), + EFL_OBJECT_OP_FUNC(elm_obj_box_horizontal_get, _elm_box_horizontal_get), + EFL_OBJECT_OP_FUNC(elm_obj_box_padding_set, _elm_box_padding_set), + EFL_OBJECT_OP_FUNC(elm_obj_box_padding_get, _elm_box_padding_get), + EFL_OBJECT_OP_FUNC(elm_obj_box_children_get, _elm_box_children_get), + EFL_OBJECT_OP_FUNC(elm_obj_box_pack_end, _elm_box_pack_end), + EFL_OBJECT_OP_FUNC(elm_obj_box_unpack_all, _elm_box_unpack_all), + EFL_OBJECT_OP_FUNC(elm_obj_box_unpack, _elm_box_unpack), + EFL_OBJECT_OP_FUNC(elm_obj_box_pack_after, _elm_box_pack_after), + EFL_OBJECT_OP_FUNC(elm_obj_box_pack_start, _elm_box_pack_start), + EFL_OBJECT_OP_FUNC(elm_obj_box_recalculate, _elm_box_recalculate), + EFL_OBJECT_OP_FUNC(elm_obj_box_pack_before, _elm_box_pack_before), + EFL_OBJECT_OP_FUNC(elm_obj_box_clear, _elm_box_clear), + EFL_OBJECT_OP_FUNC(efl_constructor, _elm_box_efl_object_constructor), + EFL_OBJECT_OP_FUNC(efl_canvas_group_calculate, _elm_box_efl_canvas_group_group_calculate), + EFL_OBJECT_OP_FUNC(efl_ui_widget_theme_apply, _elm_box_efl_ui_widget_theme_apply), + EFL_OBJECT_OP_FUNC(efl_ui_widget_sub_object_del, _elm_box_efl_ui_widget_widget_sub_object_del), + EFL_OBJECT_OP_FUNC(efl_ui_focus_composition_prepare, _elm_box_efl_ui_focus_composition_prepare), + ELM_BOX_EXTRA_OPS + ); + opsp = &ops; + + static const Efl_Object_Property_Reflection refl_table[] = { + {"homogeneous", __eolian_elm_box_homogeneous_set_reflect, __eolian_elm_box_homogeneous_get_reflect}, + {"horizontal", __eolian_elm_box_horizontal_set_reflect, __eolian_elm_box_horizontal_get_reflect}, + }; + static const Efl_Object_Property_Reflection_Ops rops = { + refl_table, EINA_C_ARRAY_LENGTH(refl_table) + }; + ropsp = &rops; + + return efl_class_functions_set(klass, opsp, ropsp); +} + +static const Efl_Class_Description _elm_box_class_desc = { + EO_VERSION, + "Elm.Box", + EFL_CLASS_TYPE_REGULAR, + sizeof(Elm_Box_Data), + _elm_box_class_initializer, + _elm_box_class_constructor, + NULL +}; + +EFL_DEFINE_CLASS(elm_box_class_get, &_elm_box_class_desc, EFL_UI_WIDGET_CLASS, EFL_UI_FOCUS_COMPOSITION_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); + +#include "elm_box_eo.legacy.c" diff --git a/src/lib/elementary/elm_box_eo.h b/src/lib/elementary/elm_box_eo.h new file mode 100644 index 0000000000..fb82524082 --- /dev/null +++ b/src/lib/elementary/elm_box_eo.h @@ -0,0 +1,305 @@ +#ifndef _ELM_BOX_EO_H_ +#define _ELM_BOX_EO_H_ + +#ifndef _ELM_BOX_EO_CLASS_TYPE +#define _ELM_BOX_EO_CLASS_TYPE + +typedef Eo Elm_Box; + +#endif + +#ifndef _ELM_BOX_EO_TYPES +#define _ELM_BOX_EO_TYPES + + +#endif +/** Elementary box class + * + * @ingroup Elm_Box + */ +#define ELM_BOX_CLASS elm_box_class_get() + +EWAPI const Efl_Class *elm_box_class_get(void); + +/** + * @brief 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. + * + * @param[in] obj The object. + * @param[in] homogeneous The homogeneous flag + * + * @ingroup Elm_Box + */ +EOAPI void elm_obj_box_homogeneous_set(Eo *obj, Eina_Bool homogeneous); + +/** + * @brief Get whether the box is using homogeneous mode or not ($true if it's + * homogeneous, @c false otherwise) + * + * @param[in] obj The object. + * + * @return The homogeneous flag + * + * @ingroup Elm_Box + */ +EOAPI Eina_Bool elm_obj_box_homogeneous_get(const Eo *obj); + +/** + * @brief 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. + * + * @param[in] obj The object. + * @param[in] horizontal The horizontal alignment of elements + * @param[in] vertical The vertical alignment of elements + * + * @ingroup Elm_Box + */ +EOAPI void elm_obj_box_align_set(Eo *obj, double horizontal, double vertical); + +/** + * @brief Get the alignment of the whole bounding box of contents. + * + * See also @ref elm_obj_box_align_set. + * + * @param[in] obj The object. + * @param[out] horizontal The horizontal alignment of elements + * @param[out] vertical The vertical alignment of elements + * + * @ingroup Elm_Box + */ +EOAPI void elm_obj_box_align_get(const Eo *obj, double *horizontal, double *vertical); + +/** + * @brief Set the horizontal orientation + * + * By default, box object arranges their contents vertically from top to + * bottom. By calling this function with @c horizontal as @c true, the box will + * become horizontal, arranging contents from left to right. + * + * @note This flag is ignored if a custom layout function is set. + * + * @param[in] obj The object. + * @param[in] horizontal The horizontal flag + * + * @ingroup Elm_Box + */ +EOAPI void elm_obj_box_horizontal_set(Eo *obj, Eina_Bool horizontal); + +/** + * @brief Get the horizontal orientation ($true if the box is set to horizontal + * mode, @c false otherwise) + * + * @param[in] obj The object. + * + * @return The horizontal flag + * + * @ingroup Elm_Box + */ +EOAPI Eina_Bool elm_obj_box_horizontal_get(const Eo *obj); + +/** + * @brief 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. + * + * @param[in] obj The object. + * @param[in] horizontal The horizontal space between elements + * @param[in] vertical The vertical space between elements + * + * @ingroup Elm_Box + */ +EOAPI void elm_obj_box_padding_set(Eo *obj, int horizontal, int vertical); + +/** + * @brief Get the space (padding) between the box's elements. + * + * See also @ref elm_obj_box_padding_set. + * + * @param[in] obj The object. + * @param[out] horizontal The horizontal space between elements + * @param[out] vertical The vertical space between elements + * + * @ingroup Elm_Box + */ +EOAPI void elm_obj_box_padding_get(const Eo *obj, int *horizontal, int *vertical); + +/** + * @brief Get a list of the objects packed into the box + * + * Returns a new @c 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. + * + * @param[in] obj The object. + * + * @return List of children + * + * @ingroup Elm_Box + */ +EOAPI Eina_List *elm_obj_box_children_get(const Eo *obj) EINA_WARN_UNUSED_RESULT; + +/** + * @brief Add an object at the end of the pack list + * + * Pack @c subobj into the box @c 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 also @ref elm_obj_box_pack_start, @ref elm_obj_box_pack_before, + * @ref elm_obj_box_pack_after, @ref elm_obj_box_unpack, + * @ref elm_obj_box_unpack_all, @ref elm_obj_box_clear. + * + * @param[in] obj The object. + * @param[in] subobj The object to add to the box + * + * @ingroup Elm_Box + */ +EOAPI void elm_obj_box_pack_end(Eo *obj, Efl_Canvas_Object *subobj); + +/** + * @brief 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 + * @c obj. + * + * See also @ref elm_obj_box_clear, @ref elm_obj_box_unpack. + * @param[in] obj The object. + * + * @ingroup Elm_Box + */ +EOAPI void elm_obj_box_unpack_all(Eo *obj); + +/** + * @brief Unpack a box item + * + * Remove the object given by @c subobj from the box @c obj without deleting + * it. + * + * See also @ref elm_obj_box_unpack_all, @ref elm_obj_box_clear. + * + * @param[in] obj The object. + * @param[in] subobj The object to unpack + * + * @ingroup Elm_Box + */ +EOAPI void elm_obj_box_unpack(Eo *obj, Efl_Canvas_Object *subobj); + +/** + * @brief Adds an object to the box after the indicated object + * + * This will add the @c subobj to the box indicated after the object indicated + * with @c after. If @c 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 also @ref elm_obj_box_pack_start, @ref elm_obj_box_pack_end, + * @ref elm_obj_box_pack_before, @ref elm_obj_box_unpack, + * @ref elm_obj_box_unpack_all, @ref elm_obj_box_clear. + * + * @param[in] obj The object. + * @param[in] subobj The object to add to the box + * @param[in] after The object after which to add it + * + * @ingroup Elm_Box + */ +EOAPI void elm_obj_box_pack_after(Eo *obj, Efl_Canvas_Object *subobj, Efl_Canvas_Object *after); + +/** + * @brief Add an object to the beginning of the pack list + * + * Pack @c subobj into the box @c 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 also @ref elm_obj_box_pack_end, @ref elm_obj_box_pack_before, + * @ref elm_obj_box_pack_after, @ref elm_obj_box_unpack, + * @ref elm_obj_box_unpack_all, @ref elm_obj_box_clear. + * + * @param[in] obj The object. + * @param[in] subobj The object to add to the box + * + * @ingroup Elm_Box + */ +EOAPI void elm_obj_box_pack_start(Eo *obj, Efl_Canvas_Object *subobj); + +/** + * @brief 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. + * @param[in] obj The object. + * + * @ingroup Elm_Box + */ +EOAPI void elm_obj_box_recalculate(Eo *obj); + +/** + * @brief Adds an object to the box before the indicated object + * + * This will add the @c subobj to the box indicated before the object indicated + * with @c before. If @c 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 also @ref elm_obj_box_pack_start, @ref elm_obj_box_pack_end, + * @ref elm_obj_box_pack_after, @ref elm_obj_box_unpack, + * @ref elm_obj_box_unpack_all, @ref elm_obj_box_clear. + * + * @param[in] obj The object. + * @param[in] subobj The object to add to the box + * @param[in] before The object before which to add it + * + * @ingroup Elm_Box + */ +EOAPI void elm_obj_box_pack_before(Eo *obj, Efl_Canvas_Object *subobj, Efl_Canvas_Object *before); + +/** + * @brief Clear the box of all children + * + * Remove all the elements contained by the box, deleting the respective + * objects. + * + * See also @ref elm_obj_box_unpack, @ref elm_obj_box_unpack_all. + * @param[in] obj The object. + * + * @ingroup Elm_Box + */ +EOAPI void elm_obj_box_clear(Eo *obj); + +EWAPI extern const Efl_Event_Description _ELM_BOX_EVENT_CHILD_ADDED; + +/** Called when child was added + * @return Efl_Object * + * + * @ingroup Elm_Box + */ +#define ELM_BOX_EVENT_CHILD_ADDED (&(_ELM_BOX_EVENT_CHILD_ADDED)) + +EWAPI extern const Efl_Event_Description _ELM_BOX_EVENT_CHILD_REMOVED; + +/** Called when child was removed + * @return Efl_Object * + * + * @ingroup Elm_Box + */ +#define ELM_BOX_EVENT_CHILD_REMOVED (&(_ELM_BOX_EVENT_CHILD_REMOVED)) + +#endif diff --git a/src/lib/elementary/elm_box_eo.legacy.c b/src/lib/elementary/elm_box_eo.legacy.c new file mode 100644 index 0000000000..c1e5b7e702 --- /dev/null +++ b/src/lib/elementary/elm_box_eo.legacy.c @@ -0,0 +1,102 @@ + +EAPI void +elm_box_homogeneous_set(Elm_Box *obj, Eina_Bool homogeneous) +{ + elm_obj_box_homogeneous_set(obj, homogeneous); +} + +EAPI Eina_Bool +elm_box_homogeneous_get(const Elm_Box *obj) +{ + return elm_obj_box_homogeneous_get(obj); +} + +EAPI void +elm_box_align_set(Elm_Box *obj, double horizontal, double vertical) +{ + elm_obj_box_align_set(obj, horizontal, vertical); +} + +EAPI void +elm_box_align_get(const Elm_Box *obj, double *horizontal, double *vertical) +{ + elm_obj_box_align_get(obj, horizontal, vertical); +} + +EAPI void +elm_box_horizontal_set(Elm_Box *obj, Eina_Bool horizontal) +{ + elm_obj_box_horizontal_set(obj, horizontal); +} + +EAPI Eina_Bool +elm_box_horizontal_get(const Elm_Box *obj) +{ + return elm_obj_box_horizontal_get(obj); +} + +EAPI void +elm_box_padding_set(Elm_Box *obj, int horizontal, int vertical) +{ + elm_obj_box_padding_set(obj, horizontal, vertical); +} + +EAPI void +elm_box_padding_get(const Elm_Box *obj, int *horizontal, int *vertical) +{ + elm_obj_box_padding_get(obj, horizontal, vertical); +} + +EAPI Eina_List * +elm_box_children_get(const Elm_Box *obj) +{ + return elm_obj_box_children_get(obj); +} + +EAPI void +elm_box_pack_end(Elm_Box *obj, Efl_Canvas_Object *subobj) +{ + elm_obj_box_pack_end(obj, subobj); +} + +EAPI void +elm_box_unpack_all(Elm_Box *obj) +{ + elm_obj_box_unpack_all(obj); +} + +EAPI void +elm_box_unpack(Elm_Box *obj, Efl_Canvas_Object *subobj) +{ + elm_obj_box_unpack(obj, subobj); +} + +EAPI void +elm_box_pack_after(Elm_Box *obj, Efl_Canvas_Object *subobj, Efl_Canvas_Object *after) +{ + elm_obj_box_pack_after(obj, subobj, after); +} + +EAPI void +elm_box_pack_start(Elm_Box *obj, Efl_Canvas_Object *subobj) +{ + elm_obj_box_pack_start(obj, subobj); +} + +EAPI void +elm_box_recalculate(Elm_Box *obj) +{ + elm_obj_box_recalculate(obj); +} + +EAPI void +elm_box_pack_before(Elm_Box *obj, Efl_Canvas_Object *subobj, Efl_Canvas_Object *before) +{ + elm_obj_box_pack_before(obj, subobj, before); +} + +EAPI void +elm_box_clear(Elm_Box *obj) +{ + elm_obj_box_clear(obj); +} diff --git a/src/lib/elementary/elm_box_eo.legacy.h b/src/lib/elementary/elm_box_eo.legacy.h new file mode 100644 index 0000000000..9171fbaafe --- /dev/null +++ b/src/lib/elementary/elm_box_eo.legacy.h @@ -0,0 +1,280 @@ +#ifndef _ELM_BOX_EO_LEGACY_H_ +#define _ELM_BOX_EO_LEGACY_H_ + +#ifndef _ELM_BOX_EO_CLASS_TYPE +#define _ELM_BOX_EO_CLASS_TYPE + +typedef Eo Elm_Box; + +#endif + +#ifndef _ELM_BOX_EO_TYPES +#define _ELM_BOX_EO_TYPES + + +#endif + +/** + * @brief 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. + * + * @param[in] obj The object. + * @param[in] homogeneous The homogeneous flag + * + * @ingroup Elm_Box_Group + */ +EAPI void elm_box_homogeneous_set(Elm_Box *obj, Eina_Bool homogeneous); + +/** + * @brief Get whether the box is using homogeneous mode or not ($true if it's + * homogeneous, @c false otherwise) + * + * @param[in] obj The object. + * + * @return The homogeneous flag + * + * @ingroup Elm_Box_Group + */ +EAPI Eina_Bool elm_box_homogeneous_get(const Elm_Box *obj); + +/** + * @brief 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. + * + * @param[in] obj The object. + * @param[in] horizontal The horizontal alignment of elements + * @param[in] vertical The vertical alignment of elements + * + * @ingroup Elm_Box_Group + */ +EAPI void elm_box_align_set(Elm_Box *obj, double horizontal, double vertical); + +/** + * @brief Get the alignment of the whole bounding box of contents. + * + * See also @ref elm_box_align_set. + * + * @param[in] obj The object. + * @param[out] horizontal The horizontal alignment of elements + * @param[out] vertical The vertical alignment of elements + * + * @ingroup Elm_Box_Group + */ +EAPI void elm_box_align_get(const Elm_Box *obj, double *horizontal, double *vertical); + +/** + * @brief Set the horizontal orientation + * + * By default, box object arranges their contents vertically from top to + * bottom. By calling this function with @c horizontal as @c true, the box will + * become horizontal, arranging contents from left to right. + * + * @note This flag is ignored if a custom layout function is set. + * + * @param[in] obj The object. + * @param[in] horizontal The horizontal flag + * + * @ingroup Elm_Box_Group + */ +EAPI void elm_box_horizontal_set(Elm_Box *obj, Eina_Bool horizontal); + +/** + * @brief Get the horizontal orientation ($true if the box is set to horizontal + * mode, @c false otherwise) + * + * @param[in] obj The object. + * + * @return The horizontal flag + * + * @ingroup Elm_Box_Group + */ +EAPI Eina_Bool elm_box_horizontal_get(const Elm_Box *obj); + +/** + * @brief 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. + * + * @param[in] obj The object. + * @param[in] horizontal The horizontal space between elements + * @param[in] vertical The vertical space between elements + * + * @ingroup Elm_Box_Group + */ +EAPI void elm_box_padding_set(Elm_Box *obj, int horizontal, int vertical); + +/** + * @brief Get the space (padding) between the box's elements. + * + * See also @ref elm_box_padding_set. + * + * @param[in] obj The object. + * @param[out] horizontal The horizontal space between elements + * @param[out] vertical The vertical space between elements + * + * @ingroup Elm_Box_Group + */ +EAPI void elm_box_padding_get(const Elm_Box *obj, int *horizontal, int *vertical); + +/** + * @brief Get a list of the objects packed into the box + * + * Returns a new @c 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. + * + * @param[in] obj The object. + * + * @return List of children + * + * @ingroup Elm_Box_Group + */ +EAPI Eina_List *elm_box_children_get(const Elm_Box *obj) EINA_WARN_UNUSED_RESULT; + +/** + * @brief Add an object at the end of the pack list + * + * Pack @c subobj into the box @c 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 also @ref elm_box_pack_start, @ref elm_box_pack_before, + * @ref elm_box_pack_after, @ref elm_box_unpack, @ref elm_box_unpack_all, + * @ref elm_box_clear. + * + * @param[in] obj The object. + * @param[in] subobj The object to add to the box + * + * @ingroup Elm_Box_Group + */ +EAPI void elm_box_pack_end(Elm_Box *obj, Efl_Canvas_Object *subobj); + +/** + * @brief 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 + * @c obj. + * + * See also @ref elm_box_clear, @ref elm_box_unpack. + * @param[in] obj The object. + * + * @ingroup Elm_Box_Group + */ +EAPI void elm_box_unpack_all(Elm_Box *obj); + +/** + * @brief Unpack a box item + * + * Remove the object given by @c subobj from the box @c obj without deleting + * it. + * + * See also @ref elm_box_unpack_all, @ref elm_box_clear. + * + * @param[in] obj The object. + * @param[in] subobj The object to unpack + * + * @ingroup Elm_Box_Group + */ +EAPI void elm_box_unpack(Elm_Box *obj, Efl_Canvas_Object *subobj); + +/** + * @brief Adds an object to the box after the indicated object + * + * This will add the @c subobj to the box indicated after the object indicated + * with @c after. If @c 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 also @ref elm_box_pack_start, @ref elm_box_pack_end, + * @ref elm_box_pack_before, @ref elm_box_unpack, @ref elm_box_unpack_all, + * @ref elm_box_clear. + * + * @param[in] obj The object. + * @param[in] subobj The object to add to the box + * @param[in] after The object after which to add it + * + * @ingroup Elm_Box_Group + */ +EAPI void elm_box_pack_after(Elm_Box *obj, Efl_Canvas_Object *subobj, Efl_Canvas_Object *after); + +/** + * @brief Add an object to the beginning of the pack list + * + * Pack @c subobj into the box @c 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 also @ref elm_box_pack_end, @ref elm_box_pack_before, + * @ref elm_box_pack_after, @ref elm_box_unpack, @ref elm_box_unpack_all, + * @ref elm_box_clear. + * + * @param[in] obj The object. + * @param[in] subobj The object to add to the box + * + * @ingroup Elm_Box_Group + */ +EAPI void elm_box_pack_start(Elm_Box *obj, Efl_Canvas_Object *subobj); + +/** + * @brief 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. + * @param[in] obj The object. + * + * @ingroup Elm_Box_Group + */ +EAPI void elm_box_recalculate(Elm_Box *obj); + +/** + * @brief Adds an object to the box before the indicated object + * + * This will add the @c subobj to the box indicated before the object indicated + * with @c before. If @c 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 also @ref elm_box_pack_start, @ref elm_box_pack_end, + * @ref elm_box_pack_after, @ref elm_box_unpack, @ref elm_box_unpack_all, + * @ref elm_box_clear. + * + * @param[in] obj The object. + * @param[in] subobj The object to add to the box + * @param[in] before The object before which to add it + * + * @ingroup Elm_Box_Group + */ +EAPI void elm_box_pack_before(Elm_Box *obj, Efl_Canvas_Object *subobj, Efl_Canvas_Object *before); + +/** + * @brief Clear the box of all children + * + * Remove all the elements contained by the box, deleting the respective + * objects. + * + * See also @ref elm_box_unpack, @ref elm_box_unpack_all. + * @param[in] obj The object. + * + * @ingroup Elm_Box_Group + */ +EAPI void elm_box_clear(Elm_Box *obj); + +#endif diff --git a/src/lib/elementary/elm_box_legacy.h b/src/lib/elementary/elm_box_legacy.h index e7b928f7de..1afb296efd 100644 --- a/src/lib/elementary/elm_box_legacy.h +++ b/src/lib/elementary/elm_box_legacy.h @@ -10,7 +10,7 @@ */ EAPI Evas_Object *elm_box_add(Evas_Object *parent); -#include "elm_box.eo.legacy.h" +#include "elm_box_eo.legacy.h" /** * @brief Set the layout defining function to be used by the box diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index db9b97f4b7..68e2b92d7b 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -63,7 +63,6 @@ pub_legacy_eo_files = [ 'elm_actionslider_part.eo', 'elm_bubble_part.eo', 'elm_fileselector_part.eo', - 'elm_box.eo', 'elm_bubble.eo', 'elm_diskselector.eo', 'elm_diskselector_item.eo', @@ -724,6 +723,8 @@ elementary_pub_headers = [ 'elm_access_eo.legacy.h', 'elm_actionslider_eo.h', 'elm_actionslider_eo.legacy.h', + 'elm_box_eo.h', + 'elm_box_eo.legacy.h', 'elm_hoversel_eo.h', 'elm_hoversel_eo.legacy.h', 'elm_hoversel_item_eo.h',