From a523bec0bbc8284cb1a0e3ab42678aeca75c3551 Mon Sep 17 00:00:00 2001 From: barbieri Date: Mon, 29 Mar 2010 19:32:45 +0000 Subject: [PATCH] another useful function git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@47564 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/Edje.h | 1 + src/lib/edje_external.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/src/lib/Edje.h b/src/lib/Edje.h index e3eb125..9f8a1cd 100644 --- a/src/lib/Edje.h +++ b/src/lib/Edje.h @@ -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); diff --git a/src/lib/edje_external.c b/src/lib/edje_external.c index 496ba31..1512942 100644 --- a/src/lib/edje_external.c +++ b/src/lib/edje_external.c @@ -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:" -- 2.7.4