move around - flatter.
[profile/ivi/evas.git] / src / lib / canvas / evas_name.c
1 #include "evas_common.h"
2 #include "evas_private.h"
3
4 /**
5  * @defgroup Evas_Object_Name_Group Object Name Function
6  *
7  * Functions that retrieve and set the name of an evas object.
8  */
9
10 /**
11  * Sets the name of the given evas object to the given name.
12  * @param   obj  The given object.
13  * @param   name The given name.
14  * @ingroup Evas_Object_Name_Group
15  */
16 EAPI void
17 evas_object_name_set(Evas_Object *obj, const char *name)
18 {
19    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
20    return;
21    MAGIC_CHECK_END();
22    if (obj->name)
23      {
24         obj->layer->evas->name_hash = evas_hash_del(obj->layer->evas->name_hash, obj->name, obj);
25         free(obj->name);
26      }
27    if (!name) obj->name = NULL;
28    else
29      {
30         obj->name = strdup(name);
31         obj->layer->evas->name_hash = evas_hash_add(obj->layer->evas->name_hash, obj->name, obj);
32      }
33 }
34
35 /**
36  * Retrieves the name of the given evas object.
37  * @param   obj The given object.
38  * @return  The name of the object.  @c NULL if no name has been given
39  *          to the object.
40  * @ingroup Evas_Object_Name_Group
41  */
42 EAPI const char *
43 evas_object_name_get(const Evas_Object *obj)
44 {
45    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
46    return NULL;
47    MAGIC_CHECK_END();
48    return obj->name;
49 }
50
51 /**
52  * Retrieves the object on the given evas with the given name.
53  * @param   e    The given evas.
54  * @param   name The given name.
55  * @return  If successful, the evas object with the given name.  Otherwise,
56  *          @c NULL.
57  * @ingroup Evas_Object_Name_Group
58  */
59 EAPI Evas_Object *
60 evas_object_name_find(const Evas *e, const char *name)
61 {
62    MAGIC_CHECK(e, Evas, MAGIC_EVAS);
63    return NULL;
64    MAGIC_CHECK_END();
65    if (!name) return NULL;
66    return (Evas_Object *)evas_hash_find(e->name_hash, name);
67 }