Basic Object Manipulation

Almost every evas object created will have some generic function used to manipulate it. More...

#define evas_obj_position_set(x, y)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_POSITION_SET), EO_TYPECHECK(Evas_Coord, x), EO_TYPECHECK(Evas_Coord, y)
 
#define evas_obj_position_get(x, y)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_POSITION_GET), EO_TYPECHECK(Evas_Coord *, x), EO_TYPECHECK(Evas_Coord *, y)
 
#define evas_obj_size_set(w, h)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_SIZE_SET), EO_TYPECHECK(Evas_Coord, w), EO_TYPECHECK(Evas_Coord, h)
 
#define evas_obj_size_get(w, h)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_SIZE_GET), EO_TYPECHECK(Evas_Coord *, w), EO_TYPECHECK(Evas_Coord *, h)
 
#define evas_obj_visibility_set(v)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_VISIBILITY_SET), EO_TYPECHECK(Eina_Bool, v)
 
#define evas_obj_visibility_get(v)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_VISIBILITY_GET), EO_TYPECHECK(Eina_Bool *, v)
 
#define evas_obj_color_set(r, g, b, a)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_COLOR_SET), EO_TYPECHECK(int, r), EO_TYPECHECK(int, g), EO_TYPECHECK(int, b), EO_TYPECHECK(int, a)
 
#define evas_obj_color_get(r, g, b, a)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_COLOR_GET), EO_TYPECHECK(int *, r), EO_TYPECHECK(int *, g), EO_TYPECHECK(int *, b), EO_TYPECHECK(int *, a)
 
#define evas_obj_evas_get(evas)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_EVAS_GET), EO_TYPECHECK(Evas **, evas)
 
#define evas_obj_type_get(type)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_TYPE_GET), EO_TYPECHECK(const char **, type)
 
#define evas_obj_type_set(type)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_TYPE_SET), EO_TYPECHECK(const char *, type)
 
#define evas_obj_raise()   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_RAISE)
 
#define evas_obj_lower()   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_LOWER)
 
#define evas_obj_stack_above(above)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_STACK_ABOVE), EO_TYPECHECK(Evas_Object *, above)
 
#define evas_obj_stack_below(below)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_STACK_BELOW), EO_TYPECHECK(Evas_Object *, below)
 
#define evas_obj_above_get(ret)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_ABOVE_GET), EO_TYPECHECK(Evas_Object **, ret)
 
#define evas_obj_below_get(ret)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_BELOW_GET), EO_TYPECHECK(Evas_Object **, ret)
 
#define evas_obj_clip_set(clip)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_CLIP_SET), EO_TYPECHECK(Evas_Object *, clip)
 
#define evas_obj_clip_get(clip)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_CLIP_GET), EO_TYPECHECK(Evas_Object **, clip)
 
#define evas_obj_clip_unset()   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_CLIP_UNSET)
 
#define evas_obj_clipees_get(clipees)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_CLIPEES_GET), EO_TYPECHECK(const Eina_List **, clipees)
 
#define evas_obj_clipees_has(clipees_has)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_CLIPEES_HAS), EO_TYPECHECK(const Eina_Bool *, clipees_has)
 
#define evas_obj_focus_set(focus)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_FOCUS_SET), EO_TYPECHECK(Eina_Bool, focus)
 
#define evas_obj_focus_get(focus)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_FOCUS_GET), EO_TYPECHECK(Eina_Bool *, focus)
 
#define evas_obj_name_set(name)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_NAME_SET), EO_TYPECHECK(const char *, name)
 
#define evas_obj_name_get(name)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_NAME_GET), EO_TYPECHECK(const char **, name)
 
#define evas_obj_key_grab(keyname, modifiers, not_modifiers, exclusive, ret)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_KEY_GRAB), EO_TYPECHECK(const char *, keyname), EO_TYPECHECK(Evas_Modifier_Mask, modifiers), EO_TYPECHECK(Evas_Modifier_Mask, not_modifiers), EO_TYPECHECK(Eina_Bool, exclusive), EO_TYPECHECK(Eina_Bool *, ret)
 
#define evas_obj_key_ungrab(keyname, modifiers, not_modifiers)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_KEY_UNGRAB), EO_TYPECHECK(const char *, keyname), EO_TYPECHECK(Evas_Modifier_Mask, modifiers), EO_TYPECHECK(Evas_Modifier_Mask, not_modifiers)
 
#define evas_obj_layer_set(l)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_LAYER_SET), EO_TYPECHECK(short, l)
 
#define evas_obj_layer_get(l)   EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_LAYER_GET), EO_TYPECHECK(short *, l)
 
void evas_object_clip_set (Evas_Object *obj, Evas_Object *clip)
 Clip one object to another. More...
 
void evas_object_ref (Evas_Object *obj)
 Increments object reference count to defer its deletion. More...
 
void evas_object_unref (Evas_Object *obj)
 Decrements object reference count. More...
 
int evas_object_ref_get (const Evas_Object *obj)
 Get the object reference count. More...
 
void evas_object_del (Evas_Object *obj)
 Marks the given Evas object for deletion (when Evas will free its memory). More...
 
void evas_object_move (Evas_Object *obj, Evas_Coord x, Evas_Coord y)
 Move the given Evas object to the given location inside its canvas' viewport. More...
 
void evas_object_resize (Evas_Object *obj, Evas_Coord w, Evas_Coord h)
 Changes the size of the given Evas object. More...
 
