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.bail@partner.samsung.com>
This commit is contained in:
Kateryna Fesyna 2014-06-16 17:01:26 +02:00 committed by Cedric BAIL
parent 32024b076a
commit 782b93a65e
3 changed files with 95 additions and 0 deletions

View File

@ -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);
//@}
/******************************************************************************/

View File

@ -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));

View File

@ -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,