2002-11-08 00:02:15 -08:00
|
|
|
#include "evas_common.h"
|
|
|
|
#include "evas_private.h"
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2004-08-23 16:04:34 -07:00
|
|
|
* @defgroup Evas_Object_Name_Group Object Name Function
|
2003-03-04 18:30:20 -08:00
|
|
|
*
|
2004-08-23 16:04:34 -07:00
|
|
|
* Functions that retrieve and set the name of an evas object.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the name of the given evas object to the given name.
|
|
|
|
* @param obj The given object.
|
|
|
|
* @param name The given name.
|
|
|
|
* @ingroup Evas_Object_Name_Group
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2002-11-08 00:02:15 -08:00
|
|
|
evas_object_name_set(Evas_Object *obj, const char *name)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2005-05-21 19:49:50 -07:00
|
|
|
if (obj->name)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
obj->layer->evas->name_hash = evas_hash_del(obj->layer->evas->name_hash, obj->name, obj);
|
2005-11-29 01:02:51 -08:00
|
|
|
free(obj->name);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
if (!name) obj->name = NULL;
|
2005-05-21 19:49:50 -07:00
|
|
|
else
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2005-11-29 01:02:51 -08:00
|
|
|
obj->name = strdup(name);
|
|
|
|
obj->layer->evas->name_hash = evas_hash_add(obj->layer->evas->name_hash, obj->name, obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2004-08-23 16:04:34 -07:00
|
|
|
* Retrieves the name of the given evas object.
|
|
|
|
* @param obj The given object.
|
|
|
|
* @return The name of the object. @c NULL if no name has been given
|
|
|
|
* to the object.
|
|
|
|
* @ingroup Evas_Object_Name_Group
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI const char *
|
2002-11-08 00:02:15 -08:00
|
|
|
evas_object_name_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
return obj->name;
|
|
|
|
}
|
|
|
|
|
2003-03-04 18:30:20 -08:00
|
|
|
/**
|
2004-08-23 16:04:34 -07:00
|
|
|
* Retrieves the object on the given evas with the given name.
|
|
|
|
* @param e The given evas.
|
|
|
|
* @param name The given name.
|
|
|
|
* @return If successful, the evas object with the given name. Otherwise,
|
|
|
|
* @c NULL.
|
|
|
|
* @ingroup Evas_Object_Name_Group
|
2003-03-04 18:30:20 -08:00
|
|
|
*/
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI Evas_Object *
|
2008-02-08 13:42:01 -08:00
|
|
|
evas_object_name_find(const Evas *e, const char *name)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
if (!name) return NULL;
|
|
|
|
return (Evas_Object *)evas_hash_find(e->name_hash, name);
|
|
|
|
}
|