From: tasn Date: Tue, 1 Feb 2011 12:50:59 +0000 (+0000) Subject: Evas table: Added "mirrored mode" to table. This is important for ui mirroring and... X-Git-Tag: submit/trunk/20120815.174732~1967 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0d4eea68307be437091614627b7ca22da3b6ebb7;p=profile%2Fivi%2Fevas.git Evas table: Added "mirrored mode" to table. This is important for ui mirroring and let users do cooler stuff. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@56633 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/Evas.h b/src/lib/Evas.h index a763bdb..fc4f6cf 100644 --- a/src/lib/Evas.h +++ b/src/lib/Evas.h @@ -2075,6 +2075,8 @@ struct _Evas_Smart_Cb_Description EAPI void evas_object_table_padding_get (const Evas_Object *o, Evas_Coord *horizontal, Evas_Coord *vertical) EINA_ARG_NONNULL(1); EAPI void evas_object_table_align_set (Evas_Object *o, double horizontal, double vertical) EINA_ARG_NONNULL(1); EAPI void evas_object_table_align_get (const Evas_Object *o, double *horizontal, double *vertical) EINA_ARG_NONNULL(1); + EAPI void evas_object_table_mirrored_set (Evas_Object *o, Eina_Bool mirrored) EINA_ARG_NONNULL(1); + EAPI Eina_Bool evas_object_table_mirrored_get (const Evas_Object *o) EINA_ARG_NONNULL(1); 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); EAPI Eina_Bool evas_object_table_unpack (Evas_Object *o, Evas_Object *child) EINA_ARG_NONNULL(1, 2); diff --git a/src/lib/canvas/evas_object_table.c b/src/lib/canvas/evas_object_table.c index 2d8e056..d270200 100644 --- a/src/lib/canvas/evas_object_table.c +++ b/src/lib/canvas/evas_object_table.c @@ -62,6 +62,7 @@ struct _Evas_Object_Table_Data Eina_Bool hints_changed : 1; Eina_Bool expand_h : 1; Eina_Bool expand_v : 1; + Eina_Bool is_mirrored : 1; }; struct _Evas_Object_Table_Iterator @@ -515,7 +516,14 @@ _evas_object_table_calculate_layout_homogeneous(Evas_Object *o, Evas_Object_Tabl _evas_object_table_calculate_cell(opt, &cx, &cy, &cw, &ch); - evas_object_move(child, cx, cy); + if (priv->is_mirrored) + { + evas_object_move(opt->obj, x + w - (cx - x + cw), cy); + } + else + { + evas_object_move(child, cx, cy); + } evas_object_resize(child, cw, ch); } } @@ -782,18 +790,25 @@ _evas_object_table_calculate_layout_regular(Evas_Object *o, Evas_Object_Table_Da { Evas_Object *child = opt->obj; Evas_Coord cx, cy, cw, ch; - + cx = x + opt->col * (priv->pad.h); cx += _evas_object_table_sum_sizes(cols, 0, opt->col); cw = _evas_object_table_sum_sizes(cols, opt->col, opt->end_col); - + cy = y + opt->row * (priv->pad.v); cy += _evas_object_table_sum_sizes(rows, 0, opt->row); ch = _evas_object_table_sum_sizes(rows, opt->row, opt->end_row); - + _evas_object_table_calculate_cell(opt, &cx, &cy, &cw, &ch); - - evas_object_move(child, cx, cy); + + if (priv->is_mirrored) + { + evas_object_move(opt->obj, x + w - (cx - x + cw), cy); + } + else + { + evas_object_move(child, cx, cy); + } evas_object_resize(child, cw, ch); } @@ -1378,6 +1393,25 @@ evas_object_table_child_get(const Evas_Object *o, unsigned short col, unsigned s return NULL; } +EAPI Eina_Bool +evas_object_table_mirrored_get(const Evas_Object *obj) +{ + EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN_VAL(obj, priv, EINA_FALSE); + + return priv->is_mirrored; +} + +EAPI void +evas_object_table_mirrored_set(Evas_Object *obj, Eina_Bool mirrored) +{ + EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN(obj, priv); + if (priv->is_mirrored != mirrored) + { + priv->is_mirrored = mirrored; + _evas_object_table_smart_calculate_regular(obj, priv); + } +} + /** * @} */