Almost every evas object created will have some generic function used to manipulate it. More...
Functions | |
void | evas_object_clip_set (Evas_Object *obj, Evas_Object *clip) |
Clip one object to another. More... | |
Evas_Object * | evas_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_List * | evas_object_clipees_get (const Evas_Object *obj) |
Return a list of objects currently 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... | |
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_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... | |
Evas * | evas_object_evas_get (const Evas_Object *obj) |
Retrieves the Evas canvas that the given object lives on. 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_Object * | evas_object_above_get (const Evas_Object *obj) |
Get the Evas object stacked right above obj . More... | |
Evas_Object * | evas_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).
Function Documentation
Evas_Object* evas_object_above_get | ( | const Evas_Object * | obj | ) |
Get the Evas object stacked right above obj
.
- Parameters
-
obj an Evas_Object
- Returns
- the Evas_Object directly above
obj
, if any, orNULL
, if none
This function will traverse layers in its search, if there are objects on layers above the one obj
is placed at.
Evas_Object* evas_object_below_get | ( | const Evas_Object * | obj | ) |
Get the Evas object stacked right below obj
.
- Parameters
-
obj an Evas_Object
- Returns
- the Evas_Object directly below
obj
, if any, orNULL
, if none
This function will traverse layers in its search, if there are objects on layers below the one obj
is placed at.
Referenced by evas_event_feed_mouse_move().
Evas_Object* evas_object_clip_get | ( | const Evas_Object * | obj | ) |
Get the object clipping obj
(if any).
- Parameters
-
obj The 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:
See the full example.
void evas_object_clip_set | ( | Evas_Object * | obj, |
Evas_Object * | clip | ||
) |
Clip one object to another.
- Parameters
-
obj The object to be clipped clip The 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:

