Functions
Finding Objects

Functions that allows finding objects by their position, name or other properties. More...

Functions

EOAPI Evas_Objectevas_canvas_focus_get (void)
 Retrieve the object that currently has focus. More...
 
EOAPI Evas_Objectevas_canvas_object_name_find (const char *name)
 Retrieves the object on the given evas with the given name. More...
 
::evas::object evas::canvas::object_name_find (::efl::eina::string_view name_) const
 Retrieves the object on the given evas with the given name. More...
 
::evas::object evas::canvas::focus_get () const
 Retrieve the object that currently has focus. More...
 
Evas_Objectevas_focus_get (const Evas_Canvas *obj)
 Retrieve the object that currently has focus. More...
 
Evas_Objectevas_object_name_find (const Evas_Canvas *obj, const char *name)
 Retrieves the object on the given evas with the given name. More...
 
EOAPI Evas_Objectevas_obj_name_child_find (const char *name, int recurse)
 Retrieves the object from children of the given object with the given name. More...
 
::evas::object evas::object::name_child_find (::efl::eina::string_view name_, int recurse_) const
 Retrieves the object from children of the given object with the given name. More...
 
Evas_Objectevas_object_name_child_find (const Evas_Object *obj, const char *name, int recurse)
 Retrieves the object from children of the given object with the given name. More...
 
Evas_Objectevas_object_top_at_pointer_get (const Evas *e)
 Retrieve the Evas object stacked at the top at the position of the mouse cursor, over a given canvas. More...
 

Detailed Description

Functions that allows finding objects by their position, name or other properties.

Function Documentation

EOAPI Evas_Object* evas_canvas_focus_get ( void  )

Retrieve the object that currently has focus.

Returns
The object that has focus or NULL if there is not one.

Evas can have (at most) one of its objects focused at a time. Focused objects will be the ones having key events delivered to, which the programmer can act upon by means of evas_object_event_callback_add() usage.

Note
Most users wouldn't be dealing directly with Evas' focused objects. Instead, they would be using a higher level library for that (like a toolkit, as Elementary) to handle focus and who's receiving input for them.

This call returns the object that currently has focus on the canvas e or NULL, if none.

See also
evas_object_focus_set
evas_object_focus_get
evas_object_key_grab
evas_object_key_ungrab

Example:

1  evas_event_callback_add(d.canvas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
2  _object_focus_in_cb, NULL);
3  if (evas_alloc_error() != EVAS_ALLOC_ERROR_NONE)
4  {
5  fprintf(stderr, "ERROR: Callback registering failed! Aborting.\n");
6  goto panic;
7  } /* two canvas event callbacks */
8 
9  d.bg = evas_object_rectangle_add(d.canvas);
10  evas_object_name_set(d.bg, "our dear rectangle");
11  evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */
12  evas_object_move(d.bg, 0, 0); /* at canvas' origin */
13  evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */
14  evas_object_show(d.bg);
15 
16  evas_object_focus_set(d.bg, EINA_TRUE); /* so we get input events */
1 /* called when our rectangle gets focus */
2 static void
3 _object_focus_in_cb(void *data EINA_UNUSED,
4  Evas *e,
5  void *event_info)
6 {
7  fprintf(stdout, "An object got focused: %s\n",
8  evas_object_name_get(event_info));
9 
10  fprintf(stdout, "Let's recheck it: %s\n",
11  evas_object_name_get(evas_focus_get(e)));
12 
13  fprintf(stdout, "And again: %s\n", evas_object_focus_get(event_info) ?
14  "OK!" : "Oops, something is bad.");
15 }

In this example the event_info is exactly a pointer to that focused rectangle. See the full example.

Referenced by evas_focus_get().

EOAPI Evas_Object* evas_canvas_object_name_find ( const char *  name)

Retrieves the object on the given evas with the given name.

Returns
If successful, the Evas object with the given name. Otherwise, NULL.

This looks for the evas object given a name by evas_object_name_set(). If the name is not unique canvas-wide, then which one of the many objects with that name is returned is undefined, so only use this if you can ensure the object name is unique.

Parameters
[in]nameThe given name.

Referenced by evas_object_name_find().

::evas::object evas::canvas::object_name_find ( ::efl::eina::string_view  name_) const

Retrieves the object on the given evas with the given name.

Returns
If successful, the Evas object with the given name. Otherwise, NULL.

This looks for the evas object given a name by evas_object_name_set(). If the name is not unique canvas-wide, then which one of the many objects with that name is returned is undefined, so only use this if you can ensure the object name is unique.

Parameters
nameThe given name.
::evas::object evas::canvas::focus_get ( ) const

Retrieve the object that currently has focus.

Returns
The object that has focus or NULL if there is not one.

Evas can have (at most) one of its objects focused at a time. Focused objects will be the ones having key events delivered to, which the programmer can act upon by means of evas_object_event_callback_add() usage.

Note
Most users wouldn't be dealing directly with Evas' focused objects. Instead, they would be using a higher level library for that (like a toolkit, as Elementary) to handle focus and who's receiving input for them.

This call returns the object that currently has focus on the canvas e or NULL, if none.

See also
evas_object_focus_set
evas_object_focus_get
evas_object_key_grab
evas_object_key_ungrab

Example:

_object_focus_in_cb, NULL);
{
fprintf(stderr, "ERROR: Callback registering failed! Aborting.\n");
goto panic;
} /* two canvas event callbacks */
d.bg = evas_object_rectangle_add(d.canvas);
evas_object_name_set(d.bg, "our dear rectangle");
evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */
evas_object_move(d.bg, 0, 0); /* at canvas' origin */
evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */
evas_object_focus_set(d.bg, EINA_TRUE); /* so we get input events */
/* called when our rectangle gets focus */
static void
_object_focus_in_cb(void *data EINA_UNUSED,
Evas *e,
void *event_info)
{
fprintf(stdout, "An object got focused: %s\n",
evas_object_name_get(event_info));
fprintf(stdout, "Let's recheck it: %s\n",
evas_object_name_get(evas_focus_get(e)));
fprintf(stdout, "And again: %s\n", evas_object_focus_get(event_info) ?
"OK!" : "Oops, something is bad.");
}

In this example the event_info is exactly a pointer to that focused rectangle. See the full example.

Evas_Object* evas_focus_get ( const Evas_Canvas *  obj)

Retrieve the object that currently has focus.

Returns
The object that has focus or NULL if there is not one.

Evas can have (at most) one of its objects focused at a time. Focused objects will be the ones having key events delivered to, which the programmer can act upon by means of evas_object_event_callback_add() usage.

Note
Most users wouldn't be dealing directly with Evas' focused objects. Instead, they would be using a higher level library for that (like a toolkit, as Elementary) to handle focus and who's receiving input for them.

This call returns the object that currently has focus on the canvas e or NULL, if none.

See also
evas_object_focus_set
evas_object_focus_get
evas_object_key_grab
evas_object_key_ungrab

Example:

1  evas_event_callback_add(d.canvas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
2  _object_focus_in_cb, NULL);
3  if (evas_alloc_error() != EVAS_ALLOC_ERROR_NONE)
4  {
5  fprintf(stderr, "ERROR: Callback registering failed! Aborting.\n");
6  goto panic;
7  } /* two canvas event callbacks */
8 
9  d.bg = evas_object_rectangle_add(d.canvas);
10  evas_object_name_set(d.bg, "our dear rectangle");
11  evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */
12  evas_object_move(d.bg, 0, 0); /* at canvas' origin */
13  evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */
14  evas_object_show(d.bg);
15 
16  evas_object_focus_set(d.bg, EINA_TRUE); /* so we get input events */
1 /* called when our rectangle gets focus */
2 static void
3 _object_focus_in_cb(void *data EINA_UNUSED,
4  Evas *e,
5  void *event_info)
6 {
7  fprintf(stdout, "An object got focused: %s\n",
8  evas_object_name_get(event_info));
9 
10  fprintf(stdout, "Let's recheck it: %s\n",
11  evas_object_name_get(evas_focus_get(e)));
12 
13  fprintf(stdout, "And again: %s\n", evas_object_focus_get(event_info) ?
14  "OK!" : "Oops, something is bad.");
15 }

In this example the event_info is exactly a pointer to that focused rectangle. See the full example.

References evas_canvas_focus_get().

Evas_Object* evas_object_name_find ( const Evas_Canvas *  obj,
const char *  name 
)

Retrieves the object on the given evas with the given name.

Returns
If successful, the Evas object with the given name. Otherwise, NULL.

This looks for the evas object given a name by evas_object_name_set(). If the name is not unique canvas-wide, then which one of the many objects with that name is returned is undefined, so only use this if you can ensure the object name is unique.

Parameters
[in]nameThe given name.

References evas_canvas_object_name_find().

Referenced by edje_evas_global_perspective_get(), and edje_perspective_global_set().

EOAPI Evas_Object* evas_obj_name_child_find ( const char *  name,
int  recurse 
)

Retrieves the object from children of the given object with the given name.

Returns
If successful, the Evas object with the given name. Otherwise, NULL.

This looks for the evas object given a name by evas_object_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
Parameters
[in]nameThe given name.
[in]recurseSet 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.).

Referenced by evas_object_name_child_find().

::evas::object evas::object::name_child_find ( ::efl::eina::string_view  name_,
int  recurse_ 
) const

Retrieves the object from children of the given object with the given name.

Returns
If successful, the Evas object with the given name. Otherwise, NULL.

This looks for the evas object given a name by evas_object_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
Parameters
nameThe given name.
recurseSet 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.).
Evas_Object* evas_object_name_child_find ( const Evas_Object obj,
const char *  name,
int  recurse 
)

Retrieves the object from children of the given object with the given name.

Returns
If successful, the Evas object with the given name. Otherwise, NULL.

This looks for the evas object given a name by evas_object_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
Parameters
[in]nameThe given name.
[in]recurseSet 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.).

References evas_obj_name_child_find().

Evas_Object* evas_object_top_at_pointer_get ( const Evas e)

Retrieve the Evas object stacked at the top at the position of the mouse cursor, over a given canvas.

Parameters
eA handle to the canvas.
Returns
The Evas object that is over all other objects at the mouse pointer's position

This function will traverse all the layers of the given canvas, from top to bottom, querying for objects with areas covering the mouse pointer's position, over e.

Warning
This function will skip objects parented by smart objects, acting only on the ones at the "top level", with regard to object parenting.

References EINA_TRUE, and eo_data_scope_get().