handle cases without default values and add missing functions.
authorbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 1 Apr 2010 03:48:07 +0000 (03:48 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 1 Apr 2010 03:48:07 +0000 (03:48 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@47640 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/Edje_Edit.h
src/lib/edje_edit.c

index 9819b7f..80a40b8 100644 (file)
@@ -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
+);
+
 
 //@}
 /******************************************************************************/
index 9771ed9..ccdb6c1 100644 (file)
@@ -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);