rimmed pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=dbea1f9f3de8a811a28e9114f9b68ffbad1a2fa2
commit dbea1f9f3de8a811a28e9114f9b68ffbad1a2fa2 Author: Vyacheslav Reutskiy <v.reuts...@samsung.com> Date: Mon Sep 21 16:07:36 2015 +0300 edje: edje_edit - add getters/setters for container align This functions designed that make the edje edit API's more homogeneous. The all edje attribute setters and getters treated only ony attribute, besides container API's. --- src/lib/edje/Edje_Edit.h | 64 ++++++++++++++++++++++++++++++++++++++++++++++-- src/lib/edje/edje_edit.c | 58 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+), 2 deletions(-) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 6026b03..1626716 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -2215,12 +2215,43 @@ edje_edit_state_container_padding_y_set(Evas_Object *obj, const char *part, cons * @param x Variable to store x value. * @param y Variable to store y value. * + * @deprecated Use edje_edit_state_container_align_x_set() and + * edje_edit_state_container_align_y_set() instead. + * * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise. * @since 1.14 */ -EAPI Eina_Bool +EINA_DEPRECATED EAPI Eina_Bool edje_edit_state_container_align_set(Evas_Object *obj, const char *part, const char *state, double value, double x, double y); +/** Set x align for BOX or TABLE part. + * + * @param obj Object being edited. + * @param part Part that has BOX/TABLE type. + * @param state Name of the state. + * @param value Value of the state. + * @param x New x align value. + * + * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise. + * @since 1.16 + */ +EAPI Eina_Bool +edje_edit_state_container_align_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x); + +/** Set y align for BOX or TABLE part. + * + * @param obj Object being edited. + * @param part Part that has BOX/TABLE type. + * @param state Name of the state. + * @param value Value of the state. + * @param y New y align value. + * + * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise. + * @since 1.16 + */ +EAPI Eina_Bool +edje_edit_state_container_align_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y); + /** Get x and y align for BOX or TABLE part. * * @param obj Object being edited. @@ -2230,12 +2261,41 @@ edje_edit_state_container_align_set(Evas_Object *obj, const char *part, const ch * @param x Value for setting x align. * @param y Value for setting y align. * + * @deprecated Use edje_edit_state_container_align_x_set() and + * edje_edit_state_container_align_y_set() instead. + * * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise. * @since 1.14 */ -EAPI Eina_Bool +EINA_DEPRECATED EAPI Eina_Bool edje_edit_state_container_align_get(Evas_Object *obj, const char *part, const char *state, double value, double *x, double *y); +/** Get x align for BOX or TABLE part. + * + * @param obj Object being edited. + * @param part Part that has BOX/TABLE type. + * @param state Name of the state. + * @param value Value of the state. + * + * @return The align by x axis. + * @since 1.16 + */ +EAPI double +edje_edit_state_container_align_x_get(Evas_Object *obj, const char *part, const char *state, double value); + +/** Get y align for BOX or TABLE part. + * + * @param obj Object being edited. + * @param part Part that has BOX/TABLE type. + * @param state Name of the state. + * @param value Value of the state. + * + * @return The align by y axis. + * @since 1.16 + */ +EAPI double +edje_edit_state_container_align_y_get(Evas_Object *obj, const char *part, const char *state, double value); + //@} /******************************************************************************/ /************************** BOX & TABLE ITEMS API *************************/ diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 3b86aac..10a63aa 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -4420,6 +4420,64 @@ FUNC_CONTAINER_INT(padding, y) #undef FUNC_CONTAINER_INT +#define FUNC_CONTAINER_DOUBLE(CLASS, VALUE) \ +EAPI double \ +edje_edit_state_container_##CLASS##_##VALUE##_get(Evas_Object *obj, const char *part, const char *state, double value) \ +{ \ + double val; \ + GET_PD_OR_RETURN(0.0) \ + switch (rp->part->type) \ + { \ + case EDJE_PART_TYPE_TABLE: \ + { \ + Edje_Part_Description_Table *table; \ + table = (Edje_Part_Description_Table *)pd; \ + val = FROM_DOUBLE(table->table.CLASS.VALUE); \ + break; \ + } \ + case EDJE_PART_TYPE_BOX: \ + { \ + Edje_Part_Description_Box *box; \ + box = (Edje_Part_Description_Box *)pd; \ + val = FROM_DOUBLE(box->box.CLASS.VALUE); \ + break; \ + } \ + default: \ + val = 0.0; \ + } \ + return val; \ +} \ +EAPI Eina_Bool \ +edje_edit_state_container_##CLASS##_##VALUE##_set(Evas_Object *obj, const char *part, const char *state, double value, double new_val) \ +{ \ + GET_PD_OR_RETURN(EINA_FALSE) \ + switch (rp->part->type) \ + { \ + case EDJE_PART_TYPE_TABLE: \ + { \ + Edje_Part_Description_Table *table; \ + table = (Edje_Part_Description_Table *)pd; \ + table->table.CLASS.VALUE = TO_DOUBLE(new_val); \ + break; \ + } \ + case EDJE_PART_TYPE_BOX: \ + { \ + Edje_Part_Description_Box *box; \ + box = (Edje_Part_Description_Box *)pd; \ + box->box.CLASS.VALUE = TO_DOUBLE(new_val); \ + break; \ + } \ + default: \ + return EINA_FALSE; \ + } \ + return EINA_TRUE; \ +} + +FUNC_CONTAINER_DOUBLE(align, x) +FUNC_CONTAINER_DOUBLE(align, y) + +#undef FUNC_CONTAINER_DOUBLE + EAPI Eina_Bool edje_edit_state_container_align_get(Evas_Object *obj, const char *part, const char *state, double value, double *x, double *y) { --