edje: Edje_Edit - add functions to provide the ability to set and get the values of step parameter in parts state description

Summary:
This commit contains two new functions that provide the ability to set and
get the values of step parameter in parts state description. Also the printing of step value
on code generation is added.

Reviewers: cedric, Hermet, seoz, raster

CC: reutskiy.v.v, cedric

Differential Revision: https://phab.enlightenment.org/D1032

Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
This commit is contained in:
Kateryna Fesyna 2014-06-13 17:54:52 +02:00 committed by Cedric BAIL
parent 1d52065438
commit a06279e4ef
2 changed files with 55 additions and 1 deletions

View File

@ -2773,6 +2773,41 @@ EAPI Eina_Bool edje_edit_state_external_param_string_set(Evas_Object *obj, const
*/
EAPI Eina_Bool edje_edit_state_external_param_choice_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, const char *val);
/** Set the states step parameter values.
*
* Step parameter restricts resizing of each dimension to values divisibles by
* its value. This causes the part to jump from value to value while resizing.
* The default value is "0 0" disabling stepping.
*
* @param obj Object being edited.
* @param part Part that contain state.
* @param state The name of the state to set fill horizontal size
* relative value (not including the state value).
* @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_step_get()
*/
EAPI Eina_Bool edje_edit_state_step_set(Evas_Object *obj, const char *part, const char *state, double value, int step_x, int step_y);
/** Get the states step values.
*
* @param obj Object being edited.
* @param part Part that contain state.
* @param state The name of the state to set fill horizontal size
* relative value (not including the state value).
* @param value The state value.
* @param x The pointer to the variable where horizontal step value should be written.
* @param y The pointer to the variable where vertical step value should be written.
*
* @return EINA_TRUE in case of success, EINA_FALSE otherwise.
* @see edje_edit_state_step_set()
*/
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);
//@}
/******************************************************************************/

View File

@ -5166,6 +5166,24 @@ edje_edit_state_external_param_choice_set(Evas_Object *obj, const char *part, co
return edje_edit_state_external_param_set(obj, part, state, value, param, EDJE_EXTERNAL_PARAM_TYPE_CHOICE, val);
}
EAPI Eina_Bool
edje_edit_state_step_set(Evas_Object *obj, const char *part, const char *state, double value, int step_x, int step_y)
{
GET_PD_OR_RETURN(EINA_FALSE);
pd->step.x = step_x;
pd->step.y = step_y;
return EINA_TRUE;
}
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)
{
GET_PD_OR_RETURN(EINA_FALSE);
if (step_x) *step_x = (int)pd->step.x;
if (step_y) *step_y = (int)pd->step.y;
return EINA_TRUE;
}
/**************/
/* TEXT API */
/**************/
@ -8586,7 +8604,8 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s
if (pd->minmul.w != 0 || pd->minmul.h != 0)
BUF_APPENDF(I5"minmul: %g %g;\n", TO_DOUBLE(pd->minmul.w), TO_DOUBLE(pd->minmul.h));
//TODO Support step
if (pd->step.x && pd->step.y)
BUF_APPENDF(I5"step: %d %d;\n", TO_INT(pd->step.x), TO_INT(pd->step.y));
if (pd->aspect.min || pd->aspect.max)
BUF_APPENDF(I5"aspect: %g %g;\n", TO_DOUBLE(pd->aspect.min), TO_DOUBLE(pd->aspect.max));