diff --git a/legacy/evas/src/lib/Evas.h b/legacy/evas/src/lib/Evas.h index c2ace0f73e..dc943add67 100644 --- a/legacy/evas/src/lib/Evas.h +++ b/legacy/evas/src/lib/Evas.h @@ -1765,6 +1765,7 @@ struct _Evas_Smart_Cb_Description EAPI void evas_object_smart_member_del (Evas_Object *obj) EINA_ARG_NONNULL(1); EAPI Evas_Object *evas_object_smart_parent_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; EAPI Eina_Bool evas_object_smart_type_check (const Evas_Object *obj, const char *type) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2) EINA_PURE; + EAPI Eina_Bool evas_object_smart_type_check_ptr (const Evas_Object *obj, const char *type) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2) EINA_PURE; EAPI Eina_List *evas_object_smart_members_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; EAPI Evas_Smart *evas_object_smart_smart_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; EAPI void *evas_object_smart_data_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; diff --git a/legacy/evas/src/lib/canvas/evas_object_smart.c b/legacy/evas/src/lib/canvas/evas_object_smart.c index 07adbbaaad..4a56d3c536 100644 --- a/legacy/evas/src/lib/canvas/evas_object_smart.c +++ b/legacy/evas/src/lib/canvas/evas_object_smart.c @@ -288,6 +288,35 @@ evas_object_smart_type_check(const Evas_Object *obj, const char *type) return EINA_FALSE; } +/** + * Checks the Smart type of the object and its parents using pointer comparison + * @param obj the Evas_Object to check the type of + * @param type the type to check for. Must be the name pointer in the smart class used to create the object + * @return EINA_TRUE if @a obj or any of its parents if of type @a type, EINA_FALSE otherwise + * @ingroup Evas_Smart_Object_Group + */ +EAPI Eina_Bool +evas_object_smart_type_check_ptr(const Evas_Object *obj, const char *type) +{ + const Evas_Smart_Class *sc; + + MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); + return EINA_FALSE; + MAGIC_CHECK_END(); + + if (!obj->smart.smart) + return EINA_FALSE; + sc = obj->smart.smart->smart_class; + while (sc) + { + if (sc->name == type) + return EINA_TRUE; + sc = sc->parent; + } + + return EINA_FALSE; +} + /** * Gets the list of the member objects of an Evas_Object * @param obj the Evas_Object you want to get the list of member objects