- 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 beNULL
, in which case the effect of this function is the same as calling evas_object_clip_unset() on theobj
object.
Example:
See the full example.
References evas_damage_rectangle_add(), evas_event_feed_mouse_move(), and evas_object_clip_unset().
void evas_object_clip_unset | ( | Evas_Object * | obj | ) |
Disable/cease clipping on a clipped obj
object.
- Parameters
-
obj The 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().
References evas_damage_rectangle_add(), and evas_event_feed_mouse_move().
Referenced by evas_object_clip_set(), and evas_object_del().
const Eina_List* evas_object_clipees_get | ( | const Evas_Object * | obj | ) |
Return a list of objects currently clipped by obj
.
- Parameters
-
obj The 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:
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
-
obj The given Evas object to retrieve color from. r Pointer to an integer in which to store the red component of the color. g Pointer to an integer in which to store the green component of the color. b Pointer to an integer in which to store the blue component of the color. a Pointer 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:
See the full example.
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
-
obj The given Evas object. r The red component of the given color. g The green component of the given color. b The blue component of the given color. a The 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_RENDER_BLEND.
void evas_object_del | ( | Evas_Object * | obj | ) |
Marks the given Evas object for deletion (when Evas will free its memory).
- Parameters
-
obj The 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 EVAS_CALLBACK_DEL, EVAS_CALLBACK_FOCUS_OUT, EVAS_CALLBACK_FREE, evas_object_clip_unset(), evas_object_hide(), evas_object_image_source_unset(), evas_object_map_set(), and evas_object_name_set().
Referenced by evas_object_box_remove_all(), evas_object_grid_clear(), evas_object_smart_add(), evas_object_table_clear(), and evas_object_unref().
Evas* evas_object_evas_get | ( | const Evas_Object * | obj | ) |
Retrieves the Evas canvas that the given object lives on.
- Parameters
-
obj The 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 evas_object_box_add_to(), evas_object_grid_add_to(), evas_object_table_add_to(), and evas_textblock_cursor_visible_range_get().
Eina_Bool evas_object_focus_get | ( | const Evas_Object * | obj | ) |
Retrieve whether an object has the focus.
- Parameters
-
obj The 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:
See the full example here.
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
-
obj The object to be focused or unfocused. focus EINA_TRUE
, to set it as focused orEINA_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.
References EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT, EVAS_CALLBACK_FOCUS_IN, EVAS_CALLBACK_FOCUS_OUT, and evas_object_focus_set().
Referenced by evas_object_focus_set().
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
-
obj The given Evas object. x Pointer to an integer in which to store the X coordinate of the object. y Pointer to an integer in which to store the Y coordinate of the object. w Pointer to an integer in which to store the width of the object. h Pointer 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:
See the full example.
References evas_output_framespace_get().
Referenced by evas_object_box_layout_flow_horizontal(), evas_object_box_layout_flow_vertical(), evas_object_box_layout_homogeneous_horizontal(), evas_object_box_layout_homogeneous_max_size_horizontal(), evas_object_box_layout_homogeneous_max_size_vertical(), evas_object_box_layout_homogeneous_vertical(), evas_object_box_layout_horizontal(), evas_object_box_layout_stack(), evas_object_box_layout_vertical(), and evas_object_image_filled_set().
void evas_object_hide | ( | Evas_Object * | obj | ) |
Makes the given Evas object invisible.
- Parameters
-
obj The 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.
Example:
See the full example.
References evas_event_feed_mouse_move().
Referenced by evas_object_del().
short evas_object_layer_get | ( | const Evas_Object * | obj | ) |
Retrieves the layer of its canvas that the given object is part of.
- Parameters
-
obj The given Evas object to query layer from
- Returns
- Number of its layer
- See Also
- evas_object_layer_set()
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
-
obj The given Evas object. l The 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()
References evas_event_feed_mouse_move(), and evas_object_raise().
void evas_object_lower | ( | Evas_Object * | obj | ) |
Lower obj
to the bottom of its layer.
- Parameters
-
obj the object to lower
obj
will, then, be the lowest one in the layer it belongs to. Objects on other layers won't get touched.
References evas_event_feed_mouse_move().
Referenced by evas_object_stack_below().
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
-
obj The given Evas object. x X position to move the object to, in canvas units. y Y 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:
See the full example.
References evas_event_feed_mouse_move(), and evas_output_framespace_get().
Referenced by evas_object_box_layout_flow_horizontal(), evas_object_box_layout_flow_vertical(), evas_object_box_layout_homogeneous_horizontal(), evas_object_box_layout_homogeneous_max_size_horizontal(), evas_object_box_layout_homogeneous_max_size_vertical(), evas_object_box_layout_homogeneous_vertical(), evas_object_box_layout_horizontal(), evas_object_box_layout_stack(), evas_object_box_layout_vertical(), and evas_object_smart_move_children_relative().
const char* evas_object_name_get | ( | const Evas_Object * | obj | ) |
Retrieves the name of the given Evas object.
- Parameters
-
obj The given object.
- Returns
- The name of the object or
NULL
, if no name has been given to it.
Example:
See the full example.
void evas_object_name_set | ( | Evas_Object * | obj, |
const char * | name | ||
) |
Sets the name of the given Evas object to the given name.
- Parameters
-
obj The given object. name The given name.
There might be occasions where one would like to name his/her objects.
Example:
See the full example.
Referenced by evas_object_del().
void evas_object_raise | ( | Evas_Object * | obj | ) |
Raise obj
to the top of its layer.
- Parameters
-
obj the object to raise
obj
will, then, be the highest one in the layer it belongs to. Object on other layers won't get touched.
References evas_event_feed_mouse_move().
Referenced by evas_object_layer_set(), and evas_object_stack_above().
void evas_object_ref | ( | Evas_Object * | obj | ) |
Increments object reference count to defer its deletion.
- Parameters
-
obj The 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:
- Since
- 1.1
int evas_object_ref_get | ( | const Evas_Object * | obj | ) |
Get the object reference count.
- Parameters
-
obj The 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.
- Since
- 1.2
void evas_object_resize | ( | Evas_Object * | obj, |
Evas_Coord | w, | ||
Evas_Coord | h | ||
) |
Changes the size of the given Evas object.
- Parameters
-
obj The given Evas object. w The new width of the Evas object. h The 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:
References evas_event_feed_mouse_move().
Referenced by evas_object_box_layout_homogeneous_horizontal(), evas_object_box_layout_homogeneous_max_size_horizontal(), evas_object_box_layout_homogeneous_max_size_vertical(), evas_object_box_layout_homogeneous_vertical(), evas_object_box_layout_horizontal(), evas_object_box_layout_stack(), and evas_object_box_layout_vertical().
void evas_object_show | ( | Evas_Object * | obj | ) |
Makes the given Evas object visible.
- Parameters
-
obj The 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 evas_event_feed_mouse_move().
void evas_object_stack_above | ( | Evas_Object * | obj, |
Evas_Object * | above | ||
) |
Stack obj
immediately above above
.
- Parameters
-
obj the object to stack above the 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.
References evas_event_feed_mouse_move(), and evas_object_raise().
Referenced by evas_object_box_layout_stack().
void evas_object_stack_below | ( | Evas_Object * | obj, |
Evas_Object * | below | ||
) |
Stack obj
immediately below below
.
- Parameters
-
obj the object to stack below the 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.
References evas_event_feed_mouse_move(), and evas_object_lower().
const char* evas_object_type_get | ( | const Evas_Object * | obj | ) |
Retrieves the type of the given Evas object.
- Parameters
-
obj The 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:
See the full example.
void evas_object_unref | ( | Evas_Object * | obj | ) |
Decrements object reference count.
- Parameters
-
obj The 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().
Eina_Bool evas_object_visible_get | ( | const Evas_Object * | obj | ) |
Retrieves whether or not the given Evas object is visible.
- Parameters
-
obj The 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)