From: barbieri Date: Thu, 1 Apr 2010 03:48:07 +0000 (+0000) Subject: handle cases without default values and add missing functions. X-Git-Tag: submit/trunk/20120815.180907~1183 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e9ee9ac9bc984a6cf31f642dd065ab295f82f9b;p=profile%2Fivi%2Fedje.git handle cases without default values and add missing functions. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@47640 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/Edje_Edit.h b/src/lib/Edje_Edit.h index 9819b7f..80a40b8 100644 --- a/src/lib/Edje_Edit.h +++ b/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/src/lib/edje_edit.c b/src/lib/edje_edit.c index 9771ed9..ccdb6c1 100644 --- a/src/lib/edje_edit.c +++ b/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) @@ -3660,6 +3662,26 @@ edje_edit_state_external_param_int_get(Evas_Object *obj, const char *part, const } 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) { Eina_List *l; @@ -3803,6 +3825,12 @@ edje_edit_state_external_param_int_set(Evas_Object *obj, const char *part, const } 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) { return edje_edit_state_external_param_set(obj, part, state, param, EDJE_EXTERNAL_PARAM_TYPE_DOUBLE, value);