cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=782b93a65e81224c8d3a1e3a32ecd743a45d8bad
commit 782b93a65e81224c8d3a1e3a32ecd743a45d8bad Author: Kateryna Fesyna <k.fes...@samsung.com> Date: Mon Jun 16 17:01:26 2014 +0200 edje: Edje_Edit - add functions that allow user to set and get the value of states limit property Summary: This commit contains two new functions edje_edit_state_limit_get() and edje_edit_state_limit_set(). These functions allow user to set and get value of states 'limit' property value. Also it provides an internal type to represent limits (Edje_Edit_State_Limit) and implements printing of limits value on edc code generation. Reviewers: cedric, Hermet, seoz, raster CC: reutskiy.v.v, cedric Differential Revision: https://phab.enlightenment.org/D1048 Signed-off-by: Cedric BAIL <c.b...@partner.samsung.com> --- src/lib/edje/Edje_Edit.h | 48 +++++++++++++++++++++++++++++++++++++++++++++ src/lib/edje/edje_edit.c | 39 ++++++++++++++++++++++++++++++++++++ src/lib/edje/edje_private.h | 8 ++++++++ 3 files changed, 95 insertions(+) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 109c2b7..3f46e02 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -3110,6 +3110,54 @@ EAPI Eina_Bool edje_edit_state_step_set(Evas_Object *obj, const char *part, cons EAPI Eina_Bool edje_edit_state_step_get(Evas_Object *obj, const char *part, const char *state, double value, int *step_x, int *step_y); +/** Set the states limit parameter value. + * + * Set limit causes the emission of signals when the the size of part changes + * from zero or to a zero size in corresponding to the limit value. + * For example, the signals emitted on width changing are <i>'limit,width,over'</i> + * and <i>'limit,width,zero'</i> + * The availble values are: + * <ul> + * <li>NONE - 0 (the default value)</li> + * <li>WIDTH - 1</li> + * <li>HEIGHT - 2</li> + * <li>BOTH - 3</li> + * </ul> + * + * @param obj Object being edited. + * @param part Part that contain state. + * @param state The name of the state. + * @param value The state value. + * @param x The horizontal step value. + * @param y The vertical step value. + * + * @return EINA_TRUE in case of success, EINA_FALSE otherwise. + * @see edje_edit_state_limit_get() + * @since 1.11 + */ +EAPI Eina_Bool edje_edit_state_limit_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char limit); + +/** Get the states limit value. + * + * Returns value that represents the states limit value: + * <ul> + * <li>NONE - 0 (the default value)</li> + * <li>WIDTH - 1</li> + * <li>HEIGHT - 2</li> + * <li>BOTH - 3</li> + * </ul> + * + * @param obj Object being edited. + * @param part Part that contain state. + * @param state The name of the state. + * @param value The state value. + * + * @return The value that represents the states limit value in case of success, othervise returns 4. + * @see edje_edit_state_limit_set() + * @since 1.11 + */ +EAPI unsigned char edje_edit_state_limit_get(Evas_Object *obj, const char *part, const char *state, double value); + //@} /******************************************************************************/ diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 8f8800d..be2d945 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -5576,6 +5576,23 @@ edje_edit_state_step_get(Evas_Object *obj, const char *part, const char *state, return EINA_TRUE; } +EAPI Eina_Bool +edje_edit_state_limit_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char limit) +{ + GET_PD_OR_RETURN(EINA_FALSE); + if (limit >= EDJE_STATE_LIMIT_LAST) + return EINA_FALSE; + pd->limit = limit; + return EINA_TRUE; +} + +EAPI unsigned char +edje_edit_state_limit_get(Evas_Object *obj, const char *part, const char *state, double value) +{ + GET_PD_OR_RETURN(EDJE_STATE_LIMIT_LAST); + return pd->limit; +} + /**************/ /* TEXT API */ /**************/ @@ -8945,6 +8962,28 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s if (!pd->visible) BUF_APPEND(I5"visible: 0;\n"); + if (pd->limit) + { + switch (pd->limit) + { + case EDJE_STATE_LIMIT_WIDTH: + { + BUF_APPEND("limit: WIDTH;\n"); + break; + } + case EDJE_STATE_LIMIT_HEIGHT: + { + BUF_APPEND("limit: HEIGHT;\n"); + break; + } + case EDJE_STATE_LIMIT_BOTH: + { + BUF_APPEND("limit: BOTH;\n"); + break; + } + } + } + if (pd->align.x != 0.5 || pd->align.y != 0.5) BUF_APPENDF(I5"align: %g %g;\n", TO_DOUBLE(pd->align.x), TO_DOUBLE(pd->align.y)); diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index bf2fd64..63e2814 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -796,6 +796,14 @@ typedef enum { EDJE_PART_LIMIT_OVER } Edje_Part_Limit_State; +typedef enum { + EDJE_STATE_LIMIT_NONE = 0, + EDJE_STATE_LIMIT_WIDTH = 1, + EDJE_STATE_LIMIT_HEIGHT = 2, + EDJE_STATE_LIMIT_BOTH = 3, + EDJE_STATE_LIMIT_LAST = 4 +} Edje_Edit_State_Limit; + #ifdef HAVE_EPHYSICS typedef enum { EDJE_PART_PHYSICS_BODY_NONE= 0, --