void evas_object_geometry_get (const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
 Retrieves the position and (rectangular) size of the given Evas object. More...
 
void evas_object_geometry_set (Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
 Set the position and (rectangular) size of the given Evas object. More...
 
void evas_object_show (Evas_Object *obj)
 Makes the given Evas object visible. More...
 
void evas_object_hide (Evas_Object *obj)
 Makes the given Evas object invisible. More...
 
Eina_Bool evas_object_visible_get (const Evas_Object *obj)
 Retrieves whether or not the given Evas object is visible. More...
 
void evas_object_color_set (Evas_Object *obj, int r, int g, int b, int a)
 Sets the general/main color of the given Evas object to the given one. More...
 
void evas_object_color_get (const Evas_Object *obj, int *r, int *g, int *b, int *a)
 Retrieves the general/main color of the given Evas object. More...
 
Evasevas_object_evas_get (const Evas_Object *obj)
 Retrieves the Evas canvas that the given object lives on. More...
 
Evas_Objectevas_object_clip_get (const Evas_Object *obj)
 Get the object clipping obj (if any). More...
 
void evas_object_clip_unset (Evas_Object *obj)
 Disable/cease clipping on a clipped obj object. More...
 
const Eina_Listevas_object_clipees_get (const Evas_Object *obj)
 Return a list of objects currently clipped by obj. More...
 
Eina_Bool evas_object_clipees_has (const Evas_Object *obj)
 Test if any object is clipped by obj. More...
 
void evas_object_focus_set (Evas_Object *obj, Eina_Bool focus)
 Sets or unsets a given object as the currently focused one on its canvas. More...
 
Eina_Bool evas_object_focus_get (const Evas_Object *obj)
 Retrieve whether an object has the focus. More...
 
void evas_object_layer_set (Evas_Object *obj, short l)
 Sets the layer of its canvas that the given object will be part of. More...
 
short evas_object_layer_get (const Evas_Object *obj)
 Retrieves the layer of its canvas that the given object is part of. More...
 
void evas_object_name_set (Evas_Object *obj, const char *name)
 Sets the name of the given Evas object to the given name. More...
 
const char * evas_object_name_get (const Evas_Object *obj)
 Retrieves the name of the given Evas object. More...
 
const char * evas_object_type_get (const Evas_Object *obj)
 Retrieves the type of the given Evas object. More...
 
void evas_object_raise (Evas_Object *obj)
 Raise obj to the top of its layer. More...
 
void evas_object_lower (Evas_Object *obj)
 Lower obj to the bottom of its layer. More...
 
void evas_object_stack_above (Evas_Object *obj, Evas_Object *above)
 Stack obj immediately above above. More...
 
void evas_object_stack_below (Evas_Object *obj, Evas_Object *below)
 Stack obj immediately below below. More...
 
Evas_Objectevas_object_above_get (const Evas_Object *obj)
 Get the Evas object stacked right above obj. More...
 
Evas_Objectevas_object_below_get (const Evas_Object *obj)
 Get the Evas object stacked right below obj. More...
 

Detailed Description

Almost every evas object created will have some generic function used to manipulate it.

That's because there are a number of basic actions to be done to objects that are irrespective of the object's type, things like:

  • Showing/Hiding
  • Setting(and getting) geometry
  • Bring up or down a layer
  • Color management
  • Handling focus
  • Clipping
  • Reference counting

All of this issues are handled through the functions here grouped. Examples of these function can be seen in Evas objects basic manipulation example(which deals with the most common ones) and in Evas object stacking functions (and some event handling)(which deals with stacking functions).

Macro Definition Documentation

#define evas_obj_position_set (   x,
 
)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_POSITION_SET), EO_TYPECHECK(Evas_Coord, x), EO_TYPECHECK(Evas_Coord, y)
Since
1.8

Move the given Evas object to the given location inside its canvas' viewport.

Parameters
[in]xin
[in]yin
See also
evas_object_move

Referenced by evas_object_geometry_set(), and evas_object_move().

#define evas_obj_evas_get (   evas)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_EVAS_GET), EO_TYPECHECK(Evas **, evas)
Since
1.8 Retrieves the Evas canvas that the given object lives on.
Parameters
[out]evas
See also
evas_object_evas_get
#define evas_obj_clip_set (   clip)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_CLIP_SET), EO_TYPECHECK(Evas_Object *, clip)
Since
1.8 Clip one object to another.
Parameters
[in]clipin
See also
evas_object_clip_set

Referenced by evas_object_clip_set().

#define evas_obj_layer_set (   l)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_LAYER_SET), EO_TYPECHECK(short, l)
Since
1.8 Sets the layer of the its canvas that the given object will be part of.
Parameters
[in]lin
See also
evas_object_layer_set

Referenced by evas_object_layer_set().

#define evas_obj_position_get (   x,
 
)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_POSITION_GET), EO_TYPECHECK(Evas_Coord *, x), EO_TYPECHECK(Evas_Coord *, y)
Since
1.8

Retrieves the position of the given Evas object.

Parameters
[out]xout
[out]yout
See also
evas_object_geometry_get

Referenced by evas_object_geometry_get().

#define evas_obj_size_set (   w,
 
)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_SIZE_SET), EO_TYPECHECK(Evas_Coord, w), EO_TYPECHECK(Evas_Coord, h)
Since
1.8 Changes the size of the given Evas object.
Parameters
[in]win
[in]hin
See also
evas_object_resize

