Tizen Native API
Basic Object Manipulation

Functions

Evasevas_object_evas_get (const Evas_Common_Interface *obj)
 Gets the Evas canvas that the given object lives on.
const char * evas_object_type_get (const Evas_Object *obj)
 Retrieves the type of the given Evas object.
void evas_object_layer_set (Evas_Object *obj, short l)
 Sets the layer of its canvas that the given object will be part of.
short evas_object_layer_get (const Evas_Object *obj)
 Retrieves the layer of its canvas that the given object is part of.
void evas_object_clip_set (Evas_Object *obj, Evas_Object *clip)
 Clip one object to another.
Evas_Objectevas_object_clip_get (const Evas_Object *obj)
 Get the object clipping obj (if any).
void evas_object_name_set (Evas_Object *obj, const char *name)
 Sets the name of the given Evas object to the given name.
const char * evas_object_name_get (const Evas_Object *obj)
 Retrieves the name of the given Evas object.
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.
Eina_Bool evas_object_focus_get (const Evas_Object *obj)
 Retrieve whether an object has the focus.
Evas_Objectevas_object_below_get (const Evas_Object *obj)
 Get the Evas object stacked right below obj.
const Eina_Listevas_object_clipees_get (const Evas_Object *obj)
 Return a list of objects currently clipped by obj.
Evas_Objectevas_object_above_get (const Evas_Object *obj)
 Get the Evas object stacked right above obj.
void evas_object_stack_below (Evas_Object *obj, Evas_Object *below)
 Stack obj immediately below below.
void evas_object_raise (Evas_Object *obj)
 Raise obj to the top of its layer.
void evas_object_stack_above (Evas_Object *obj, Evas_Object *above)
 Stack obj immediately above above.
void evas_object_lower (Evas_Object *obj)
 Lower obj to the bottom of its layer.
void evas_object_clip_unset (Evas_Object *obj)
 Disable/cease clipping on a clipped obj object.
void evas_object_ref (Evas_Object *obj)
 Increments object reference count to defer its deletion.
void evas_object_unref (Evas_Object *obj)
 Decrements object reference count.
int evas_object_ref_get (const Evas_Object *obj)
 Get the object reference count.
void evas_object_del (Evas_Object *obj)
 Marks the given Evas object for deletion (when Evas will free its memory).
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.
void evas_object_show (Evas_Object *obj)
 Makes the given Evas object visible.
void evas_object_hide (Evas_Object *obj)
 Makes the given Evas object invisible.
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.
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.
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.
void evas_object_resize (Evas_Object *obj, Evas_Coord w, Evas_Coord h)
 Changes the size of the given Evas object.
Eina_Bool evas_object_visible_get (const Evas_Object *obj)
 Retrieves whether or not the given Evas object is visible.

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).


Function Documentation

Get the Evas object stacked right above obj.

Since :
2.3
Returns:
the Evas_Object directly above obj, if any, or NULL, if none
Remarks:
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()
Parameters:
[in]objThe evas object

Get the Evas object stacked right below obj.

Since :
2.3
Returns:
the Evas_Object directly below obj, if any, or NULL, if none
Remarks:
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()
Parameters:
[in]objThe evas object

Get the object clipping obj (if any).

Since :
2.3
Remarks:
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:

See the full example.

Parameters:
[in]objThe evas object
void evas_object_clip_set ( Evas_Object obj,
Evas_Object clip 
)

Clip one object to another.

Since :
2.3
Remarks:
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
Remarks:
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:

See the full example.

Parameters:
[in]objThe evas object
[in]clipThe object to clip obj by

Disable/cease clipping on a clipped obj object.

Since :
2.3
Remarks:
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().
Parameters:
[in]objThe evas object

Return a list of objects currently clipped by obj.

Since :
2.3
Returns:
a list of objects being clipped by obj
Remarks:
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);
 }
Parameters:
[in]objThe evas object
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.

Since :
2.3
Remarks:
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.
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:
See the full example.
Parameters:
[in]objThe given Evas object.
[out]rThe red component of the given color.
[out]gThe green component of the given color.
[out]bThe blue component of the given color.
[out]aThe alpha component of the given color.
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.

Since :
2.3
See also:
evas_object_color_get() (for an example)
Remarks:
These color values are expected to be premultiplied by a.
Parameters:
[in]objThe given Evas object.
[in]rThe red component of the given color.
[in]gThe green component of the given color.
[in]bThe blue component of the given color.
[in]aThe alpha component of the given color.
void evas_object_del ( Evas_Object obj)

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

Since :
2.3
Parameters:
[in]objThe given Evas object.
Remarks:
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()
Evas* evas_object_evas_get ( const Evas_Common_Interface *  obj)

Gets the Evas canvas that the given object lives on.

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

Since :
2.3
Parameters:
[in]objThe given Evas object
Returns:
A pointer to the canvas where the object is on
Parameters:
[in]objThe common interface

Retrieve whether an object has the focus.

Since :
2.3
Returns:
EINA_TRUE if the object has the focus, EINA_FALSE otherwise.
Remarks:
If the passed object is the currently focused one, EINA_TRUE is returned. EINA_FALSE is returned, otherwise.
Example:
See the full example here.
See also:
evas_object_focus_set
evas_object_key_grab
evas_object_key_ungrab
Parameters:
[in]objThe evas object
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.

