From 97422856ceee280269ea29248317e19f4a6225dc Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Fri, 22 Apr 2016 17:31:55 +0900 Subject: [PATCH] Edje: Replace edje part_table with a fake eo proxy This is similar to the previous patch for Box, but for Table. Those new EO API as well as the legacy ones still need to be tested (no test case in make check...) @feature --- src/Makefile_Edje.am | 3 +- src/lib/edje/Edje_Legacy.h | 70 +++++ src/lib/edje/edje_containers.c | 335 +++++++++++++++++++++-- src/lib/edje/edje_object.eo | 61 +---- src/lib/edje/edje_private.h | 10 +- src/lib/edje/edje_util.c | 26 +- src/lib/edje/efl_canvas_layout_internal_box.eo | 1 + src/lib/edje/efl_canvas_layout_internal_table.eo | 36 +++ src/lib/evas/canvas/evas_object_table.c | 6 + src/lib/evas/canvas/evas_table.eo | 5 + 10 files changed, 456 insertions(+), 97 deletions(-) create mode 100644 src/lib/edje/efl_canvas_layout_internal_table.eo diff --git a/src/Makefile_Edje.am b/src/Makefile_Edje.am index f2bb792..c7ec676 100644 --- a/src/Makefile_Edje.am +++ b/src/Makefile_Edje.am @@ -9,7 +9,8 @@ edje_eolian_type_files = \ lib/edje/edje_types.eot edje_eolian_priv_files = \ - lib/edje/efl_canvas_layout_internal_box.eo + lib/edje/efl_canvas_layout_internal_box.eo \ + lib/edje/efl_canvas_layout_internal_table.eo edje_eolian_c = $(edje_eolian_files:%.eo=%.eo.c) edje_eolian_h = $(edje_eolian_files:%.eo=%.eo.h) \ diff --git a/src/lib/edje/Edje_Legacy.h b/src/lib/edje/Edje_Legacy.h index 0e5916a..89393b3 100644 --- a/src/lib/edje/Edje_Legacy.h +++ b/src/lib/edje/Edje_Legacy.h @@ -442,5 +442,75 @@ EAPI Evas_Object *edje_object_part_box_remove(Edje_Object *obj, const char *part */ EAPI Eina_Bool edje_object_part_box_remove_all(Edje_Object *obj, const char *part, Eina_Bool clear); +/** + * @brief Packs an object into the table. + * + * Packs an object into the table indicated by part. + * + * @param[in] child_obj The object to pack in + * @param[in] col The column to place it in + * @param[in] row The row to place it in + * @param[in] colspan Columns the child will take + * @param[in] rowspan Rows the child will take + * + * @return @c true object was added, @c false on failure + * + * @ingroup Edje_Object + */ +EAPI Eina_Bool edje_object_part_table_pack(Edje_Object *obj, const char *part, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan); + +/** + * @brief Removes an object from the table. + * + * Removes an object from the table indicated by part. + * + * @param[in] child_obj The object to pack in + * + * @return @c true object removed, @c false on failure + * + * @ingroup Edje_Object + */ +EAPI Eina_Bool edje_object_part_table_unpack(Edje_Object *obj, const char *part, Evas_Object *child_obj); + +/** + * @brief Gets the number of columns and rows the table has. + * + * Retrieves the size of the table in number of columns and rows. + * + * @param[out] cols Pointer where to store number of columns (can be @c null) + * @param[out] rows Pointer where to store number of rows (can be @c null) + * + * @return @c true get some data, @c false on failure + * + * @ingroup Edje_Object + */ +EAPI Eina_Bool edje_object_part_table_col_row_size_get(const Edje_Object *obj, const char *part, int *cols, int *rows); + +/** + * @brief Retrieve a child from a table + * + * @param[in] col The column of the child to get + * @param[in] row The row of the child to get + * + * @return The child Evas.Object + * + * @ingroup Edje_Object + */ +EAPI Evas_Object *edje_object_part_table_child_get(const Edje_Object *obj, const char *part, unsigned int col, unsigned int row); + +/** + * @brief Removes all object from the table. + * + * Removes all object from the table indicated by part, except the internal + * ones set from the theme. + * + * @param[in] clear If set, will delete subobjs on remove + * + * @return @c true clear the table, @c false on failure + * + * @ingroup Edje_Object + */ +EAPI Eina_Bool edje_object_part_table_clear(Edje_Object *obj, const char *part, Eina_Bool clear); + #include "edje_object.eo.legacy.h" #include "edje_edit.eo.legacy.h" diff --git a/src/lib/edje/edje_containers.c b/src/lib/edje/edje_containers.c index e25509d..89bf2f7 100644 --- a/src/lib/edje/edje_containers.c +++ b/src/lib/edje/edje_containers.c @@ -1,25 +1,29 @@ #include "edje_private.h" #define EFL_CANVAS_LAYOUT_INTERNAL_BOX_PROTECTED +#define EFL_CANVAS_LAYOUT_INTERNAL_TABLE_PROTECTED #include "efl_canvas_layout_internal_box.eo.h" +#include "efl_canvas_layout_internal_table.eo.h" + #include "../evas/canvas/evas_box.eo.h" -#include "../evas/canvas/evas_line.eo.h" -#include "../evas/canvas/evas_text.eo.h" +#include "../evas/canvas/evas_table.eo.h" -#define BOX_CLASS EFL_CANVAS_LAYOUT_INTERNAL_BOX_CLASS +#define BOX_CLASS EFL_CANVAS_LAYOUT_INTERNAL_BOX_CLASS +#define TABLE_CLASS EFL_CANVAS_LAYOUT_INTERNAL_TABLE_CLASS -typedef struct _Edje_Box_Data Edje_Box_Data; -typedef struct _Box_Item_Iterator Box_Item_Iterator; +typedef struct _Edje_Part_Data Edje_Box_Data; +typedef struct _Edje_Part_Data Edje_Table_Data; +typedef struct _Part_Item_Iterator Part_Item_Iterator; -struct _Edje_Box_Data +struct _Edje_Part_Data { Edje *ed; Edje_Real_Part *rp; const char *part; }; -struct _Box_Item_Iterator +struct _Part_Item_Iterator { Eina_Iterator iterator; Eina_List *list; @@ -169,10 +173,11 @@ _efl_canvas_layout_internal_box_efl_pack_linear_content_index_get(Eo *obj EINA_U /* this iterator is the same as efl_ui_box */ static Eina_Bool -_box_item_iterator_next(Box_Item_Iterator *it, void **data) +_part_item_iterator_next(Part_Item_Iterator *it, void **data) { Efl_Gfx_Base *sub; + if (!it->object) return EINA_FALSE; if (!eina_iterator_next(it->real_iterator, (void **) &sub)) return EINA_FALSE; @@ -181,52 +186,270 @@ _box_item_iterator_next(Box_Item_Iterator *it, void **data) } static Eo * -_box_item_iterator_get_container(Box_Item_Iterator *it) +_part_item_iterator_get_container(Part_Item_Iterator *it) { return it->object; } static void -_box_item_iterator_free(Box_Item_Iterator *it) +_part_item_iterator_free(Part_Item_Iterator *it) { eina_iterator_free(it->real_iterator); - eina_list_free(it->list); - eo_unref(it->object); + eo_wref_del(it->object, &it->object); free(it); } -EOLIAN static Eina_Iterator * -_efl_canvas_layout_internal_box_efl_container_content_iterate(Eo *obj, Edje_Box_Data *pd) +static Eina_Iterator * +_part_item_iterator_create(Eo *obj, Eina_Iterator *real_iterator) { - Box_Item_Iterator *it; - - if (!pd->rp->typedata.container) return NULL; + Part_Item_Iterator *it; it = calloc(1, sizeof(*it)); if (!it) return NULL; EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR); - it->list = evas_object_box_children_get(pd->rp->object); - it->real_iterator = eina_list_iterator_new(it->list); + it->real_iterator = real_iterator; it->iterator.version = EINA_ITERATOR_VERSION; - it->iterator.next = FUNC_ITERATOR_NEXT(_box_item_iterator_next); - it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_box_item_iterator_get_container); - it->iterator.free = FUNC_ITERATOR_FREE(_box_item_iterator_free); - it->object = eo_ref(obj); + it->iterator.next = FUNC_ITERATOR_NEXT(_part_item_iterator_next); + it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_part_item_iterator_get_container); + it->iterator.free = FUNC_ITERATOR_FREE(_part_item_iterator_free); + eo_wref_add(obj, &it->object); return &it->iterator; } +EOLIAN static Eina_Iterator * +_efl_canvas_layout_internal_box_efl_container_content_iterate(Eo *obj, Edje_Box_Data *pd) +{ + Eina_Iterator *it; + + if (!pd->rp->typedata.container) return NULL; + it = evas_object_box_iterator_new(pd->rp->object); + + return _part_item_iterator_create(obj, it); +} + EOLIAN static int _efl_canvas_layout_internal_box_efl_container_content_count(Eo *obj EINA_UNUSED, Edje_Box_Data *pd) { - if (!pd->rp->typedata.container) return 0; return evas_obj_box_count(pd->rp->object); } +EOLIAN static Efl_Orient +_efl_canvas_layout_internal_box_efl_pack_linear_direction_get(Eo *obj EINA_UNUSED, Edje_Box_Data *pd) +{ + const Edje_Part_Description_Box *desc = + (Edje_Part_Description_Box *) pd->rp->chosen_description; + + if (!desc || !desc->box.layout) + return EFL_ORIENT_NONE; + + if (!strncmp(desc->box.layout, "vertical", 8)) + return EFL_ORIENT_VERTICAL; + else if (!strncmp(desc->box.layout, "horizontal", 10)) + return EFL_ORIENT_HORIZONTAL; + + WRN("unknown orientation '%s'", desc->box.layout); + return EFL_ORIENT_NONE; +} + +/* Table */ + +Eo * +_edje_table_internal_proxy_get(Edje_Object *obj, Edje *ed, Edje_Real_Part *rp) +{ + Efl_Canvas_Layout_Internal_Box *eo = rp->typedata.container->eo_proxy; + + if (eo) return eo; + + eo = eo_add(TABLE_CLASS, obj, efl_canvas_layout_internal_table_real_part_set(eo_self, ed, rp, rp->part->name)); + eo_event_callback_add(eo, EO_BASE_EVENT_DEL, _del_cb, rp); + + rp->typedata.container->eo_proxy = eo; + return eo; +} + +EOLIAN static void +_efl_canvas_layout_internal_table_real_part_set(Eo *obj EINA_UNUSED, Edje_Table_Data *pd, void *ed, void *rp, const char *part) +{ + pd->ed = ed; + pd->rp = rp; + pd->part = part; +} + +EOLIAN static Eo_Base * +_efl_canvas_layout_internal_table_eo_base_finalize(Eo *obj, Edje_Table_Data *pd) +{ + EINA_SAFETY_ON_FALSE_RETURN_VAL(pd->rp && pd->ed && pd->part, NULL); + return eo_finalize(eo_super(obj, TABLE_CLASS)); +} + +EOLIAN static Eina_Iterator * +_efl_canvas_layout_internal_table_efl_container_content_iterate(Eo *obj, Edje_Table_Data *pd) +{ + Eina_Iterator *it; + + if (!pd->rp->typedata.container) return NULL; + it = evas_object_table_iterator_new(pd->rp->object); + + return _part_item_iterator_create(obj, it); +} + +EOLIAN static int +_efl_canvas_layout_internal_table_efl_container_content_count(Eo *obj EINA_UNUSED, Edje_Table_Data *pd) +{ + return evas_obj_table_count(pd->rp->object); +} + +EOLIAN static Eina_Bool +_efl_canvas_layout_internal_table_efl_container_content_remove(Eo *obj, Edje_Table_Data *pd EINA_UNUSED, Efl_Gfx_Base *content) +{ + return efl_pack_unpack(obj, content); +} + +EOLIAN static void +_efl_canvas_layout_internal_table_efl_pack_pack_clear(Eo *obj EINA_UNUSED, Edje_Table_Data *pd) +{ + _edje_part_table_clear(pd->ed, pd->part, EINA_TRUE); +} + +EOLIAN static void +_efl_canvas_layout_internal_table_efl_pack_unpack_all(Eo *obj EINA_UNUSED, Edje_Table_Data *pd) +{ + _edje_part_table_clear(pd->ed, pd->part, EINA_FALSE); +} + +EOLIAN static Eina_Bool +_efl_canvas_layout_internal_table_efl_pack_unpack(Eo *obj EINA_UNUSED EINA_UNUSED, Edje_Table_Data *pd, Efl_Gfx_Base *subobj) +{ + return _edje_part_table_unpack(pd->ed, pd->part, subobj); +} + +EOLIAN static void +_efl_canvas_layout_internal_table_efl_pack_grid_pack_grid(Eo *obj EINA_UNUSED, Edje_Table_Data *pd, Efl_Gfx_Base *subobj, int col, int row, int colspan, int rowspan) +{ + _edje_part_table_pack(pd->ed, pd->part, subobj, col, row, colspan, rowspan); +} + +EOLIAN static Efl_Gfx_Base * +_efl_canvas_layout_internal_table_efl_pack_grid_grid_content_at(Eo *obj EINA_UNUSED, Edje_Table_Data *pd, int col, int row) +{ + return _edje_part_table_child_get(pd->ed, pd->part, col, row); +} + +EOLIAN static void +_efl_canvas_layout_internal_table_efl_pack_grid_grid_size_get(Eo *obj EINA_UNUSED, Edje_Table_Data *pd, int *cols, int *rows) +{ + _edje_part_table_col_row_size_get(pd->ed, pd->part, cols, rows); +} + +EOLIAN static int +_efl_canvas_layout_internal_table_efl_pack_grid_grid_columns_get(Eo *obj EINA_UNUSED, Edje_Table_Data *pd) +{ + int cols = 0, rows = 0; + _edje_part_table_col_row_size_get(pd->ed, pd->part, &cols, &rows); + return cols; +} + +EOLIAN static int +_efl_canvas_layout_internal_table_efl_pack_grid_grid_rows_get(Eo *obj EINA_UNUSED, Edje_Table_Data *pd) +{ + int cols = 0, rows = 0; + _edje_part_table_col_row_size_get(pd->ed, pd->part, &cols, &rows); + return rows; +} + +/* New table apis with eo */ + +static Eina_Bool +_table_item_iterator_next(Part_Item_Iterator *it, void **data) +{ + Efl_Gfx_Base *sub; + + if (!it->object) return EINA_FALSE; + if (!eina_iterator_next(it->real_iterator, (void **) &sub)) + return EINA_FALSE; + + if (data) *data = sub; + return EINA_TRUE; +} + +static Eo * +_table_item_iterator_get_container(Part_Item_Iterator *it) +{ + return it->object; +} + +static void +_table_item_iterator_free(Part_Item_Iterator *it) +{ + eina_iterator_free(it->real_iterator); + eina_list_free(it->list); + eo_wref_del(it->object, &it->object); + free(it); +} + +EOLIAN static Eina_Iterator * +_efl_canvas_layout_internal_table_efl_pack_grid_grid_content_iterate(Eo *obj EINA_UNUSED, Edje_Table_Data *pd, int col, int row, Eina_Bool below) +{ + Evas_Object *sobj; + Eina_Iterator *it; + Part_Item_Iterator *pit; + Eina_List *list = NULL; + unsigned short c, r, cs, rs; + + /* FIXME: terrible performance because there is no proper evas table api */ + + it = evas_object_table_iterator_new(pd->rp->object); + EINA_ITERATOR_FOREACH(it, sobj) + { + evas_object_table_pack_get(pd->rp->object, sobj, &c, &r, &cs, &rs); + if (((int) c == col) && ((int) r == row)) + list = eina_list_append(list, sobj); + else if (below) + { + if (((int) c <= col) && ((int) (c + cs) >= col) && + ((int) r <= row) && ((int) (r + rs) >= row)) + list = eina_list_append(list, sobj); + } + } + eina_iterator_free(it); + + pit = calloc(1, sizeof(*pit)); + if (!pit) return NULL; + + EINA_MAGIC_SET(&pit->iterator, EINA_MAGIC_ITERATOR); + + pit->list = list; + pit->real_iterator = eina_list_iterator_new(pit->list); + pit->iterator.version = EINA_ITERATOR_VERSION; + pit->iterator.next = FUNC_ITERATOR_NEXT(_table_item_iterator_next); + pit->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_table_item_iterator_get_container); + pit->iterator.free = FUNC_ITERATOR_FREE(_table_item_iterator_free); + eo_wref_add(obj, &pit->object); + + return &pit->iterator; +} + +EOLIAN static Eina_Bool +_efl_canvas_layout_internal_table_efl_pack_grid_grid_content_position_get(Eo *obj EINA_UNUSED, Edje_Table_Data *pd, Efl_Gfx_Base * subobj, int *col, int *row, int *colspan, int *rowspan) +{ + unsigned short c, r, cs, rs; + Eina_Bool ret; + + ret = evas_object_table_pack_get(pd->rp->object, subobj, &c, &r, &cs, &rs); + if (col) *col = c; + if (row) *row = r; + if (colspan) *colspan = cs; + if (rowspan) *rowspan = rs; + + return ret; +} + /* Legacy API implementation */ +#ifdef DEGUG #define PART_BOX_GET(obj, part, ...) ({ \ Eo *__box = efl_content_get(obj, part); \ if (!__box || !eo_isa(__box, EFL_CANVAS_LAYOUT_INTERNAL_BOX_CLASS)) \ @@ -235,6 +458,12 @@ _efl_canvas_layout_internal_box_efl_container_content_count(Eo *obj EINA_UNUSED, return __VA_ARGS__; \ } \ __box; }) +#else +#define PART_BOX_GET(obj, part, ...) ({ \ + Eo *__box = efl_content_get(obj, part); \ + if (!__box) return __VA_ARGS__; \ + __box; }) +#endif EAPI Eina_Bool edje_object_part_box_append(Edje_Object *obj, const char *part, Evas_Object *child) @@ -301,4 +530,62 @@ edje_object_part_box_remove_all(Edje_Object *obj, const char *part, Eina_Bool cl return EINA_TRUE; } +#ifdef DEBUG +#define PART_TABLE_GET(obj, part, ...) ({ \ + Eo *__table = efl_content_get(obj, part); \ + if (!__table || !eo_isa(__table, EFL_CANVAS_LAYOUT_INTERNAL_TABLE_CLASS)) \ + { \ + ERR("No such table part '%s' in layout %p", part, obj); \ + return __VA_ARGS__; \ + } \ + __table; }) +#else +#define PART_TABLE_GET(obj, part, ...) ({ \ + Eo *__table = efl_content_get(obj, part); \ + if (!__table) return __VA_ARGS__; \ + __table; }) +#endif + +EAPI Eina_Bool +edje_object_part_table_pack(Edje_Object *obj, const char *part, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan) +{ + Eo *table = PART_TABLE_GET(obj, part, EINA_FALSE); + efl_pack_grid(table, child_obj, col, row, colspan, rowspan); + return EINA_TRUE; +} + +EAPI Eina_Bool +edje_object_part_table_col_row_size_get(const Edje_Object *obj, const char *part, int *cols, int *rows) +{ + Eo *table = PART_TABLE_GET(obj, part, EINA_FALSE); + efl_pack_grid_size_get(table, cols, rows); + return EINA_TRUE; +} + +EAPI Evas_Object * +edje_object_part_table_child_get(const Edje_Object *obj, const char *part, unsigned int col, unsigned int row) +{ + Eo *table = PART_TABLE_GET(obj, part, NULL); + return efl_pack_grid_content_at(table, col, row); +} + +EAPI Eina_Bool +edje_object_part_table_unpack(Edje_Object *obj, const char *part, Evas_Object *child_obj) +{ + Eo *table = PART_TABLE_GET(obj, part, EINA_FALSE); + return efl_pack_unpack(table, child_obj); +} + +EAPI Eina_Bool +edje_object_part_table_clear(Edje_Object *obj, const char *part, Eina_Bool clear) +{ + Eo *table = PART_TABLE_GET(obj, part, EINA_FALSE); + if (clear) + efl_pack_clear(table); + else + efl_pack_unpack_all(table); + return EINA_TRUE; +} + #include "efl_canvas_layout_internal_box.eo.c" +#include "efl_canvas_layout_internal_table.eo.c" diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo index 7930cd9..ae559fb 100644 --- a/src/lib/edje/edje_object.eo +++ b/src/lib/edje/edje_object.eo @@ -422,18 +422,6 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File, Efl.Container) maxh: Evas.Coord; [[Pointer to a variable where to store the maximum height]] } } - part_table_clear { - [[Removes all object from the table. - - Removes all object from the table indicated by part, except the - internal ones set from the theme.]] - - return: bool; [[$true clear the table, $false on failure]] - params { - @in part: const(char)*; [[The part name]] - @in clear: bool; [[If set, will delete subobjs on remove]] - } - } part_external_param_type_get @const { [[Facility to query the type of the given parameter of the given part.]] @@ -652,17 +640,6 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File, Efl.Container) @out ch: Evas.Coord; [[Item height return]] } } - part_table_unpack { - [[Removes an object from the table. - - Removes an object from the table indicated by part.]] - - return: bool; [[$true object removed, $false on failure]] - params { - @in part: const(char)*; [[The part name]] - @in child_obj: Evas.Object *; [[The object to pack in]] - } - } part_text_select_abort @const { [[Aborts any selection action on a part.]] params { @@ -884,21 +861,6 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File, Efl.Container) @in part: const(char)*; [[The part name]] } } - part_table_pack { - [[Packs an object into the table. - - Packs an object into the table indicated by part.]] - - return: bool; [[$true object was added, $false on failure]] - params { - @in part: const(char)*; [[The part name]] - @in child_obj: Evas.Object *; [[The object to pack in]] - @in col: ushort; [[The column to place it in]] - @in row: ushort; [[The row to place it in]] - @in colspan: ushort; [[Columns the child will take]] - @in rowspan: ushort; [[Rows the child will take]] - } - } part_text_input_panel_language_set { [[Set the language mode of the input panel. @@ -922,17 +884,6 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File, Efl.Container) @in part: const(char)*; [[The part name]] } } - part_table_col_row_size_get @const { - [[Gets the number of columns and rows the table has. - - Retrieves the size of the table in number of columns and rows.]] - return: bool; [[$true get some data, $false on failure]] - params { - @in part: const(char)*; [[The part name]] - @out cols: int; [[Pointer where to store number of columns (can be $null)]] - @out rows: int; [[Pointer where to store number of rows (can be $null)]] - } - } part_external_object_get @const { [[Get the object created by this external part. @@ -1157,7 +1108,7 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File, Efl.Container) Note: If the type of Edje part is GROUP, SWALLOW or EXTERNAL, returned handle by this function will indicate nothing or transparent - rectangle for events. Use @.part_swallow_get() in that case.]] + rectangle for events. Use $.part_swallow_get() in that case.]] return: const(Evas.Object)*; [[A pointer to the Evas object implementing the given part, or $null on failure (e.g. the given part doesn't exist)]] params { @@ -1501,16 +1452,6 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File, Efl.Container) @in part: const(char)*; [[The part name]] } } - part_table_child_get @const { - [[Retrieve a child from a table]] - - return: Evas.Object *; [[The child Evas.Object]] - params { - @in part: const(char)*; [[The part name]] - @in col: uint; [[The column of the child to get]] - @in row: uint; [[The row of the child to get]] - } - } part_external_param_set { [[Set the parameter for the external part. diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 1e0f420..4681476 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -2941,7 +2941,7 @@ void _edje_part_ignore_flags_set(Edje *ed, Edje_Real_Part *rp, Evas_Event_Flags Evas_Event_Flags _edje_part_mask_flags_get(Edje *ed, Edje_Real_Part *rp); void _edje_part_mask_flags_set(Edje *ed, Edje_Real_Part *rp, Evas_Event_Flags mask_flags); -/* part containers */ +/* part containers: box */ Eo *_edje_box_internal_proxy_get(Edje_Object *obj, Edje *ed, Edje_Real_Part *rp); Eina_Bool _edje_part_box_append(Edje *ed, const char *part, Evas_Object *child); Eina_Bool _edje_part_box_prepend(Edje *ed, const char *part, Evas_Object *child); @@ -2953,6 +2953,14 @@ Evas_Object *_edje_part_box_remove(Edje *ed, const char *part, Evas_Object *chil Evas_Object *_edje_part_box_remove_at(Edje *ed, const char *part, unsigned int pos); Eina_Bool _edje_part_box_remove_all(Edje *ed, const char *part, Eina_Bool clear); +/* part containers: table */ +Eo *_edje_table_internal_proxy_get(Edje_Object *obj, Edje *ed, Edje_Real_Part *rp); +Evas_Object *_edje_part_table_child_get(Edje *ed, const char *part, unsigned int col, unsigned int row); +Eina_Bool _edje_part_table_pack(Edje *ed, const char *part, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan); +Eina_Bool _edje_part_table_unpack(Edje *ed, const char *part, Evas_Object *child_obj); +Eina_Bool _edje_part_table_col_row_size_get(Edje *ed, const char *part, int *cols, int *rows); +Eina_Bool _edje_part_table_clear(Edje *ed, const char *part, Eina_Bool clear); + #ifdef HAVE_LIBREMIX #include #endif diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 223c0b1..f8430fe 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -3893,7 +3893,11 @@ _edje_object_efl_container_content_get(Eo *obj, Edje *ed, const char *part) if (!rp->typedata.swallow) return NULL; return rp->typedata.swallow->swallowed_object; case EDJE_RP_TYPE_CONTAINER: - return _edje_box_internal_proxy_get(obj, ed, rp); + if (rp->part->type == EDJE_PART_TYPE_BOX) + return _edje_box_internal_proxy_get(obj, ed, rp); + else if (rp->part->type == EDJE_PART_TYPE_TABLE) + return _edje_table_internal_proxy_get(obj, ed, rp); + else return NULL; case EDJE_RP_TYPE_TEXT: WRN("not implemented yet"); return NULL; @@ -5284,8 +5288,8 @@ _edje_real_part_box_remove_all(Edje *ed, Edje_Real_Part *rp, Eina_Bool clear) return EINA_TRUE; } -EOLIAN Evas_Object * -_edje_object_part_table_child_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part, unsigned int col, unsigned int row) +Evas_Object * +_edje_part_table_child_get(Edje *ed, const char *part, unsigned int col, unsigned int row) { Edje_Real_Part *rp; @@ -5298,8 +5302,8 @@ _edje_object_part_table_child_get(Eo *obj EINA_UNUSED, Edje *ed, const char *par return evas_object_table_child_get(rp->object, col, row); } -EOLIAN Eina_Bool -_edje_object_part_table_pack(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan) +Eina_Bool +_edje_part_table_pack(Edje *ed, const char *part, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan) { Eina_Bool ret; Edje_Real_Part *rp; @@ -5330,8 +5334,8 @@ _edje_object_part_table_pack(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Ev return ret; } -EOLIAN Eina_Bool -_edje_object_part_table_unpack(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Evas_Object *child_obj) +Eina_Bool +_edje_part_table_unpack(Edje *ed, const char *part, Evas_Object *child_obj) { Eina_Bool ret; Edje_Real_Part *rp; @@ -5362,8 +5366,8 @@ _edje_object_part_table_unpack(Eo *obj EINA_UNUSED, Edje *ed, const char *part, return ret; } -EOLIAN Eina_Bool -_edje_object_part_table_col_row_size_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part, int *cols, int *rows) +Eina_Bool +_edje_part_table_col_row_size_get(Edje *ed, const char *part, int *cols, int *rows) { Edje_Real_Part *rp; @@ -5378,8 +5382,8 @@ _edje_object_part_table_col_row_size_get(Eo *obj EINA_UNUSED, Edje *ed, const ch return EINA_TRUE; } -EOLIAN Eina_Bool -_edje_object_part_table_clear(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Eina_Bool clear) +Eina_Bool +_edje_part_table_clear(Edje *ed, const char *part, Eina_Bool clear) { Edje_Real_Part *rp; diff --git a/src/lib/edje/efl_canvas_layout_internal_box.eo b/src/lib/edje/efl_canvas_layout_internal_box.eo index a8443d3..eba515c 100644 --- a/src/lib/edje/efl_canvas_layout_internal_box.eo +++ b/src/lib/edje/efl_canvas_layout_internal_box.eo @@ -34,5 +34,6 @@ class Efl.Canvas.Layout_Internal.Box (Eo.Base, Efl.Pack_Linear) Efl.Pack_Linear.content_at.get; Efl.Pack_Linear.content_at_remove; Efl.Pack_Linear.content_index.get; + Efl.Pack_Linear.direction.get; } } diff --git a/src/lib/edje/efl_canvas_layout_internal_table.eo b/src/lib/edje/efl_canvas_layout_internal_table.eo new file mode 100644 index 0000000..09a6f5c --- /dev/null +++ b/src/lib/edje/efl_canvas_layout_internal_table.eo @@ -0,0 +1,36 @@ +class Efl.Canvas.Layout_Internal.Table (Eo.Base, Efl.Pack_Grid) +{ + [[Represents a Table created as part of a layout. + + Can not be deleted, this is only a representation of an internal object + of an EFL layout. + ]] + legacy_prefix: null; + data: Edje_Table_Data; + methods { + @property real_part @protected { + set {} + values { + ed: void*; + rp: void*; + part: const(char)*; + } + } + } + implements { + Eo.Base.finalize; + Efl.Container.content_iterate; + Efl.Container.content_count; + Efl.Container.content_remove; + Efl.Pack.pack_clear; + Efl.Pack.unpack_all; + Efl.Pack.unpack; + Efl.Pack_Grid.pack_grid; + Efl.Pack_Grid.grid_content_at; + Efl.Pack_Grid.grid_content_iterate; + Efl.Pack_Grid.grid_content_position.get; + Efl.Pack_Grid.grid_size.get; + Efl.Pack_Grid.grid_columns.get; + Efl.Pack_Grid.grid_rows.get; + } +} diff --git a/src/lib/evas/canvas/evas_object_table.c b/src/lib/evas/canvas/evas_object_table.c index 60a83fd..6966e22 100644 --- a/src/lib/evas/canvas/evas_object_table.c +++ b/src/lib/evas/canvas/evas_object_table.c @@ -1373,6 +1373,12 @@ _evas_table_children_get(Eo *o EINA_UNUSED, Evas_Table_Data *priv) return new_list; } +EOLIAN static int +_evas_table_count(Eo *o EINA_UNUSED, Evas_Table_Data *priv) +{ + return eina_list_count(priv->children); +} + EOLIAN static Evas_Object * _evas_table_child_get(Eo *o EINA_UNUSED, Evas_Table_Data *priv, unsigned short col, unsigned short row) { diff --git a/src/lib/evas/canvas/evas_table.eo b/src/lib/evas/canvas/evas_table.eo index a401970..897ea9b 100644 --- a/src/lib/evas/canvas/evas_table.eo +++ b/src/lib/evas/canvas/evas_table.eo @@ -207,6 +207,11 @@ class Evas.Table (Evas.Smart_Clipped) @in child: Evas.Object * @nonull; } } + count { + [[Returns the number of items in the box.]] + legacy: null; + return: int; + } } implements { class.constructor; -- 2.7.4