diff --git a/src/Makefile_Edje.am b/src/Makefile_Edje.am index 34a2cb7549..c2a85499ae 100644 --- a/src/Makefile_Edje.am +++ b/src/Makefile_Edje.am @@ -90,6 +90,7 @@ lib/edje/edje_smart.c \ lib/edje/edje_text.c \ lib/edje/edje_textblock_styles.c \ lib/edje/edje_util.c \ +lib/edje/edje_legacy.c \ lib/edje/edje_var.c \ lib/edje/edje_signal.c \ lib/edje/edje_part.c \ diff --git a/src/lib/edje/Edje_Legacy.h b/src/lib/edje/Edje_Legacy.h index 26a871fe40..7a7b46da45 100644 --- a/src/lib/edje/Edje_Legacy.h +++ b/src/lib/edje/Edje_Legacy.h @@ -149,6 +149,32 @@ EAPI Edje_Load_Error edje_object_load_error_get(const Evas_Object *obj); */ EAPI const char *edje_load_error_str (Edje_Load_Error error); +/** + * @brief Retrieves the geometry of a given Edje part, in a given Edje object's + * group definition, relative to the object's area. + * + * This function gets the geometry of an Edje part within its group. The x and + * y coordinates are relative to the top left corner of the whole obj object's + * area. + * + * @note Use @c null pointers on the geometry components you're not interested + * in: they'll be ignored by the function. + * + * @note On failure, this function will make all non-$null geometry pointers' + * pointed variables be set to zero. + * + * @param[in] part The Edje part's name + * @param[out] x A pointer to a variable where to store the part's x coordinate + * @param[out] y A pointer to a variable where to store the part's y coordinate + * @param[out] w A pointer to a variable where to store the part's width + * @param[out] h A pointer to a variable where to store the part's height + * + * @return @c true on success, @c false otherwise + * + * @ingroup Edje_Object + */ +EAPI Eina_Bool edje_object_part_geometry_get(const Edje_Object *obj, const char * part, int *x, int *y, int *w, int *h); + /** * @brief Gets a handle to the Evas object implementing a given Edje part, in * an Edje object. diff --git a/src/lib/edje/edje_legacy.c b/src/lib/edje/edje_legacy.c new file mode 100644 index 0000000000..693fd316d5 --- /dev/null +++ b/src/lib/edje/edje_legacy.c @@ -0,0 +1,41 @@ +/* Legacy API implementations based on internal EO calls */ + +#include "edje_private.h" + +EAPI Eina_Bool +edje_object_part_geometry_get(const Edje_Object *obj, const char *part, int *x, int *y, int *w, int *h) +{ + Edje_Real_Part *rp; + Edje *ed; + + // Similar to geometry_get(efl_part(obj, part), x, y, w, h) but the bool + // return value matters here. + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) + { + if (x) *x = 0; + if (y) *y = 0; + if (w) *w = 0; + if (h) *h = 0; + return EINA_FALSE; + } + + /* Need to recalc before providing the object. */ + _edje_recalc_do(ed); + + rp = _edje_real_part_recursive_get(&ed, part); + if (!rp) + { + if (x) *x = 0; + if (y) *y = 0; + if (w) *w = 0; + if (h) *h = 0; + return EINA_FALSE; + } + if (x) *x = rp->x; + if (y) *y = rp->y; + if (w) *w = rp->w; + if (h) *h = rp->h; + return EINA_TRUE; +} diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo index c6105ab6fd..69b2ce7d12 100644 --- a/src/lib/edje/edje_object.eo +++ b/src/lib/edje/edje_object.eo @@ -837,32 +837,6 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part, val_ret: double; [[Part state value]] } } - @property part_geometry { - get { - [[Retrieves the geometry of a given Edje part, in a given Edje - object's group definition, relative to the object's area. - - This function gets the geometry of an Edje part within its - group. The x and y coordinates are relative to the top left - corner of the whole obj object's area. - - Note: Use $null pointers on the geometry components you're not - interested in: they'll be ignored by the function. - - Note: On failure, this function will make all non-$null geometry - pointers' pointed variables be set to zero.]] - return: bool; [[$true on success, $false otherwise]] - } - keys { - part: string; [[The Edje part's name]] - } - values { - x: int; [[A pointer to a variable where to store the part's x coordinate]] - y: int; [[A pointer to a variable where to store the part's y coordinate]] - w: int; [[A pointer to a variable where to store the part's width]] - h: int; [[A pointer to a variable where to store the part's height]] - } - } @property part_drag_value { set { [[Sets the dragable object location. diff --git a/src/lib/edje/edje_part.c b/src/lib/edje/edje_part.c index ab8b532f67..5f7c314048 100644 --- a/src/lib/edje/edje_part.c +++ b/src/lib/edje/edje_part.c @@ -1,5 +1,6 @@ #include "edje_private.h" #include "edje_part_helper.h" +#define MY_CLASS EFL_CANVAS_LAYOUT_INTERNAL_CLASS PROXY_INIT(box) PROXY_INIT(table) @@ -13,11 +14,43 @@ _edje_internal_proxy_shutdown(void) _swallow_shutdown(); } -/* Internal EO API */ +void +_edje_real_part_set(Eo *obj, void *ed, void *rp, const char *part) +{ + PROXY_DATA_GET(obj, pd); + pd->ed = ed; + pd->rp = rp; + pd->part = part; + pd->temp = 1; + efl_parent_set(obj, pd->ed->obj); +} -EOAPI EFL_VOID_FUNC_BODYV(_efl_canvas_layout_internal_real_part_set, EFL_FUNC_CALL(ed, rp, part), void *ed, void *rp, const char *part) +EOLIAN static Efl_Object * +_efl_canvas_layout_internal_efl_object_finalize(Eo *obj, Efl_Canvas_Layout_Internal_Data *pd) +{ + EINA_SAFETY_ON_FALSE_RETURN_VAL(pd->rp && pd->ed && pd->part, NULL); + return efl_finalize(efl_super(obj, MY_CLASS)); +} -#define EFL_CANVAS_LAYOUT_INTERNAL_EXTRA_OPS \ - EFL_OBJECT_OP_FUNC(_efl_canvas_layout_internal_real_part_set, NULL) +EOLIAN void +_efl_canvas_layout_internal_efl_gfx_geometry_get(Eo *obj EINA_UNUSED, Efl_Canvas_Layout_Internal_Data *pd, int *x, int *y, int *w, int *h) +{ + Edje_Real_Part *rp = pd->rp; + + _edje_recalc_do(pd->ed); + if (!rp) + { + if (x) *x = 0; + if (y) *y = 0; + if (w) *w = 0; + if (h) *h = 0; + } + + if (x) *x = rp->x; + if (y) *y = rp->y; + if (w) *w = rp->w; + if (h) *h = rp->h; + RETURN_VOID; +} #include "efl_canvas_layout_internal.eo.c" diff --git a/src/lib/edje/edje_part_box.c b/src/lib/edje/edje_part_box.c index 701971d144..75bb2687d5 100644 --- a/src/lib/edje/edje_part_box.c +++ b/src/lib/edje/edje_part_box.c @@ -214,9 +214,4 @@ _efl_canvas_layout_internal_box_efl_orientation_orientation_get(Eo *obj, void *_ RETURN_VAL(EFL_ORIENT_NONE); } -/* Internal EO API */ - -#define EFL_CANVAS_LAYOUT_INTERNAL_BOX_EXTRA_OPS \ - EFL_OBJECT_OP_FUNC(_efl_canvas_layout_internal_real_part_set, _efl_canvas_layout_internal_box_efl_canvas_layout_internal_real_part_set) - #include "efl_canvas_layout_internal_box.eo.c" diff --git a/src/lib/edje/edje_part_helper.h b/src/lib/edje/edje_part_helper.h index 385dcec12d..136e09244b 100644 --- a/src/lib/edje/edje_part_helper.h +++ b/src/lib/edje/edje_part_helper.h @@ -1,8 +1,6 @@ #include "edje_private.h" #include "efl_canvas_layout_internal.eo.h" -EOAPI void _efl_canvas_layout_internal_real_part_set(Eo *obj, void *ed, void *rp, const char *part); - typedef struct _Efl_Canvas_Layout_Internal_Data Efl_Canvas_Layout_Internal_Data; struct _Efl_Canvas_Layout_Internal_Data @@ -27,6 +25,8 @@ struct _Part_Item_Iterator #define RETURN_VOID do { PROXY_UNREF(obj, pd); return; } while(0) #define PROXY_CALL(a) ({ PROXY_REF(obj, pd); a; }) +void _edje_real_part_set(Eo *obj, void *ed, void *rp, const char *part); + /* ugly macros to avoid code duplication */ #define PROXY_RESET(type) \ @@ -48,7 +48,7 @@ _ ## type ## _shutdown(void); \ static Eo * _ ## type ## _proxy = NULL; \ \ static void \ -type ## _del_cb(Eo *proxy) \ +_ ## type ## _del_cb(Eo *proxy) \ { \ if (_ ## type ## _proxy) \ { \ @@ -85,8 +85,10 @@ _edje_ ## type ## _internal_proxy_get(Edje_Object *obj EINA_UNUSED, Edje *ed, Ed ERR("Found invalid handle for efl_part. Reset."); \ _ ## type ## _proxy = NULL; \ } \ - return efl_add(MY_CLASS, ed->obj, \ - _efl_canvas_layout_internal_real_part_set(efl_added, ed, rp, rp->part->name)); \ + proxy = efl_add(MY_CLASS, ed->obj, \ + _edje_real_part_set(efl_added, ed, rp, rp->part->name)); \ + efl_del_intercept_set(proxy, _ ## type ## _del_cb); \ + return proxy; \ } \ \ if (EINA_UNLIKELY(pd->temp)) \ @@ -99,28 +101,9 @@ _edje_ ## type ## _internal_proxy_get(Edje_Object *obj EINA_UNUSED, Edje *ed, Ed } \ proxy = _ ## type ## _proxy; \ _ ## type ## _proxy = NULL; \ - _efl_canvas_layout_internal_real_part_set(proxy, ed, rp, rp->part->name); \ + _edje_real_part_set(proxy, ed, rp, rp->part->name); \ + efl_del_intercept_set(proxy, _ ## type ## _del_cb); \ return proxy; \ -} \ -\ -EOLIAN static void \ -_efl_canvas_layout_internal_ ## type ## _efl_canvas_layout_internal_real_part_set(Eo *obj, void *_pd EINA_UNUSED, void *ed, void *rp, const char *part) \ -{ \ - PROXY_DATA_GET(obj, pd); \ - pd->ed = ed; \ - pd->rp = rp; \ - pd->part = part; \ - pd->temp = 1; \ - efl_del_intercept_set(obj, type ## _del_cb); \ - efl_parent_set(obj, pd->ed->obj); \ -} \ -\ -EOLIAN static Efl_Object * \ -_efl_canvas_layout_internal_ ## type ## _efl_object_finalize(Eo *obj, void *_pd EINA_UNUSED) \ -{ \ - PROXY_DATA_GET(obj, pd); \ - EINA_SAFETY_ON_FALSE_RETURN_VAL(pd->rp && pd->ed && pd->part, NULL); \ - return efl_finalize(efl_super(obj, MY_CLASS)); \ } #ifdef DEBUG diff --git a/src/lib/edje/edje_part_swallow.c b/src/lib/edje/edje_part_swallow.c index 7eab4bc31e..db24d49f70 100644 --- a/src/lib/edje/edje_part_swallow.c +++ b/src/lib/edje/edje_part_swallow.c @@ -31,9 +31,4 @@ _efl_canvas_layout_internal_swallow_efl_container_content_unset(Eo *obj, void *_ RETURN_VAL(content); } -/* Internal EO APIs */ - -#define EFL_CANVAS_LAYOUT_INTERNAL_SWALLOW_EXTRA_OPS \ - EFL_OBJECT_OP_FUNC(_efl_canvas_layout_internal_real_part_set, _efl_canvas_layout_internal_swallow_efl_canvas_layout_internal_real_part_set), - #include "efl_canvas_layout_internal_swallow.eo.c" diff --git a/src/lib/edje/edje_part_table.c b/src/lib/edje/edje_part_table.c index 2abd03fdec..58305bfbd0 100644 --- a/src/lib/edje/edje_part_table.c +++ b/src/lib/edje/edje_part_table.c @@ -352,9 +352,4 @@ edje_object_part_table_clear(Edje_Object *obj, const char *part, Eina_Bool clear return efl_pack_unpack_all(table); } -/* Internal EO APIs */ - -#define EFL_CANVAS_LAYOUT_INTERNAL_TABLE_EXTRA_OPS \ - EFL_OBJECT_OP_FUNC(_efl_canvas_layout_internal_real_part_set, _efl_canvas_layout_internal_table_efl_canvas_layout_internal_real_part_set), - #include "efl_canvas_layout_internal_table.eo.c" diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 8740fea09e..17c9a064a1 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -1822,40 +1822,6 @@ edje_object_part_object_get(const Eo *obj, const char *part) return rp->object; } -EOLIAN Eina_Bool -_edje_object_part_geometry_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) -{ - Edje_Real_Part *rp; - - if ((!ed) || (!part)) - { - if (x) *x = 0; - if (y) *y = 0; - if (w) *w = 0; - if (h) *h = 0; - return EINA_FALSE; - } - - /* Need to recalc before providing the object. */ - _edje_recalc_do(ed); - - rp = _edje_real_part_recursive_get(&ed, part); - if (!rp) - { - if (x) *x = 0; - if (y) *y = 0; - if (w) *w = 0; - if (h) *h = 0; - return EINA_FALSE; - } - if (x) *x = rp->x; - if (y) *y = rp->y; - if (w) *w = rp->w; - if (h) *h = rp->h; - - return EINA_TRUE; -} - EOLIAN void _edje_object_item_provider_set(Eo *obj EINA_UNUSED, Edje *ed, Edje_Item_Provider_Cb func, void *data) { diff --git a/src/lib/edje/efl_canvas_layout_internal.eo b/src/lib/edje/efl_canvas_layout_internal.eo index 67e09278a0..0a523f3b8d 100644 --- a/src/lib/edje/efl_canvas_layout_internal.eo +++ b/src/lib/edje/efl_canvas_layout_internal.eo @@ -2,7 +2,8 @@ class Efl.Canvas.Layout_Internal (Efl.Object, Efl.Gfx) { [[Common class for part proxy objects for $Efl.Canvas.Layout.]] implements { - //Efl.Gfx.Size.geometry { get; } + Efl.Object.finalize; + Efl.Gfx.geometry { get; } //Efl.Gfx.Size.size { get; } } } diff --git a/src/lib/edje/efl_canvas_layout_internal_box.eo b/src/lib/edje/efl_canvas_layout_internal_box.eo index 1db1f5522a..4e96a61ccf 100644 --- a/src/lib/edje/efl_canvas_layout_internal_box.eo +++ b/src/lib/edje/efl_canvas_layout_internal_box.eo @@ -8,7 +8,6 @@ class Efl.Canvas.Layout_Internal.Box (Efl.Canvas.Layout_Internal, Efl.Pack.Linea ]] data: null; implements { - Efl.Object.finalize; Efl.Container.content_iterate; Efl.Container.content_count; Efl.Container.content_remove; diff --git a/src/lib/edje/efl_canvas_layout_internal_swallow.eo b/src/lib/edje/efl_canvas_layout_internal_swallow.eo index d3e19b3e26..a5e9098b6a 100644 --- a/src/lib/edje/efl_canvas_layout_internal_swallow.eo +++ b/src/lib/edje/efl_canvas_layout_internal_swallow.eo @@ -7,7 +7,6 @@ class Efl.Canvas.Layout_Internal.Swallow (Efl.Canvas.Layout_Internal, Efl.Contai ]] data: null; implements { - Efl.Object.finalize; Efl.Container.content { get; set; } Efl.Container.content_unset; } diff --git a/src/lib/edje/efl_canvas_layout_internal_table.eo b/src/lib/edje/efl_canvas_layout_internal_table.eo index 53258c0298..1bc84f2816 100644 --- a/src/lib/edje/efl_canvas_layout_internal_table.eo +++ b/src/lib/edje/efl_canvas_layout_internal_table.eo @@ -7,7 +7,6 @@ class Efl.Canvas.Layout_Internal.Table (Efl.Canvas.Layout_Internal, Efl.Pack.Gri ]] data: null; implements { - Efl.Object.finalize; Efl.Container.content_iterate; Efl.Container.content_count; Efl.Container.content_remove;