Referenced by evas_object_geometry_set(), and evas_object_resize().

#define evas_obj_size_get (   w,
 
)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_SIZE_GET), EO_TYPECHECK(Evas_Coord *, w), EO_TYPECHECK(Evas_Coord *, h)
Since
1.8

Retrieves the (rectangular) size of the given Evas object.

Parameters
[out]wout
[out]hout
See also
evas_object_geometry_get

Referenced by evas_object_geometry_get().

#define evas_obj_visibility_set (   v)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_VISIBILITY_SET), EO_TYPECHECK(Eina_Bool, v)
Since
1.8

Makes the given Evas object visible or invisible.

Parameters
[in]vEINA_TRUE if to make the object visible, EINA_FALSE otherwise.
See also
evas_object_show
evas_object_hide

Referenced by evas_object_hide(), and evas_object_show().

#define evas_obj_visibility_get (   v)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_VISIBILITY_GET), EO_TYPECHECK(Eina_Bool *, v)
Since
1.8

Retrieves whether or not the given Evas object is visible.

Parameters
[out]vEINA_TRUE if the object is visible, EINA_FALSE otherwise.
See also
evas_object_visible_get

Referenced by evas_object_visible_get().

#define evas_obj_color_set (   r,
  g,
  b,
 
)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_COLOR_SET), EO_TYPECHECK(int, r), EO_TYPECHECK(int, g), EO_TYPECHECK(int, b), EO_TYPECHECK(int, a)
Since
1.8

Sets the general/main color of the given Evas object to the given one.

Parameters
[in]rin
[in]gin
[in]bin
[in]ain
See also
evas_object_color_set

Referenced by evas_object_color_set().

#define evas_obj_color_get (   r,
  g,
  b,
 
)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_COLOR_GET), EO_TYPECHECK(int *, r), EO_TYPECHECK(int *, g), EO_TYPECHECK(int *, b), EO_TYPECHECK(int *, a)
Since
1.8 Retrieves the general/main color of the given Evas object.
Parameters
[out]rout
[out]gout
[out]bout
[out]aout
See also
evas_object_color_get

Referenced by evas_object_color_get().

#define evas_obj_type_get (   type)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_TYPE_GET), EO_TYPECHECK(const char **, type)
Since
1.8 Retrieves the type of the given Evas object.
Parameters
[out]typeout
See also
evas_object_type_get

Referenced by evas_object_type_get().

#define evas_obj_type_set (   type)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_TYPE_SET), EO_TYPECHECK(const char *, type)
Since
1.8 Sets the type of the given Evas object.
Parameters
[in]typein
#define evas_obj_raise ( )    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_RAISE)
Since
1.8

Raise obj to the top of its layer.

See also
evas_object_raise

Referenced by evas_object_raise().

#define evas_obj_lower ( )    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_LOWER)
Since
1.8

Lower obj to the bottom of its layer.

See also
evas_object_lower

Referenced by evas_object_lower().

#define evas_obj_stack_above (   above)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_STACK_ABOVE), EO_TYPECHECK(Evas_Object *, above)
Since
1.8

Stack the object immediately above above

Parameters
[in]abovein
See also
evas_object_stack_above

Referenced by evas_object_stack_above().

#define evas_obj_stack_below (   below)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_STACK_BELOW), EO_TYPECHECK(Evas_Object *, below)
Since
1.8

Stack the object immediately below below

Parameters
[in]belowin
See also
evas_object_stack_below

Referenced by evas_object_stack_below().

#define evas_obj_above_get (   ret)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_ABOVE_GET), EO_TYPECHECK(Evas_Object **, ret)
Since
1.8

Get the Evas object stacked right above the object

Parameters
[out]retout
See also
evas_object_above_get

Referenced by evas_object_above_get().

#define evas_obj_below_get (   ret)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_BELOW_GET), EO_TYPECHECK(Evas_Object **, ret)
Since
1.8

Get the Evas object stacked right below the object

Parameters
[out]retout
See also
evas_object_below_get

Referenced by evas_object_below_get().

#define evas_obj_clip_get (   clip)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_CLIP_GET), EO_TYPECHECK(Evas_Object **, clip)
Since
1.8 Get the object clipping obj (if any).
Parameters
[out]clipout
See also
evas_object_clip_get

Referenced by evas_object_clip_get().

#define evas_obj_clip_unset ( )    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_CLIP_UNSET)
Since
1.8 Disable/cease clipping on a clipped obj object.
See also
evas_object_clip_unset

Referenced by evas_object_clip_unset().

#define evas_obj_clipees_get (   clipees)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_CLIPEES_GET), EO_TYPECHECK(const Eina_List **, clipees)
Since
1.8 Return a list of objects currently clipped by obj.
Parameters
[out]clipeesout
See also
evas_object_clipees_get

Referenced by evas_object_clipees_get().

#define evas_obj_clipees_has (   clipees_has)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_CLIPEES_HAS), EO_TYPECHECK(const Eina_Bool *, clipees_has)
Since
1.8 Return a list of objects currently clipped by obj.
Parameters
[out]clipees_hasout
See also
evas_object_clipees_has

Referenced by evas_object_clipees_has().

#define evas_obj_focus_set (   focus)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_FOCUS_SET), EO_TYPECHECK(Eina_Bool, focus)
Since
1.8 Sets or unsets a given object as the currently focused one on its canvas.
Parameters
[in]focusin
See also
evas_object_focus_set

