From f10ffca9c405162978b65c95283276cb9de3e475 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Thu, 1 Apr 2010 03:48:07 +0000 Subject: [PATCH] handle cases without default values and add missing functions. SVN revision: 47640 --- legacy/edje/src/lib/Edje_Edit.h | 40 +++++++++++++++++++++++++++++++++ legacy/edje/src/lib/edje_edit.c | 32 ++++++++++++++++++++++++-- 2 files changed, 70 insertions(+), 2 deletions(-) diff --git a/legacy/edje/src/lib/Edje_Edit.h b/legacy/edje/src/lib/Edje_Edit.h index 9819b7f654..80a40b858d 100644 --- a/legacy/edje/src/lib/Edje_Edit.h +++ b/legacy/edje/src/lib/Edje_Edit.h @@ -1535,6 +1535,16 @@ edje_edit_state_external_param_int_get( ///@return True if succesful, False if n int *value ); +/**Get external parameter of type BOOL*/ +EAPI Eina_Bool +edje_edit_state_external_param_bool_get( ///@return True if succesful, False if not found or is of different type + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + const char *param, ///< The name of the parameter + Eina_Bool *value +); + /**Get external parameter of type DOUBLE*/ EAPI Eina_Bool edje_edit_state_external_param_double_get( ///@return True if succesful, False if not found or is of different type @@ -1555,6 +1565,16 @@ edje_edit_state_external_param_string_get( ///@return True if succesful, False i const char **value ); +/**Get external parameter of type CHOICE*/ +EAPI Eina_Bool +edje_edit_state_external_param_choice_get( ///@return True if succesful, False if not found or is of different type + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + const char *param, ///< The name of the parameter + const char **value +); + /**Set the external parameter type and value, adding it if it didn't exist before*/ EAPI Eina_Bool edje_edit_state_external_param_set( ///@return True if it was set @@ -1576,6 +1596,16 @@ edje_edit_state_external_param_int_set( ///@return True if it was set int value ); +/**Set external parameter of type BOOL*/ +EAPI Eina_Bool +edje_edit_state_external_param_bool_set( ///@return True if it was set + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + const char *param, ///< The name of the parameter + Eina_Bool value +); + /**Set external parameter of type DOUBLE*/ EAPI Eina_Bool edje_edit_state_external_param_double_set( ///@return True if it was set @@ -1596,6 +1626,16 @@ edje_edit_state_external_param_string_set( ///@return True if it was set const char *value ); +/**Set external parameter of type CHOICE*/ +EAPI Eina_Bool +edje_edit_state_external_param_choice_set( ///@return True if it was set + Evas_Object *obj, ///< The edje object + const char *part, ///< The name of the part + const char *state, ///< The name of the 'part state' (ex. "default 0.00") + const char *param, ///< The name of the parameter + const char *value +); + //@} /******************************************************************************/ diff --git a/legacy/edje/src/lib/edje_edit.c b/legacy/edje/src/lib/edje_edit.c index 9771ed97a4..ccdb6c198b 100644 --- a/legacy/edje/src/lib/edje_edit.c +++ b/legacy/edje/src/lib/edje_edit.c @@ -2655,10 +2655,12 @@ edje_edit_state_add(Evas_Object *obj, const char *part, const char *name) { case EDJE_EXTERNAL_PARAM_TYPE_INT: case EDJE_EXTERNAL_PARAM_TYPE_BOOL: - p->i = pi->info.i.def; + if (pi->info.i.def != EDJE_EXTERNAL_INT_UNSET) + p->i = pi->info.i.def; break; case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: - p->d = pi->info.d.def; + if (pi->info.d.def != EDJE_EXTERNAL_DOUBLE_UNSET) + p->d = pi->info.d.def; break; case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: if (pi->info.c.def) @@ -3659,6 +3661,26 @@ edje_edit_state_external_param_int_get(Evas_Object *obj, const char *part, const return EINA_FALSE; } +EAPI Eina_Bool +edje_edit_state_external_param_bool_get(Evas_Object *obj, const char *part, const char *state, const char *param, Eina_Bool *value) +{ + Eina_List *l; + Edje_External_Param *p; + GET_PD_OR_RETURN(EINA_FALSE); + + EINA_LIST_FOREACH(pd->external_params, l, p) + if (!strcmp(p->name, param)) + { + if (p->type != EDJE_EXTERNAL_PARAM_TYPE_INT) + return EINA_FALSE; + if (value) + *value = p->i; + return EINA_TRUE; + } + + return EINA_FALSE; +} + EAPI Eina_Bool edje_edit_state_external_param_double_get(Evas_Object *obj, const char *part, const char *state, const char *param, double *value) { @@ -3802,6 +3824,12 @@ edje_edit_state_external_param_int_set(Evas_Object *obj, const char *part, const return edje_edit_state_external_param_set(obj, part, state, param, EDJE_EXTERNAL_PARAM_TYPE_INT, value); } +EAPI Eina_Bool +edje_edit_state_external_param_bool_set(Evas_Object *obj, const char *part, const char *state, const char *param, Eina_Bool value) +{ + return edje_edit_state_external_param_set(obj, part, state, param, EDJE_EXTERNAL_PARAM_TYPE_BOOL, (int)value); +} + EAPI Eina_Bool edje_edit_state_external_param_double_set(Evas_Object *obj, const char *part, const char *state, const char *param, double value) {