Basic Object Manipulation
[Generic Object Functions]

Methods that are often used, like those that change the color, clippers and geometry of the object. More...

Functions

EAPI void evas_object_clip_set (Evas_Object *obj, Evas_Object *clip)
 Clip one object to another.
EAPI Evas_Objectevas_object_clip_get (const Evas_Object *obj)
 Get the object clipping this one (if any).
EAPI void evas_object_clip_unset (Evas_Object *obj)
 Disable clipping for an object.
EAPI const Eina_List * evas_object_clipees_get (const Evas_Object *obj)
 Return a list of objects currently clipped by a specific object.
EAPI void evas_object_focus_set (Evas_Object *obj, Eina_Bool focus)
 Sets focus to the given object.
EAPI Eina_Bool evas_object_focus_get (const Evas_Object *obj)
 Test if the object has focus.
EAPI void evas_object_layer_set (Evas_Object *obj, short l)
 Sets the layer of the evas that the given object will be part of.
EAPI short evas_object_layer_get (const Evas_Object *obj)
 Retrieves the layer of the evas that the given object is part of.
EAPI void evas_object_name_set (Evas_Object *obj, const char *name)
 Sets the name of the given evas object to the given name.
EAPI const char * evas_object_name_get (const Evas_Object *obj)
 Retrieves the name of the given evas object.
EAPI void evas_object_del (Evas_Object *obj)
 Deletes the given evas object and frees its memory.
EAPI void evas_object_move (Evas_Object *obj, Evas_Coord x, Evas_Coord y)
 Moves the given evas object to the given location.
EAPI void evas_object_resize (Evas_Object *obj, Evas_Coord w, Evas_Coord h)
 Changes the size of the given evas object.
EAPI 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.
EAPI void evas_object_show (Evas_Object *obj)
 Makes the given evas object visible.
EAPI void evas_object_hide (Evas_Object *obj)
 Makes the given evas object invisible.
EAPI Eina_Bool evas_object_visible_get (const Evas_Object *obj)
 Retrieves whether or not the given evas object is visible.
EAPI void evas_object_color_set (Evas_Object *obj, int r, int g, int b, int a)
 Sets the general colour of the given evas object to the given colour.
EAPI void evas_object_color_get (const Evas_Object *obj, int *r, int *g, int *b, int *a)
 Retrieves the general colour of the given evas object.
EAPI Evasevas_object_evas_get (const Evas_Object *obj)
 Retrieves the evas that the given evas object is on.
EAPI const char * evas_object_type_get (const Evas_Object *obj)
 Retrieves the name of the type of the given evas object.
EAPI void evas_object_raise (Evas_Object *obj)
 Raise obj to the top of its layer.
EAPI void evas_object_lower (Evas_Object *obj)
 Lower obj to the bottom of its layer.
EAPI void evas_object_stack_above (Evas_Object *obj, Evas_Object *above)
 Stack obj immediately above above.
EAPI void evas_object_stack_below (Evas_Object *obj, Evas_Object *below)
 Stack obj immediately below below.
EAPI Evas_Objectevas_object_above_get (const Evas_Object *obj)
 Get the evas object above obj.
EAPI Evas_Objectevas_object_below_get (const Evas_Object *obj)
 Get the evas object below obj.

Detailed Description

Methods that are often used, like those that change the color, clippers and geometry of the object.


Function Documentation

EAPI Evas_Object* evas_object_above_get ( const Evas_Object obj  ) 

Get the evas object above obj.

Parameters:
obj an Evas_Object
Returns:
the Evas_Object directly above
EAPI Evas_Object* evas_object_below_get ( const Evas_Object obj  ) 

Get the evas object below obj.

Parameters:
obj an Evas_Object
Returns:
the Evas_Object directly below
EAPI Evas_Object* evas_object_clip_get ( const Evas_Object obj  ) 

Get the object clipping this one (if any).

Parameters:
obj The object to get the clipper from

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

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