Referenced by evas_object_focus_set().

#define evas_obj_focus_get (   focus)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_FOCUS_GET), EO_TYPECHECK(Eina_Bool *, focus)
Since
1.8 Retrieve whether an object has the focus.
Parameters
[out]focusout
See also
evas_object_focus_get

Referenced by evas_object_focus_get().

#define evas_obj_name_set (   name)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_NAME_SET), EO_TYPECHECK(const char *, name)
Since
1.8 Sets the name of the given Evas object to the given name.
Parameters
[in]namein
See also
evas_object_name_set

Referenced by evas_object_name_set().

#define evas_obj_name_get (   name)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_NAME_GET), EO_TYPECHECK(const char **, name)
Since
1.8

Retrieves the name of the given Evas object.

Parameters
[out]nameout
See also
evas_object_name_get

Referenced by evas_object_name_get().

#define evas_obj_key_grab (   keyname,
  modifiers,
  not_modifiers,
  exclusive,
  ret 
)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_KEY_GRAB), EO_TYPECHECK(const char *, keyname), EO_TYPECHECK(Evas_Modifier_Mask, modifiers), EO_TYPECHECK(Evas_Modifier_Mask, not_modifiers), EO_TYPECHECK(Eina_Bool, exclusive), EO_TYPECHECK(Eina_Bool *, ret)
Since
1.8

Requests keyname key events be directed to the obj.

Parameters
[in]keynamein
[in]modifiersin
[in]not_modifiersin
[in]exclusivein
[out]retout
See also
evas_object_key_grab

Referenced by evas_object_key_grab().

#define evas_obj_key_ungrab (   keyname,
  modifiers,
  not_modifiers 
)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_KEY_UNGRAB), EO_TYPECHECK(const char *, keyname), EO_TYPECHECK(Evas_Modifier_Mask, modifiers), EO_TYPECHECK(Evas_Modifier_Mask, not_modifiers)
Since
1.8

Removes the grab on keyname key events by the obj.

Parameters
[in]keyname
[in]modifiers
[in]not_modifiers
See also
evas_object_key_ungrab

Referenced by evas_object_key_ungrab().

#define evas_obj_layer_get (   l)    EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_LAYER_GET), EO_TYPECHECK(short *, l)
Since
1.8 Retrieves the layer of its canvas that the given object is part of.
Parameters
[out]lout
See also
evas_object_layer_get

Referenced by evas_object_layer_get().

Function Documentation

void evas_object_clip_set ( Evas_Object obj,
Evas_Object clip 
)

Clip one object to another.

Parameters
objThe object to be clipped
clipThe object to clip obj by

This function will clip the object obj to the area occupied by the object clip. This means the object obj will only be visible within the area occupied by the clipping object (clip).

The color of the object being clipped will be multiplied by the color of the clipping one, so the resulting color for the former will be RESULT = (OBJ * CLIP) / (255 * 255), per color element (red, green, blue and alpha).

Clipping is recursive, so clipping objects may be clipped by others, and their color will in term be multiplied. You may not set up circular clipping lists (i.e. object 1 clips object 2, which clips object 1): the behavior of Evas is undefined in this case.

Objects which do not clip others are visible in the canvas as normal; those that clip one or more objects become invisible themselves, only affecting what they clip. If an object ceases to have other objects being clipped by it, it will become visible again.

The visibility of an object affects the objects that are clipped by it, so if the object clipping others is not shown (as in evas_object_show()), the objects clipped by it will not be shown either.

If obj was being clipped by another object when this function is called, it gets implicitly removed from the old clipper's domain and is made now to be clipped by its new clipper.

The following figure illustrates some clipping in Evas:

clipping.png
Note
At the moment the only objects that can validly be used to clip other objects are rectangle objects. All other object types are invalid and the result of using them is undefined. The clip object clip must be a valid object, but can also be NULL, in which case the effect of this function is the same as calling evas_object_clip_unset() on the obj object.

Example:

/* solid white clipper (note that it's the default color for a
* rectangle) - it won't change clippees' colors, then (multiplying
* by 255) */
d.clipper = evas_object_rectangle_add(d.canvas);
evas_object_move(d.clipper, WIDTH / 4, HEIGHT / 4);
evas_object_resize(d.clipper, WIDTH / 2, HEIGHT / 2);
evas_object_clip_set(d.img, d.clipper);
evas_object_show(d.clipper);

See the full example.

References evas_obj_clip_set.

Referenced by edje_edit_part_clip_to_set(), and edje_edit_part_del().

void evas_object_ref ( Evas_Object obj)

Increments object reference count to defer its deletion.

Parameters
objThe given Evas object to reference

This increments the reference count of an object, which if greater than 0 will defer deletion by evas_object_del() until all references are released back (counter back to 0). References cannot go below 0 and unreferencing past that will result in the reference count being limited to 0. References are limited to 2^32 - 1 for an object. Referencing it more than this will result in it being limited to this value.

See also
evas_object_unref()
evas_object_del()
Note
This is a very simple reference counting mechanism! For instance, Evas is not ready to check for pending references on a canvas deletion, or things like that. This is useful on scenarios where, inside a code block, callbacks exist which would possibly delete an object we are operating on afterwards. Then, one would evas_object_ref() it on the beginning of the block and evas_object_unref() it on the end. It would then be deleted at this point, if it should be.

Example:

