Evas: Move object name to legacy

All EO objects have a name now. No need for evas object
names anymore.

Also move name_child_find.
This commit is contained in:
Jean-Philippe Andre 2016-06-16 16:09:49 +09:00
parent d4b96d33d6
commit cc427152bd
3 changed files with 59 additions and 67 deletions

View File

@ -686,10 +686,56 @@ EAPI void evas_object_del(Evas_Object *obj) EINA_ARG_NONNULL(1);
*
* @return The type of the object.
*
* @ingroup Evas_Object
* @ingroup Evas_Object_Group_Basic
*/
EAPI const char *evas_object_type_get(const Evas_Object *obj);
/**
* @brief Sets the name of the given Evas object to the given name.
*
* There might be occasions where one would like to name his/her objects.
*
* @param[in] name The given name.
*
* @ingroup Evas_Object_Group_Basic
*/
EAPI void evas_object_name_set(Evas_Object *obj, const char *name);
/**
* @brief Retrieves the name of the given Evas object.
*
* Return: The name of the object or @c null, if no name has been given to it.
*
* @return The given name.
*
* @ingroup Evas_Object_Group_Basic
*/
EAPI const char *evas_object_name_get(const Evas_Object *obj);
/**
* @brief Retrieves the object from children of the given object with the given
* name.
*
* This looks for the evas object given a name by @ref evas_object_name_set,
* but it ONLY looks at the children of the object *p obj, and will only
* recurse into those children if @c recurse is greater than 0. If the name is
* not unique within immediate children (or the whole child tree) then it is
* not defined which child object will be returned. If @c recurse is set to -1
* then it will recurse without limit.
*
* @param[in] name The given name.
* @param[in] recurse Set to the number of child levels to recurse (0 == don't
* recurse, 1 == only look at the children of @c obj or their immediate
* children, but no further etc.).
*
* @return The Evas object with the given name on success, Otherwise @c null.
*
* @since 1.2
*
* @ingroup Evas_Object_Group_Basic
*/
EAPI Evas_Object *evas_object_name_child_find(const Evas_Object *obj, const char *name, int recurse) EINA_WARN_UNUSED_RESULT;
/**
* Retrieves the position and (rectangular) size of the given Evas
* object.

View File

@ -1,9 +1,12 @@
#include "evas_common_private.h"
#include "evas_private.h"
EOLIAN void
_evas_object_name_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, const char *name)
EAPI void
evas_object_name_set(Evas_Object *eo_obj, const char *name)
{
Evas_Object_Protected_Data *obj = eo_isa(eo_obj, EVAS_OBJECT_CLASS) ?
eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS) : NULL;
if (!obj) return;
if (obj->name)
{
if (obj->layer && obj->layer->evas && obj->layer->evas->name_hash)
@ -19,9 +22,12 @@ _evas_object_name_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, const char *n
}
}
EOLIAN const char *
_evas_object_name_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
EAPI const char *
evas_object_name_get(const Evas_Object *eo_obj)
{
Evas_Object_Protected_Data *obj = eo_isa(eo_obj, EVAS_OBJECT_CLASS) ?
eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS) : NULL;
if (!obj) return NULL;
return obj->name;
}
@ -54,8 +60,8 @@ _priv_evas_object_name_child_find(const Evas_Object *eo_obj, const char *name, i
return NULL;
}
EOLIAN Evas_Object *
_evas_object_name_child_find(Eo *eo_obj, Evas_Object_Protected_Data *obj EINA_UNUSED, const char *name, int recurse)
EAPI Evas_Object *
evas_object_name_child_find(const Evas_Object *eo_obj, const char *name, int recurse)
{
return (!name ? NULL : _priv_evas_object_name_child_find(eo_obj, name, recurse));
}

View File

@ -275,41 +275,6 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx, Efl.Gfx.Stack,
not ($false).]]
}
}
@property name {
set {
[[Sets the name of the given Evas object to the given name.
There might be occasions where one would like to name his/her
objects.
]]
/* FIXME-doc
Example:
@dontinclude evas-events.c
@skip d.bg = evas_object_rectangle_add(d.canvas);
@until evas_object_name_set(d.bg, "our dear rectangle");
See the full @ref Example_Evas_Events "example".
*/
}
get {
[[Retrieves the name of the given Evas object.
Return: The name of the object or $null, if no name has been
given to it.
]]
/* FIXME-doc
Example:
@dontinclude evas-events.c
@skip fprintf(stdout, "An object got focused: %s\n",
@until evas_focus_get
See the full @ref Example_Evas_Events "example".
*/
}
values {
name: string; [[The given name.]]
}
}
@property scale {
set {
[[Sets the scaling factor for an Evas object. Does not affect
@ -726,31 +691,6 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx, Efl.Gfx.Stack,
@in type: string @nonull; [[The name (type) of the smart class to check for.]]
}
}
name_child_find @const {
[[Retrieves the object from children of the given object with the
given name.
This looks for the evas object given a name by @.name.set, but
it ONLY looks at the children of the object *p obj, and will
only recurse into those children if $recurse is greater than 0.
If the name is not unique within immediate children (or the whole
child tree) then it is not defined which child object will be
returned. If $recurse is set to -1 then it will recurse without
limit.
@since 1.2
]]
return: Evas.Object @warn_unused; [[The Evas object with the given name
on success, Otherwise $null.]]
params {
@in name: string; [[The given name.]]
@in recurse: int; [[
Set to the number of child levels to recurse (0 == don't
recurse, 1 == only look at the children of $obj or their
immediate children, but no further etc.).
]]
}
}
key_ungrab {
[[Removes the grab on $keyname key events by $obj.