Evas Smart Object Functions

Functions dealing with evas smart objects. More...

Modules

 Evas_Object_Box
 Evas_Object_Table

Functions

EAPI void evas_object_smart_data_set (Evas_Object *obj, void *data)
 Store a pointer to user data for a smart object.
EAPI void * evas_object_smart_data_get (const Evas_Object *obj)
 Retrieve user data stored on a smart object.
EAPI Evas_Smartevas_object_smart_smart_get (const Evas_Object *obj)
 Get the Evas_Smart from which obj was created.
EAPI void evas_object_smart_member_add (Evas_Object *obj, Evas_Object *smart_obj)
 Set an evas object as a member of a smart object.
EAPI void evas_object_smart_member_del (Evas_Object *obj)
 Removes a member object from a smart object.
EAPI Evas_Objectevas_object_smart_parent_get (const Evas_Object *obj)
 Gets the smart parent of an Evas_Object.
EAPI Evas_Objectevas_object_smart_add (Evas *e, Evas_Smart *s)
 Instantiates a new smart object described by s.
EAPI void evas_object_smart_callback_add (Evas_Object *obj, const char *event, void(*func)(void *data, Evas_Object *obj, void *event_info), const void *data)
 Add a callback for the smart event specified by event.
EAPI void * evas_object_smart_callback_del (Evas_Object *obj, const char *event, void(*func)(void *data, Evas_Object *obj, void *event_info))
 Remove a smart callback.
EAPI void evas_object_smart_callback_call (Evas_Object *obj, const char *event, void *event_info)
 Call any smart callbacks on obj for event.
EAPI void evas_object_smart_need_recalculate_set (Evas_Object *obj, Eina_Bool value)
 Set the need_recalculate flag of given smart object.
EAPI Eina_Bool evas_object_smart_need_recalculate_get (const Evas_Object *obj)
 Get the current value of need_recalculate flag.
EAPI void evas_object_smart_calculate (Evas_Object *obj)
 Call user provided calculate() and unset need_calculate.
EAPI void evas_smart_objects_calculate (Evas *e)
 Call user provided calculate() and unset need_calculate on all objects.
EAPI void evas_object_smart_changed (Evas_Object *obj)
 Mark smart object as changed, dirty.
EAPI void evas_object_smart_move_children_relative (Evas_Object *obj, Evas_Coord dx, Evas_Coord dy)
 Moves all children objects relative to given offset.
EAPI Evas_Objectevas_object_smart_clipped_clipper_get (Evas_Object *obj)
 Get the clipper object for the given clipped smart object.
EAPI void evas_object_smart_clipped_smart_set (Evas_Smart_Class *sc)
 Set smart class callbacks so it implements the "Clipped Smart Object".

Detailed Description

Functions dealing with evas smart objects.

Smart objects are groupings of primitive evas objects that behave as a cohesive group. For instance, a file manager icon may be a smart object composed of an image object, a text label and two rectangles that appear behind the image and text when the icon is selected. As a smart object, the normal evas api could be used on the icon object.


Function Documentation

EAPI Evas_Object* evas_object_smart_add ( Evas e,
Evas_Smart s 
)

Instantiates a new smart object described by s.

Parameters:
e the evas on which to add the object
s the Evas_Smart describing the smart object
Returns:
a new Evas_Object

Referenced by evas_object_box_add(), and evas_object_table_add().

EAPI void evas_object_smart_calculate ( Evas_Object obj  ) 

Call user provided calculate() and unset need_calculate.

Parameters:
obj the smart object
EAPI void evas_object_smart_callback_add ( Evas_Object obj,
const char *  event,
void(*)(void *data, Evas_Object *obj, void *event_info)  func,
const void *  data 
)

Add a callback for the smart event specified by event.

Parameters:
obj a smart object
event the event name
func the callback function
data user data to be passed to the callback function
EAPI void evas_object_smart_callback_call ( Evas_Object obj,
const char *  event,
void *  event_info 
)

Call any smart callbacks on obj for event.

Parameters:
obj the smart object
event the event name
event_info an event specific struct of info to pass to the callback

This should be called internally in the smart object when some specific event has occured. The documentation for the smart object should include a list of possible events and what type of event_info to expect.

EAPI void* evas_object_smart_callback_del ( Evas_Object obj,
const char *  event,
void(*)(void *data, Evas_Object *obj, void *event_info)  func 
)

Remove a smart callback.

Removes a callback that was added by evas_object_smart_callback_add()

Parameters:
obj a smart object
event the event name
func the callback function
Returns:
the data pointer
EAPI Evas_Object* evas_object_smart_clipped_clipper_get ( Evas_Object obj  ) 

Get the clipper object for the given clipped smart object.

Parameters:
obj the clipped smart object to retrieve the associated clipper.
Returns:
the clipper object.
See also:
evas_object_smart_clipped_smart_add()

References evas_object_smart_data_get().

EAPI void evas_object_smart_clipped_smart_set ( Evas_Smart_Class sc  ) 