// action here...
evas_object_smart_callback_call(obj, SIG_SELECTED, NULL);
// more action here...
Since
1.1
void evas_object_unref ( Evas_Object obj)

Decrements object reference count.

Parameters
objThe given Evas object to unreference

This decrements the reference count of an object. If the object has had evas_object_del() called on it while references were more than 0, it will be deleted at the time this function is called and puts the counter back to 0. See evas_object_ref() for more information.

See also
evas_object_ref() (for an example)
evas_object_del()
Since
1.1

References evas_object_del().

int evas_object_ref_get ( const Evas_Object obj)

Get the object reference count.

Parameters
objThe given Evas object to query

This gets the reference count for an object (normally 0 until it is referenced). Values of 1 or greater mean that someone is holding a reference to this object that needs to be unreffed before it can be deleted.

See also
evas_object_ref()
evas_object_unref()
evas_object_del()
Since
1.2
void evas_object_del ( Evas_Object obj)

Marks the given Evas object for deletion (when Evas will free its memory).

Parameters
objThe given Evas object.

This call will mark obj for deletion, which will take place whenever it has no more references to it (see evas_object_ref() and evas_object_unref()).

At actual deletion time, which may or may not be just after this call, EVAS_CALLBACK_DEL and EVAS_CALLBACK_FREE callbacks will be called. If the object currently had the focus, its EVAS_CALLBACK_FOCUS_OUT callback will also be called.

See also
evas_object_ref()
evas_object_unref()

References EINA_TRUE.

Referenced by ecore_evas_ews_background_set(), edje_edit_part_source_set(), edje_perspective_free(), and evas_object_unref().

void evas_object_move ( Evas_Object obj,
Evas_Coord  x,
Evas_Coord  y 
)

Move the given Evas object to the given location inside its canvas' viewport.

Parameters
objThe given Evas object.
xX position to move the object to, in canvas units.
yY position to move the object to, in canvas units.

Besides being moved, the object's EVAS_CALLBACK_MOVE callback will be called.

Note
Naturally, newly created objects are placed at the canvas' origin: 0, 0.

Example:

evas_object_image_border_set(d.clipper_border, 3, 3, 3, 3);
d.clipper_border, EVAS_BORDER_FILL_NONE);
evas_object_move(d.clipper_border, (WIDTH / 4) - 3, (HEIGHT / 4) - 3);
d.clipper_border, (WIDTH / 2) + 6, (HEIGHT / 2) + 6);
evas_object_show(d.clipper_border);

See the full example.

References evas_obj_position_set.

Referenced by ecore_evas_ews_background_set(), and ecore_evas_ews_new().

void evas_object_resize ( Evas_Object obj,
Evas_Coord  w,
Evas_Coord  h 
)

Changes the size of the given Evas object.

Parameters
objThe given Evas object.
wThe new width of the Evas object.
hThe new height of the Evas object.

Besides being resized, the object's EVAS_CALLBACK_RESIZE callback will be called.

Note
Newly created objects have zeroed dimensions. Then, you most probably want to use evas_object_resize() on them after they are created.
Be aware that resizing an object changes its drawing area, but that does imply the object is rescaled! For instance, images are filled inside their drawing area using the specifications of evas_object_image_fill_set(). Thus to scale the image to match exactly your drawing area, you need to change the evas_object_image_fill_set() as well.
This is more evident in images, but text, textblock, lines and polygons will behave similarly. Check their specific APIs to know how to achieve your desired behavior. Consider the following example:
// rescale image to fill exactly its area without tiling:
evas_object_resize(img, w, h);
evas_object_image_fill_set(img, 0, 0, w, h);

References evas_obj_size_set.

Referenced by ecore_evas_cursor_set(), ecore_evas_ews_background_set(), and ecore_evas_ews_new().

void evas_object_geometry_get ( const Evas_Object obj,
Evas_Coord *  x,
Evas_Coord *  y,
Evas_Coord *  w,
Evas_Coord *  h 
)

Retrieves the position and (rectangular) size of the given Evas object.

Parameters
objThe given Evas object.
xPointer to an integer in which to store the X coordinate of the object.
yPointer to an integer in which to store the Y coordinate of the object.
wPointer to an integer in which to store the width of the object.
hPointer to an integer in which to store the height of the object.

The position, naturally, will be relative to the top left corner of the canvas' viewport.

Note
Use NULL pointers on the geometry components you're not interested in: they'll be ignored by the function.

Example:

int w, h, cw, ch;
evas_object_geometry_get(d.img, NULL, NULL, &w, &h);
ecore_evas_geometry_get(d.ee, NULL, NULL, &cw, &ch);
if (w < cw)
evas_object_resize(d.img, cw, ch);
else
evas_object_resize(d.img, cw / 2, ch / 2);
return EINA_TRUE; /* re-issue the timer */

See the full example.

References evas_obj_position_get, and evas_obj_size_get.

Referenced by emotion_object_border_set(), and emotion_object_keep_aspect_set().

void evas_object_geometry_set ( Evas_Object obj,
Evas_Coord  x,
Evas_Coord  y,
Evas_Coord  w,
Evas_Coord  h 
)

Set the position and (rectangular) size of the given Evas object.

Parameters
objThe given Evas object.
xX position to move the object to, in canvas units.
yY position to move the object to, in canvas units.
wThe new width of the Evas object.
hThe new height of the Evas object.

The position, naturally, will be relative to the top left corner of the canvas' viewport.