Example:

 extern Evas_Object *obj;
 Evas_Object *clipper;

 clipper = evas_object_clip_get(obj);
 if (clipper) evas_object_show(clipper);
EAPI 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 clipper. 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 object, so the resulting color for the clipped object is RESULT = (OBJ * CLIP) / (255 * 255) per color element (red, green, blue and alpha). Clipping is recursive, so clip objects may be clipped by other objects, and their color will in tern 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 as normal, those that clip 1 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, the objects clipped will not be shown either. If the object was being clipped by another object when this function is called, it is implicitly removed from the clipper it is being clipped to, and now is made to clip its new clipper.

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 may 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:

 extern Evas *evas;
 extern Evas_Object *obj;
 Evas_Object *clipper;

 clipper = evas_object_rectangle_add(evas);
 evas_object_color_set(clipper, 255, 255, 255, 255);
 evas_object_move(clipper, 10, 10);
 evas_object_resize(clipper, 20, 50);
 evas_object_clip_set(obj, clipper);
 evas_object_show(clipper);

References evas_damage_rectangle_add(), evas_event_feed_mouse_move(), and evas_object_clip_unset().

EAPI void evas_object_clip_unset ( Evas_Object obj  ) 

Disable clipping for an object.

Parameters:
obj The object to cease clipping on

This function disables clipping for the object obj, if it was already clipped. If it wasn't, this has no effect. The object obj must be a valid object.

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

Example:

 extern Evas_Object *obj;
 Evas_Object *clipper;

 clipper = evas_object_clip_get(obj);
 if (clipper)
   {
     evas_object_clip_unset(obj);
     evas_object_hide(obj);
   }

References evas_damage_rectangle_add(), and evas_event_feed_mouse_move().

Referenced by evas_object_clip_set(), and evas_object_del().

EAPI const Eina_List* evas_object_clipees_get ( const Evas_Object obj  ) 

Return a list of objects currently clipped by a specific object.

Parameters:
obj The object to get a list of clippees from

This returns the inernal list handle that contains all objects clipped by the object obj. If none are clipped, it 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, are deleted or the clipper is 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, not limited just to strange behavior but possible segfaults and other strange memory errors. The object obj must be a valid 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);
   }
EAPI void evas_object_color_get ( const Evas_Object obj,
int *  r,
int *  g,
int *  b,
int *  a 
)

Retrieves the general colour of the given evas object.

Note that if any of r, g, b or a are NULL, then the NULL parameters are ignored.

Parameters:
obj The given evas object.
r Pointer to an integer in which to store the red component of the colour.
g Pointer to an integer in which to store the green component of the colour.
b Pointer to an integer in which to store the blue component of the colour.
a Pointer to an integer in which to store the alpha component of the colour.
EAPI void evas_object_color_set ( Evas_Object obj,
int  r,
int  g,
int  b,
int  a 
)

Sets the general colour of the given evas object to the given colour.

Parameters:
obj The given evas object.
r The red component of the given colour.
g The green component of the given colour.
b The blue component of the given colour.
a The alpha component of the given colour.

References EVAS_RENDER_BLEND.

EAPI void evas_object_del ( Evas_Object obj  ) 

Deletes the given evas object and frees its memory.

The object's 'free' callback is called when this function is called. If the object currently has the focus, its 'focus out' callback is also called.

Parameters:
obj The given evas object.

References EVAS_CALLBACK_DEL, EVAS_CALLBACK_FOCUS_OUT, EVAS_CALLBACK_FREE, evas_object_clip_unset(), evas_object_hide(), and evas_object_name_set().

Referenced by evas_object_box_remove_all(), and evas_object_table_clear().

EAPI Evas* evas_object_evas_get ( const Evas_Object obj  ) 

Retrieves the evas that the given evas object is on.

Parameters:
obj The given evas object.
Returns:
The evas that the object is on.

Referenced by evas_object_box_add_to(), and evas_object_table_add_to().

EAPI Eina_Bool evas_object_focus_get ( const Evas_Object obj  ) 

Test if the object has focus.

Parameters:
obj The object to be tested.