Set smart class callbacks so it implements the "Clipped Smart Object".

This call will assign all the required methods of Evas_Smart_Class, if one wants to "subclass" it, call this function and later override values, if one wants to call the original method, save it somewhere, example:

 static Evas_Smart_Class parent_sc = EVAS_SMART_CLASS_INIT_NULL;

 static void my_class_smart_add(Evas_Object *o)
 {
    parent_sc.add(o);
    evas_object_color_set(evas_object_smart_clipped_clipper_get(o),
                          255, 0, 0, 255);
 }

 Evas_Smart_Class *my_class_new(void)
 {
    static Evas_Smart_Class sc = EVAS_SMART_CLASS_INIT_NAME_VERSION("MyClass");
    if (!parent_sc.name)
      {
         evas_object_smart_clipped_smart_set(&sc);
         parent_sc = sc;
         sc.add = my_class_smart_add;
      }
    return ≻
 }

Default behavior is:

  • add: creates a hidden clipper with "infinite" size;
  • del: delete all children objects;
  • move: move all objects relative relatively;
  • resize: not defined;
  • show: if there are children objects, show clipper;
  • hide: hides clipper;
  • color_set: set the color of clipper;
  • clip_set: set clipper of clipper;
  • clip_unset: unset the clipper of clipper;

Referenced by evas_object_box_smart_set().

EAPI void* evas_object_smart_data_get ( const Evas_Object obj  ) 

Retrieve user data stored on a smart object.

Parameters:
obj The smart object
Returns:
A pointer to data stored using evas_object_smart_data_set(), or NULL if none has been set.

Referenced by evas_object_smart_clipped_clipper_get().

EAPI void evas_object_smart_data_set ( Evas_Object obj,
void *  data 
)

Store a pointer to user data for a smart object.

Parameters:
obj The smart object
data A pointer to user data
EAPI void evas_object_smart_member_add ( Evas_Object obj,
Evas_Object smart_obj 
)

Set an evas object as a member of a smart object.

Parameters:
obj The member object
smart_obj The smart object

Members will automatically be stacked and layered with the smart object. The various stacking function will operate on members relative to the other members instead of the entire canvas.

Non-member objects can not interleave a smart object's members.

References evas_object_smart_member_del().

Referenced by evas_object_box_add_to(), evas_object_box_append(), evas_object_box_insert_after(), evas_object_box_insert_at(), evas_object_box_insert_before(), evas_object_box_prepend(), evas_object_table_add_to(), and evas_object_table_pack().

EAPI void evas_object_smart_member_del ( Evas_Object obj  ) 

Removes a member object from a smart object.

Parameters:
obj the member object

This removes a member object from a smart object. The object will still be on the canvas, but no longer associated with whichever smart object it was associated with.

Referenced by evas_object_box_remove(), evas_object_box_remove_all(), evas_object_box_remove_at(), evas_object_smart_member_add(), evas_object_table_clear(), and evas_object_table_unpack().

EAPI void evas_object_smart_move_children_relative ( Evas_Object obj,
Evas_Coord  dx,
Evas_Coord  dy 
)

Moves all children objects relative to given offset.

Parameters:
obj the smart evas object to use.
dx horizontal offset.
dy vertical offset.

References evas_object_geometry_get(), and evas_object_move().

EAPI Eina_Bool evas_object_smart_need_recalculate_get ( const Evas_Object obj  ) 

Get the current value of need_recalculate flag.

Note:
this flag will be unset during the render phase, after calculate() is called if one is provided. If no calculate() is provided, then the flag will be left unchanged after render phase.
Parameters:
obj the smart object
Returns:
if flag is set or not.
EAPI void evas_object_smart_need_recalculate_set ( Evas_Object obj,
Eina_Bool  value 
)

Set the need_recalculate flag of given smart object.

If this flag is set then calculate() callback (method) of the given smart object will be called, if one is provided, during render phase usually evas_render(). After this step, this flag will be automatically unset.

If no calculate() is provided, this flag will be left unchanged.

Note:
just setting this flag will not make scene dirty and evas_render() will have no effect. To do that, use evas_object_smart_changed(), that will automatically call this function with 1 as parameter.
Parameters:
obj the smart object
value if one want to set or unset the need_recalculate flag.

Referenced by evas_object_smart_changed().

EAPI Evas_Object* evas_object_smart_parent_get ( const Evas_Object obj  ) 

Gets the smart parent of an Evas_Object.

Parameters:
obj the Evas_Object you want to get the parent
Returns:
Returns the smart parent of obj, or NULL if obj is not a smart member of another Evas_Object

Referenced by evas_object_table_unpack().

EAPI Evas_Smart* evas_object_smart_smart_get ( const Evas_Object obj  ) 

Get the Evas_Smart from which obj was created.

Parameters:
obj a smart object
Returns:
the Evas_Smart
EAPI void evas_smart_objects_calculate ( Evas e  ) 

Call user provided calculate() and unset need_calculate on all objects.

Parameters:
e The canvas to calculate all objects in