Since :
2.3
Remarks:
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_object_key_grab
evas_object_key_ungrab
Parameters:
[in]objThe evas object
[in]focusEINA_TRUE, to set it as focused or EINA_FALSE, to take away the focus from it.
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.

Since :
2.3
Parameters:
[in]objThe given Evas object.
[out]xPointer to an integer in which to store the X coordinate of the object.
[out]yPointer to an integer in which to store the Y coordinate of the object.
[out]wPointer to an integer in which to store the width of the object.
[out]hPointer to an integer in which to store the height of the object.
Remarks:
The position, naturally, will be relative to the top left corner of the canvas' viewport.
Use NULL pointers on the geometry components you're not interested in: they'll be ignored by the function.
Example:
See the full example.
void evas_object_hide ( Evas_Object obj)

Makes the given Evas object invisible.

Since :
2.3
Parameters:
[in]objThe given Evas object.
Remarks:
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.
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()
Remarks:
Example:
See the full example.
short evas_object_layer_get ( const Evas_Object obj)

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

Since :
2.3
Returns:
Number of its layer
See also:
evas_object_layer_set()
Parameters:
[in]objThe evas object
void evas_object_layer_set ( Evas_Object obj,
short  l 
)

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

Since :
2.3
Remarks:
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()
Parameters:
[in]objThe evas object
[in]lThe number of the layer to place the object on. Must be between EVAS_LAYER_MIN and EVAS_LAYER_MAX.
void evas_object_lower ( Evas_Object obj)

Lower obj to the bottom of its layer.

Since :
2.3

obj will, then, be the lowest one in the layer it belongs

Remarks:
to. Objects on other layers won't get touched.
See also:
evas_object_stack_above()
evas_object_stack_below()
evas_object_raise()
Parameters:
[in]objThe evas object
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.

Since :
2.3
Parameters:
[in]objThe given Evas object.
[in]xin
[in]yin
const char* evas_object_name_get ( const Evas_Object obj)

Retrieves the name of the given Evas object.

Since :
2.3
Returns:
The name of the object or NULL, if no name has been given to it.
Remarks:
Example:

See the full example.

Parameters:
[in]objThe evas object
void evas_object_name_set ( Evas_Object obj,
const char *  name 
)

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

Since :
2.3
Remarks:
There might be occasions where one would like to name his/her objects.
Example:

See the full example.

Parameters:
[in]objThe evas object
[in]nameThe given name.
void evas_object_raise ( Evas_Object obj)

Raise obj to the top of its layer.

Since :
2.3

obj will, then, be the highest one in the layer it belongs

Remarks:
to. Object on other layers won't get touched.
See also:
evas_object_stack_above()
evas_object_stack_below()
evas_object_lower()
Parameters:
[in]objThe evas object
void evas_object_ref ( Evas_Object obj)

Increments object reference count to defer its deletion.

Since :
2.3
Parameters:
[in]objThe given Evas object to reference
Remarks:
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()
Remarks:
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:
  evas_object_ref(obj);

  // action here...
  evas_object_smart_callback_call(obj, SIG_SELECTED, NULL);
  // more action here...
  evas_object_unref(obj);
Since (EFL) :
1.1
int evas_object_ref_get ( const Evas_Object obj)

Get the object reference count.

Since :
2.3
Parameters:
[in]objThe given Evas object to query
Remarks:
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 (EFL) :
1.2
void evas_object_resize ( Evas_Object obj,
Evas_Coord  w,
Evas_Coord  h 
)

Changes the size of the given Evas object.

Since :
2.3
Parameters:
[in]objThe given Evas object.
[in]win
[in]hin
void evas_object_show ( Evas_Object obj)

Makes the given Evas object visible.

Since :
2.3
Parameters:
[in]objThe given Evas object.
Remarks:
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()
void evas_object_stack_above ( Evas_Object obj,
Evas_Object above 
)

Stack obj immediately above above.

Since :
2.3
Remarks:
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()
Parameters:
[in]objThe evas object
[in]abovethe object above which to stack
void evas_object_stack_below ( Evas_Object obj,
Evas_Object below 
)

Stack obj immediately below below.

Since :
2.3
Remarks:
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()
Parameters:
[in]objThe evas object
[in]belowthe object below which to stack
const char* evas_object_type_get ( const Evas_Object obj)

Retrieves the type of the given Evas object.

Since :
2.3
Returns:
The type of the object.
Remarks:
For Evas' builtin types, the return strings will be one of:
  • "rectangle",
  • "line",
  • "polygon",
  • "text",
  • "textblock" and
  • "image".
For Evas smart objects (see Evas_Smart_Group), 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:

See the full example.

Parameters:
[in]objThe evas object
void evas_object_unref ( Evas_Object obj)

Decrements object reference count.

Since :
2.3
Parameters:
[in]objThe given Evas object to unreference
Remarks:
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 (EFL) :
1.1

Retrieves whether or not the given Evas object is visible.

Since :
2.3