If the passed object is the currently focused object 1 is returned, 0 otherwise.

See also:
evas_object_focus_set
evas_focus_get
evas_object_key_grab
evas_object_key_ungrab
Returns:
1 if the object has the focus, 0 otherwise.
EAPI void evas_object_focus_set ( Evas_Object obj,
Eina_Bool  focus 
)

Sets focus to the given object.

Parameters:
obj The object to be focused or unfocused.
focus set or remove focus to the object.

Changing focus only affects where key events go. There can be only one object focused at any time.

If the parameter (focus) is set, the passed object will be set as the currently focused object. It will receive all keyboard events that are not exclusive key grabs on other objects.

See also:
evas_object_focus_get
evas_focus_get
evas_object_key_grab
evas_object_key_ungrab

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

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

Note that if any of x, y, w or h are NULL, the NULL parameters are ignored.

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.

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

EAPI void evas_object_hide ( Evas_Object obj  ) 

Makes the given evas object invisible.

Parameters:
obj The given evas object.
Note:
the hidden objects will not be checked for changes and will not catch events. That is, they are much ligher than an object that is invisible due indirect effects, such as clipped or out-of-viewport.

References _Evas_Event_Mouse_Out::buttons, EVAS_CALLBACK_MOUSE_OUT, evas_event_feed_mouse_move(), and EVAS_EVENT_FLAG_NONE.

Referenced by evas_object_del().

EAPI short evas_object_layer_get ( const Evas_Object obj  ) 

Retrieves the layer of the evas that the given object is part of.

Be careful, it doesn't make sense to change the layer of smart object's child. So the returned value could be wrong in some case. Don't rely on it's accuracy.

Parameters:
obj The given evas object.
Returns:
Number of the layer.
EAPI void evas_object_layer_set ( Evas_Object obj,
short  l 
)

Sets the layer of the evas that the given object will be part of.

It is not possible to change the layer of a smart object's child.

Parameters:
obj The given evas object.
l The number of the layer to place the object on. Between EVAS_LAYER_MIN and EVAS_LAYER_MAX.

References evas_event_feed_mouse_move(), and evas_object_raise().

EAPI void evas_object_lower ( Evas_Object obj  ) 

Lower obj to the bottom of its layer.

Parameters:
obj the object to lower

References evas_event_feed_mouse_move().

Referenced by evas_object_stack_below().

EAPI void evas_object_move ( Evas_Object obj,
Evas_Coord  x,
Evas_Coord  y 
)
EAPI 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. NULL if no name has been given to the object.
EAPI 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.

Referenced by evas_object_del().

EAPI void evas_object_raise ( Evas_Object obj  ) 

Raise obj to the top of its layer.

Parameters:
obj the object to raise

References evas_event_feed_mouse_move().

Referenced by evas_object_layer_set(), and evas_object_stack_above().

EAPI 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.
Note:
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. 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);
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.

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

EAPI void evas_object_show ( Evas_Object obj  ) 

Makes the given evas object visible.

Parameters:
obj The given evas object.

References evas_event_feed_mouse_move().

EAPI void evas_object_stack_above ( Evas_Object obj,
Evas_Object above 
)

Stack obj immediately above above.

If obj is a member of a smart object, then above must also be a member of the same smart object.

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

Parameters:
obj the object to stack
above the object above which to stack

References evas_event_feed_mouse_move(), and evas_object_raise().

Referenced by evas_object_box_layout_stack().

EAPI void evas_object_stack_below ( Evas_Object obj,
Evas_Object below 
)

Stack obj immediately below below.

If obj is a member of a smart object, then below must also be a member of the same smart object.

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

Parameters:
obj the object to stack
below the object below which to stack

References evas_event_feed_mouse_move(), and evas_object_lower().

EAPI const char* evas_object_type_get ( const Evas_Object obj  ) 

Retrieves the name of the type of the given evas object.

Parameters:
obj The given object.
Returns:
The name.
EAPI 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:
1 if the object is visible. 0 otherwise.