If the object get moved, the object's EVAS_CALLBACK_MOVE callback will be called.

If the object get resized, the object's EVAS_CALLBACK_RESIZE callback will be called.

See also
evas_object_move()
evas_object_resize()
evas_object_geometry_get
Since
1.8

References evas_obj_position_set, and evas_obj_size_set.

void evas_object_show ( Evas_Object obj)

Makes the given Evas object visible.

Parameters
objThe given Evas object.

Besides becoming visible, the object's EVAS_CALLBACK_SHOW callback will be called.

See also
evas_object_hide() for more on object visibility.
evas_object_visible_get()

References EINA_TRUE, and evas_obj_visibility_set.

Referenced by ecore_evas_ews_background_set(), and emotion_object_bg_color_set().

void evas_object_hide ( Evas_Object obj)

Makes the given Evas object invisible.

Parameters
objThe given Evas object.

Hidden objects, besides not being shown at all in your canvas, won't be checked for changes on the canvas rendering process. Furthermore, they will not catch input events. Thus, they are much ligher (in processing needs) than an object that is invisible due to indirect causes, such as being clipped or out of the canvas' viewport.

Besides becoming hidden, obj object's EVAS_CALLBACK_SHOW callback will be called.

Note
All objects are created in the hidden state! If you want them shown, use evas_object_show() after their creation.
See also
evas_object_show()
evas_object_visible_get()

Example:

if (evas_object_visible_get(d.clipper))
{
evas_object_hide(d.clipper);
fprintf(stdout, "hidden\n");
}
else
{
evas_object_show(d.clipper);
fprintf(stdout, "visible\n");
}
return;

See the full example.

References EINA_FALSE, and evas_obj_visibility_set.

Referenced by edje_edit_part_del(), and emotion_object_bg_color_set().

Eina_Bool evas_object_visible_get ( const Evas_Object obj)

Retrieves whether or not the given Evas object is visible.

Parameters
objThe given Evas object.
Returns
EINA_TRUE if the object is visible, EINA_FALSE otherwise.

This retrieves an object's visibility as the one enforced by evas_object_show() and evas_object_hide().

Note
The value returned isn't, by any means, influenced by clippers covering obj, it being out of its canvas' viewport or stacked below other object.
See also
evas_object_show()
evas_object_hide() (for an example)

References EINA_FALSE, and evas_obj_visibility_get.

Referenced by emotion_object_bg_color_set().

void evas_object_color_set ( Evas_Object obj,
int  r,
int  g,
int  b,
int  a 
)

Sets the general/main color of the given Evas object to the given one.

Parameters
objThe given Evas object.
rThe red component of the given color.
gThe green component of the given color.
bThe blue component of the given color.
aThe alpha component of the given color.
See also
evas_object_color_get() (for an example)
Note
These color values are expected to be premultiplied by a.

References evas_obj_color_set.

Referenced by ecore_evas_ews_background_set(), and emotion_object_bg_color_set().

void evas_object_color_get ( const Evas_Object obj,
int *  r,
int *  g,
int *  b,
int *  a 
)

Retrieves the general/main color of the given Evas object.

Parameters
objThe given Evas object to retrieve color from.
rPointer to an integer in which to store the red component of the color.
gPointer to an integer in which to store the green component of the color.
bPointer to an integer in which to store the blue component of the color.
aPointer to an integer in which to store the alpha component of the color.

Retrieves the “main” color's RGB component (and alpha channel) values, which range from 0 to 255. For the alpha channel, which defines the object's transparency level, 0 means totally transparent, while 255 means opaque. These color values are premultiplied by the alpha value.

Usually you’ll use this attribute for text and rectangle objects, where the “main” color is their unique one. If set for objects which themselves have colors, like the images one, those colors get modulated by this one.

Note
All newly created Evas rectangles get the default color values of 255 255 255 255 (opaque white).
Use NULL pointers on the components you're not interested in: they'll be ignored by the function.

Example:

int alpha, r, g, b;
evas_object_color_get(d.clipper, &r, &g, &b, &alpha);
evas_color_argb_unpremul(alpha, &r, &g, &b);
alpha -= 20;
if (alpha < 0)
alpha = 255;
evas_color_argb_premul(alpha, &r, &g, &b);
evas_object_color_set(d.clipper, r, g, b, alpha);
fprintf(stdout, "Changing clipper's opacity: %d%%\n",
(int)((alpha / 255.0) * 100));
return;

See the full example.

References evas_obj_color_get.

Referenced by emotion_object_bg_color_get().

Evas* evas_object_evas_get ( const Evas_Object obj)

Retrieves the Evas canvas that the given object lives on.

Parameters
objThe given Evas object.
Returns
A pointer to the canvas where the object is on.

This function is most useful at code contexts where you need to operate on the canvas but have only the object pointer.

Referenced by ecore_evas_ews_background_set(), edje_perspective_global_set(), and evas_textblock_cursor_visible_range_get().

Evas_Object* evas_object_clip_get ( const Evas_Object obj)

Get the object clipping obj (if any).

Parameters
objThe object to get the clipper from

This function returns the object clipping obj. If obj is not being clipped at all, NULL is returned. The object obj must be a valid Evas_Object.

See also evas_object_clip_set(), evas_object_clip_unset() and evas_object_clipees_get().

Example:

if (evas_object_clip_get(d.img) == d.clipper)
{
fprintf(stdout, "off\n");
}
else
{
evas_object_clip_set(d.img, d.clipper);
fprintf(stdout, "on\n");
}
return;

