From 58afcdc9ed3507b6702e39103c8860c5805f6e74 Mon Sep 17 00:00:00 2001 From: Yossi Kantor Date: Wed, 2 Apr 2014 10:46:53 +0300 Subject: [PATCH] Eolian: Legacy integration of Evas Table --- src/Makefile_Evas.am | 4 +- src/lib/evas/Evas_Legacy.h | 189 +----------------------- src/lib/evas/canvas/evas_object_table.c | 8 +- src/lib/evas/canvas/evas_table.eo | 15 ++ 4 files changed, 23 insertions(+), 193 deletions(-) diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index c46a420ec2..6f8c5cb58b 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -28,6 +28,7 @@ BUILT_SOURCES += \ lib/evas/canvas/evas_smart_clipped.eo.h \ lib/evas/canvas/evas_table.eo.c \ lib/evas/canvas/evas_table.eo.h \ + lib/evas/canvas/evas_table.eo.legacy.h \ lib/evas/canvas/evas_common_interface.eo.c \ lib/evas/canvas/evas_common_interface.eo.h \ lib/evas/canvas/evas_object.eo.c \ @@ -122,7 +123,8 @@ nodist_installed_evascanvasheaders_DATA = \ lib/evas/canvas/evas_rectangle.eo.legacy.h \ lib/evas/canvas/evas_text.eo.legacy.h \ lib/evas/canvas/evas_textblock.eo.legacy.h \ - lib/evas/canvas/evas_textgrid.eo.legacy.h + lib/evas/canvas/evas_textgrid.eo.legacy.h \ + lib/evas/canvas/evas_table.eo.legacy.h noinst_HEADERS = \ lib/evas/include/evas_inline.x \ diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index d09ee08170..6957ab9743 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -6644,193 +6644,6 @@ EAPI Eina_Bool evas_object_box_option_property_vget(const Evas_ */ EAPI Evas_Object *evas_object_table_add(Evas *evas) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; -/** - * @brief Create a table that is child of a given element @a parent. - * - * @see evas_object_table_add() - */ -EAPI Evas_Object *evas_object_table_add_to(Evas_Object *parent) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; - -/** - * @brief Set how this table should layout children. - * - * @todo consider aspect hint and respect it. - * - * @par EVAS_OBJECT_TABLE_HOMOGENEOUS_NONE - * If table does not use homogeneous mode then columns and rows will - * be calculated based on hints of individual cells. This operation - * mode is more flexible, but more complex and heavy to calculate as - * well. @b Weight properties are handled as a boolean expand. Negative - * alignment will be considered as 0.5. This is the default. - * - * @todo @c EVAS_OBJECT_TABLE_HOMOGENEOUS_NONE should balance weight. - * - * @par EVAS_OBJECT_TABLE_HOMOGENEOUS_TABLE - * When homogeneous is relative to table the own table size is divided - * equally among children, filling the whole table area. That is, if - * table has @c WIDTH and @c COLUMNS, each cell will get WIDTH / - * COLUMNS pixels. If children have minimum size that is larger - * than this amount (including padding), then it will overflow and be - * aligned respecting the alignment hint, possible overlapping sibling - * cells. @b Weight hint is used as a boolean, if greater than zero it - * will make the child expand in that axis, taking as much space as - * possible (bounded to maximum size hint). Negative alignment will be - * considered as 0.5. - * - * @par EVAS_OBJECT_TABLE_HOMOGENEOUS_ITEM - * When homogeneous is relative to item it means the greatest minimum - * cell size will be used. That is, if no element is set to expand, - * the table will have its contents to a minimum size, the bounding - * box of all these children will be aligned relatively to the table - * object using evas_object_table_align_get(). If the table area is - * too small to hold this minimum bounding box, then the objects will - * keep their size and the bounding box will overflow the box area, - * still respecting the alignment. @b Weight hint is used as a - * boolean, if greater than zero it will make that cell expand in that - * axis, toggling the expand mode, which makes the table behave - * much like @b EVAS_OBJECT_TABLE_HOMOGENEOUS_TABLE, except that the - * bounding box will overflow and items will not overlap siblings. If - * no minimum size is provided at all then the table will fallback to - * expand mode as well. - */ -EAPI void evas_object_table_homogeneous_set(Evas_Object *o, Evas_Object_Table_Homogeneous_Mode homogeneous) EINA_ARG_NONNULL(1); - -/** - * Get the current layout homogeneous mode. - * - * @see evas_object_table_homogeneous_set() - */ -EAPI Evas_Object_Table_Homogeneous_Mode evas_object_table_homogeneous_get(const Evas_Object *o) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); - -/** - * Set padding between cells. - */ -EAPI void evas_object_table_padding_set(Evas_Object *o, Evas_Coord horizontal, Evas_Coord vertical) EINA_ARG_NONNULL(1); - -/** - * Get padding between cells. - */ -EAPI void evas_object_table_padding_get(const Evas_Object *o, Evas_Coord *horizontal, Evas_Coord *vertical) EINA_ARG_NONNULL(1); - -/** - * Set the alignment of the whole bounding box of contents. - */ -EAPI void evas_object_table_align_set(Evas_Object *o, double horizontal, double vertical) EINA_ARG_NONNULL(1); - -/** - * Get alignment of the whole bounding box of contents. - */ -EAPI void evas_object_table_align_get(const Evas_Object *o, double *horizontal, double *vertical) EINA_ARG_NONNULL(1); - -/** - * Sets the mirrored mode of the table. In mirrored mode the table items go - * from right to left instead of left to right. That is, 1,1 is top right, not - * top left. - * - * @param o The table object. - * @param mirrored the mirrored mode to set - * @since 1.1 - */ -EAPI void evas_object_table_mirrored_set(Evas_Object *o, Eina_Bool mirrored) EINA_ARG_NONNULL(1); - -/** - * Gets the mirrored mode of the table. - * - * @param o The table object. - * @return @c EINA_TRUE if it's a mirrored table, @c EINA_FALSE otherwise. - * @since 1.1 - * @see evas_object_table_mirrored_set() - */ -EAPI Eina_Bool evas_object_table_mirrored_get(const Evas_Object *o) EINA_ARG_NONNULL(1); - -/** - * Get packing location of a child of table - * - * @param o The given table object. - * @param child The child object to add. - * @param col pointer to store relative-horizontal position to place child. - * @param row pointer to store relative-vertical position to place child. - * @param colspan pointer to store how many relative-horizontal position to use for this child. - * @param rowspan pointer to store how many relative-vertical position to use for this child. - * - * @return 1 on success, 0 on failure. - * @since 1.1 - */ -EAPI Eina_Bool evas_object_table_pack_get(const Evas_Object *o, Evas_Object *child, unsigned short *col, unsigned short *row, unsigned short *colspan, unsigned short *rowspan); - -/** - * Add a new child to a table object or set its current packing. - * - * @param o The given table object. - * @param child The child object to add. - * @param col relative-horizontal position to place child. - * @param row relative-vertical position to place child. - * @param colspan how many relative-horizontal position to use for this child. - * @param rowspan how many relative-vertical position to use for this child. - * - * Note that columns and rows only guarantee 16bit unsigned values at best. - * That means that col + colspan AND row + rowspan must fit inside 16bit - * unsigned values cleanly. You will be warned once values exceed 15bit - * storage, and attempting to use values not able to fit in 16bits will - * result in failure. - * - * @return 1 on success, 0 on failure. - */ -EAPI Eina_Bool evas_object_table_pack(Evas_Object *o, Evas_Object *child, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan) EINA_ARG_NONNULL(1, 2); - -/** - * Remove child from table. - * - * @note removing a child will immediately call a walk over children in order - * to recalculate numbers of columns and rows. If you plan to remove - * all children, use evas_object_table_clear() instead. - * - * @return 1 on success, 0 on failure. - */ -EAPI Eina_Bool evas_object_table_unpack(Evas_Object *o, Evas_Object *child) EINA_ARG_NONNULL(1, 2); - -/** - * Faster way to remove all child objects from a table object. - * - * @param o The given table object. - * @param clear if true, it will delete just removed children. - */ -EAPI void evas_object_table_clear(Evas_Object *o, Eina_Bool clear) EINA_ARG_NONNULL(1); - -/** - * Get the number of columns and rows this table takes. - * - * @note columns and rows are virtual entities, one can specify a table - * with a single object that takes 4 columns and 5 rows. The only - * difference for a single cell table is that paddings will be - * accounted proportionally. - */ -EAPI void evas_object_table_col_row_size_get(const Evas_Object *o, int *cols, int *rows) EINA_ARG_NONNULL(1); - -/** - * Get an iterator to walk the list of children for the table. - * - * @note Do not remove or delete objects while walking the list. - */ -EAPI Eina_Iterator *evas_object_table_iterator_new(const Evas_Object *o) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; - -/** - * Get an accessor to get random access to the list of children for the table. - * - * @note Do not remove or delete objects while walking the list. - */ -EAPI Eina_Accessor *evas_object_table_accessor_new(const Evas_Object *o) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; - -/** - * Get the list of children for the table. - * - * @note This is a duplicate of the list kept by the table internally. - * It's up to the user to destroy it when it no longer needs it. - * It's possible to remove objects from the table when walking this - * list, but these removals won't be reflected on it. - */ -EAPI Eina_List *evas_object_table_children_get(const Evas_Object *o) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; - /** * Get the child of the table at the given coordinates * @@ -6838,6 +6651,8 @@ EAPI Eina_List *evas_object_table_children_get(const Eva */ EAPI Evas_Object *evas_object_table_child_get(const Evas_Object *o, unsigned short col, unsigned short row) EINA_ARG_NONNULL(1); +#include "canvas/evas_table.eo.legacy.h" + /** * @} */ diff --git a/src/lib/evas/canvas/evas_object_table.c b/src/lib/evas/canvas/evas_object_table.c index 42796bc0ed..057836e0a6 100644 --- a/src/lib/evas/canvas/evas_object_table.c +++ b/src/lib/evas/canvas/evas_object_table.c @@ -1354,14 +1354,12 @@ _evas_table_children_get(Eo *o EINA_UNUSED, Evas_Table_Data *priv) return new_list; } -Evas_Object * -evas_object_table_child_get(const Evas_Object *o, unsigned short col, unsigned short row) +EOLIAN static Evas_Object * +_evas_table_child_get(Eo *o EINA_UNUSED, Evas_Table_Data *priv, unsigned short col, unsigned short row) { Eina_List *l; Evas_Object_Table_Option *opt; - EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN_VAL(o, priv, NULL); - EINA_LIST_FOREACH(priv->children, l, opt) if (opt->col == col && opt->row == row) return opt->obj; @@ -1387,7 +1385,7 @@ _evas_table_mirrored_set(Eo *o, Evas_Table_Data *priv, Eina_Bool mirrored) EOLIAN static void _evas_table_class_constructor(Eo_Class *klass) { - evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); + evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); } #include "canvas/evas_table.eo.c" diff --git a/src/lib/evas/canvas/evas_table.eo b/src/lib/evas/canvas/evas_table.eo index 3b19c00799..630f09ce26 100644 --- a/src/lib/evas/canvas/evas_table.eo +++ b/src/lib/evas/canvas/evas_table.eo @@ -133,6 +133,21 @@ class Evas_Table (Evas_Smart_Clipped) return Eina_List * @warn_unused; } } + child { + get { + /*@ + Get the child of the table at the given coordinates + + @note This does not take into account col/row spanning*/ + } + keys { + unsigned short col; + unsigned short row; + } + values { + Evas_Object *child; + } + } } methods { clear {