another useful function
authorbarbieri <barbieri>
Mon, 29 Mar 2010 19:32:45 +0000 (19:32 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 29 Mar 2010 19:32:45 +0000 (19:32 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@47564 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/Edje.h
src/lib/edje_external.c

index e3eb125..9f8a1cd 100644 (file)
@@ -510,6 +510,7 @@ extern "C" {
    EAPI Evas_Object *edje_object_part_external_object_get(const Evas_Object *obj, const char *part);
    EAPI Eina_Bool    edje_object_part_external_param_set(Evas_Object *obj, const char *part, const Edje_External_Param *param);
    EAPI Eina_Bool    edje_object_part_external_param_get(const Evas_Object *obj, const char *part, Edje_External_Param *param);
+   EAPI Edje_External_Param_Type edje_object_part_external_param_type_get(const Evas_Object *obj, const char *part, const char *param);
 
    EAPI Eina_Bool    edje_object_part_box_append     (Evas_Object *obj, const char *part, Evas_Object *child);
    EAPI Eina_Bool    edje_object_part_box_prepend    (Evas_Object *obj, const char *part, Evas_Object *child);
index 496ba31..1512942 100644 (file)
@@ -174,6 +174,54 @@ edje_object_part_external_param_get(const Evas_Object *obj, const char *part, Ed
 }
 
 /**
+ * Facility to query the type of the given parameter of the given part.
+ *
+ * @param obj A valid Evas_Object handle
+ * @param part The part name
+ * @param param the parameter name to use.
+ *
+ * @return @c EDJE_EXTERNAL_PARAM_TYPE_MAX on errors, or another value
+ *         from #Edje_External_Param_Type on success.
+ */
+EAPI Edje_External_Param_Type
+edje_object_part_external_param_type_get(const Evas_Object *obj, const char *part, const char *param)
+{
+   Edje *ed;
+   Edje_Real_Part *rp;
+   Edje_External_Type *type;
+   Edje_External_Param_Info *info;
+
+   ed = _edje_fetch(obj);
+   if ((!ed) || (!part)) return EDJE_EXTERNAL_PARAM_TYPE_MAX;
+
+   rp = _edje_real_part_recursive_get(ed, (char *)part);
+   if (!rp)
+     {
+       ERR("no part '%s'", part);
+       return EDJE_EXTERNAL_PARAM_TYPE_MAX;
+     }
+   type = evas_object_data_get(obj, "Edje_External_Type");
+   if (!type)
+     {
+       ERR("no external type for object %p", obj);
+       return EDJE_EXTERNAL_PARAM_TYPE_MAX;
+     }
+   if (!type->parameters_info)
+     {
+       ERR("no parameters information for external type '%s'",
+           type->module_name);
+       return EDJE_EXTERNAL_PARAM_TYPE_MAX;
+     }
+   for (info = type->parameters_info; info->name != NULL; info++)
+     if (strcmp(info->name, param) == 0)
+       return info->type;
+
+   ERR("no parameter '%s' external type '%s'", param, type->module_name);
+   return EDJE_EXTERNAL_PARAM_TYPE_MAX;
+}
+
+
+/**
  * Register given type name to return the given information.
  *
  * @param type_name name to register and be known by edje's "source:"