See the full example.

Examples:
evas-object-manipulation.c.

References evas_obj_clip_get.

Referenced by edje_edit_part_clip_to_set().

void evas_object_clip_unset ( Evas_Object obj)

Disable/cease clipping on a clipped obj object.

Parameters
objThe object to cease clipping on

This function disables clipping for the object obj, if it was already clipped, i.e., its visibility and color get detached from the previous clipper. If it wasn't, this has no effect. The object obj must be a valid Evas_Object.

See also evas_object_clip_set() (for an example), evas_object_clipees_get() and evas_object_clip_get().

Examples:
evas-object-manipulation.c.

References evas_obj_clip_unset.

Referenced by edje_edit_part_clip_to_set().

const Eina_List* evas_object_clipees_get ( const Evas_Object obj)

Return a list of objects currently clipped by obj.

Parameters
objThe object to get a list of clippees from
Returns
a list of objects being clipped by obj

This returns the internal list handle that contains all objects clipped by the object obj. If none are clipped by it, the call returns NULL. This list is only valid until the clip list is changed and should be fetched again with another call to evas_object_clipees_get() if any objects being clipped by this object are unclipped, clipped by a new object, deleted or get the clipper deleted. These operations will invalidate the list returned, so it should not be used anymore after that point. Any use of the list after this may have undefined results, possibly leading to crashes. The object obj must be a valid Evas_Object.

See also evas_object_clip_set(), evas_object_clip_unset() and evas_object_clip_get().

Example:

extern Evas_Object *obj;
Evas_Object *clipper;
clipper = evas_object_clip_get(obj);
if (clipper)
{
Eina_List *clippees, *l;
Evas_Object *obj_tmp;
clippees = evas_object_clipees_get(clipper);
printf("Clipper clips %i objects\n", eina_list_count(clippees));
EINA_LIST_FOREACH(clippees, l, obj_tmp)
evas_object_show(obj_tmp);
}

References evas_obj_clipees_get.

Eina_Bool evas_object_clipees_has ( const Evas_Object obj)

Test if any object is clipped by obj.

Parameters
objThe object to get a list of clippees from
Returns
EINA_TRUE if obj clip any object.
Since
1.8

References evas_obj_clipees_has.

void evas_object_focus_set ( Evas_Object obj,
Eina_Bool  focus 
)

Sets or unsets a given object as the currently focused one on its canvas.

Parameters
objThe object to be focused or unfocused.
focusEINA_TRUE, to set it as focused or EINA_FALSE, to take away the focus from it.

Changing focus only affects where (key) input events go. There can be only one object focused at any time. If focus is EINA_TRUE, obj will be set as the currently focused object and it will receive all keyboard events that are not exclusive key grabs on other objects.

Example:

See the full example here.

See also
evas_object_focus_get
evas_focus_get
evas_object_key_grab
evas_object_key_ungrab
Examples:
ecore_evas_window_sizes_example.c, edje-basic.c, edje-box.c, edje-box2.c, edje-drag.c, edje-perspective.c, edje-signals-messages.c, evas-aspect-hints.c, evas-box.c, evas-events.c, evas-hints.c, evas-images.c, evas-images2.c, evas-map-utils.c, evas-object-manipulation.c, evas-smart-interface.c, evas-smart-object.c, evas-stacking.c, and evas-text.c.

References evas_obj_focus_set.

Eina_Bool evas_object_focus_get ( const Evas_Object obj)

Retrieve whether an object has the focus.

Parameters
objThe object to retrieve focus information from.
Returns
EINA_TRUE if the object has the focus, EINA_FALSE otherwise.

If the passed object is the currently focused one, EINA_TRUE is returned. EINA_FALSE is returned, otherwise.

Example:

fprintf(stdout, "And again: %s\n", evas_object_focus_get(event_info) ?
"OK!" : "Oops, something is bad.");

See the full example here.

See also
evas_object_focus_set
evas_focus_get
evas_object_key_grab
evas_object_key_ungrab
Examples:
evas-events.c.

References evas_obj_focus_get.

void evas_object_layer_set ( Evas_Object obj,
short  l 
)

Sets the layer of its canvas that the given object will be part of.

Parameters
objThe given Evas object.
lThe number of the layer to place the object on. Must be between EVAS_LAYER_MIN and EVAS_LAYER_MAX.

If you don't use this function, you'll be dealing with an unique layer of objects, the default one. Additional layers are handy when you don't want a set of objects to interfere with another set with regard to stacking. Two layers are completely disjoint in that matter.

This is a low-level function, which you'd be using when something should be always on top, for example.

Warning
Be careful, it doesn't make sense to change the layer of smart objects' children. Smart objects have a layer of their own, which should contain all their children objects.
See also
evas_object_layer_get()
Examples:
eina_tiler_01.c, ephysics_logo.c, and evas-stacking.c.

References evas_obj_layer_set.

Referenced by ecore_evas_ews_background_set().

short evas_object_layer_get ( const Evas_Object obj)

Retrieves the layer of its canvas that the given object is part of.

Parameters
objThe given Evas object to query layer from
Returns
Number of its layer
See also
evas_object_layer_set()
Examples:
evas-stacking.c.

References evas_obj_layer_get.

void evas_object_name_set ( Evas_Object obj,
const char *  name 
)

Sets the name of the given Evas object to the given name.

Parameters
objThe given object.
nameThe given name.

