Add function to check smart type based on pointer alone. Useful when we have access...
authorsachiel <sachiel@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 24 Mar 2010 08:43:39 +0000 (08:43 +0000)
committersachiel <sachiel@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 24 Mar 2010 08:43:39 +0000 (08:43 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@47413 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/Evas.h
src/lib/canvas/evas_object_smart.c

index c2ace0f..dc943ad 100644 (file)
@@ -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;
index 07adbba..4a56d3c 100644 (file)
@@ -289,6 +289,35 @@ evas_object_smart_type_check(const Evas_Object *obj, const char *type)
 }
 
 /**
+ * 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
  * @return Returns the list of the member objects of @a obj.