There might be occasions where one would like to name his/her objects.

Example:

d.bg = evas_object_rectangle_add(d.canvas);
evas_object_name_set(d.bg, "our dear rectangle");

See the full example.

Examples:
edje-box2.c, emotion_basic_example.c, emotion_signals_example.c, evas-events.c, evas-map-utils.c, evas-object-manipulation.c, and evas-stacking.c.

References evas_obj_name_set.

Referenced by edje_perspective_global_set().

const char* evas_object_name_get ( const Evas_Object obj)

Retrieves the name of the given Evas object.

Parameters
objThe given object.
Returns
The name of the object or NULL, if no name has been given to it.

Example:

fprintf(stdout, "An object got focused: %s\n",
evas_object_name_get(event_info));
fprintf(stdout, "Let's recheck it: %s\n",

See the full example.

Examples:
evas-events.c, and evas-stacking.c.

References evas_obj_name_get.

const char* evas_object_type_get ( const Evas_Object obj)

Retrieves the type of the given Evas object.

Parameters
objThe given object.
Returns
The type of the object.

For Evas' builtin types, the return strings will be one of:

  • "rectangle",
  • "line",
  • "polygon",
  • "text",
  • "textblock" and
  • "image".

For Evas smart objects (see Smart Functions), the name of the smart class itself is returned on this call. For the built-in smart objects, these names are:

  • "EvasObjectSmartClipped", for the clipped smart object
  • "Evas_Object_Box", for the box object and
  • "Evas_Object_Table", for the table object.

Example:

d.img = evas_object_image_filled_add(d.canvas);
evas_object_image_file_set(d.img, img_path, NULL);
if (err != EVAS_LOAD_ERROR_NONE)
{
goto panic;
}
else
{
evas_object_move(d.img, 0, 0);
evas_object_resize(d.img, WIDTH, HEIGHT);
fprintf(stdout, "Image object added, type is: %s\n",
}
/* border on the image's clipper, here just to emphasize its position */

See the full example.

Examples:
evas-object-manipulation.c.

References evas_obj_type_get.

void evas_object_raise ( Evas_Object obj)

Raise obj to the top of its layer.

Parameters
objthe object to raise

obj will, then, be the highest one in the layer it belongs to. Object on other layers won't get touched.

See also
evas_object_stack_above()
evas_object_stack_below()
evas_object_lower()
Examples:
evas-stacking.c.

References evas_obj_raise.

void evas_object_lower ( Evas_Object obj)

Lower obj to the bottom of its layer.

Parameters
objthe object to lower

obj will, then, be the lowest one in the layer it belongs to. Objects on other layers won't get touched.

See also
evas_object_stack_above()
evas_object_stack_below()
evas_object_raise()
Examples:
evas-stacking.c.

References evas_obj_lower.

Referenced by ecore_evas_ews_background_set().

void evas_object_stack_above ( Evas_Object obj,
Evas_Object above 
)

Stack obj immediately above above.

Parameters
objthe object to stack
abovethe object above which to stack

Objects, in a given canvas, are stacked in the order they get added to it. This means that, if they overlap, the highest ones will cover the lowest ones, in that order. This function is a way to change the stacking order for the objects.

This function is intended to be used with objects belonging to the same layer in a given canvas, otherwise it will fail (and accomplish nothing).

If you have smart objects on your canvas and obj is a member of one of them, then above must also be a member of the same smart object.

Similarly, if obj is not a member of a smart object, above must not be either.

See also
evas_object_layer_get()
evas_object_layer_set()
evas_object_stack_below()
Examples:
evas-stacking.c.

References evas_obj_stack_above.

Referenced by edje_edit_part_restack_above(), and edje_edit_part_restack_below().

void evas_object_stack_below ( Evas_Object obj,
Evas_Object below 
)

Stack obj immediately below below.

Parameters
objthe object to stack
belowthe object below which to stack

Objects, in a given canvas, are stacked in the order they get added to it. This means that, if they overlap, the highest ones will cover the lowest ones, in that order. This function is a way to change the stacking order for the objects.

This function is intended to be used with objects belonging to the same layer in a given canvas, otherwise it will fail (and accomplish nothing).

If you have smart objects on your canvas and obj is a member of one of them, then below must also be a member of the same smart object.

Similarly, if obj is not a member of a smart object, below must not be either.

See also
evas_object_layer_get()
evas_object_layer_set()
evas_object_stack_below()
Examples:
evas-stacking.c.

References evas_obj_stack_below.

Referenced by edje_edit_part_restack_below().

Evas_Object* evas_object_above_get ( const Evas_Object obj)

Get the Evas object stacked right above obj.

Parameters
objan Evas_Object
Returns
the Evas_Object directly above obj, if any, or NULL, if none

This function will traverse layers in its search, if there are objects on layers above the one obj is placed at.

See also
evas_object_layer_get()
evas_object_layer_set()
evas_object_below_get()
Examples:
evas-stacking.c.

References evas_obj_above_get.

Evas_Object* evas_object_below_get ( const Evas_Object obj)

Get the Evas object stacked right below obj.

Parameters
objan Evas_Object
Returns
the Evas_Object directly below obj, if any, or NULL, if none

This function will traverse layers in its search, if there are objects on layers below the one obj is placed at.

See also
evas_object_layer_get()
evas_object_layer_set()
evas_object_below_get()
Examples:
evas-stacking.c.

References evas_obj_below_get.