Tizen Native API
Smart Object Functions

Functions

int evas_smart_objects_calculate_count_get (const Evas_Canvas *obj)
 This gets the internal counter that counts the number of smart calculations.
void evas_smart_objects_calculate (Evas_Canvas *obj)
 Call user-provided calculate() smart functions and unset the flag signalling that the object needs to get recalculated to all smart objects in the canvas.
void * evas_object_smart_data_get (const Evas_Object *obj)
 Retrieve user data stored on a given smart object.
Evas_Objectevas_object_smart_parent_get (const Evas_Object *obj)
 Gets the parent smart object of a given Evas object, if it has one.
Eina_Bool evas_object_smart_type_check (const Evas_Object *obj, const char *type)
 Checks whether a given smart object or any of its smart object parents is of a given smart class.
void evas_object_smart_data_set (Evas_Object_Smart *obj, void *data)
 Store a pointer to user data for a given smart object.
Eina_Listevas_object_smart_members_get (const Evas_Object_Smart *obj)
 Retrieves the list of the member objects of a given Evas smart object.
Eina_Bool evas_object_smart_callbacks_descriptions_set (Evas_Object_Smart *obj, const Evas_Smart_Cb_Description *descriptions)
 Set an smart object instance's smart callbacks descriptions.
void evas_object_smart_callbacks_descriptions_get (const Evas_Object_Smart *obj, const Evas_Smart_Cb_Description ***class_descriptions, unsigned int *class_count, const Evas_Smart_Cb_Description ***instance_descriptions, unsigned int *instance_count)
 Retrieve an smart object's know smart callback descriptions (both instance and class ones).
void evas_object_smart_changed (Evas_Object_Smart *obj)
 Mark smart object as changed, dirty.
Evas_Objectevas_object_smart_add (Evas *e, Evas_Smart *s)
 Instantiates a new smart object described by s.
void evas_object_smart_member_add (Evas_Object *obj, Evas_Object *smart_obj)
 Set an Evas object as a member of a given smart object.
void evas_object_smart_member_del (Evas_Object *obj)
 Removes a member object from a given smart object.
void evas_object_smart_callback_add (Evas_Object *obj, const char *event, Evas_Smart_Cb func, const void *data)
 Add (register) a callback function to the smart event specified by event on the smart object obj.
void * evas_object_smart_callback_del (Evas_Object *obj, const char *event, Evas_Smart_Cb func)
 Delete (unregister) a callback function from the smart event specified by event on the smart object obj.
void * evas_object_smart_callback_del_full (Evas_Object *obj, const char *event, Evas_Smart_Cb func, const void *data)
 Delete (unregister) a callback function from the smart event specified by event on the smart object obj.
void evas_object_smart_callback_call (Evas_Object *obj, const char *event, void *event_info)
 Call a given smart callback on the smart object obj.

Typedefs

typedef void(* Evas_Smart_Cb )(void *data, Evas_Object *obj, void *event_info)
 Evas smart objects' smart callback function signature.

Functions dealing with Evas smart objects (instances).

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 object API could be used on the icon object.

Besides that, generally smart objects implement a specific API, so that users interact with its own custom features. The API takes form of explicit exported functions one may call and smart callbacks.

Smart events and callbacks

Smart objects can elect events (smart events, from now on) occurring inside of them to be reported back to their users via callback functions (smart callbacks). This way, you can extend Evas' own object events. They are defined by an event string, which identifies them uniquely. There's also a function prototype definition for the callback functions: Evas_Smart_Cb.

When defining an Evas_Smart_Class, smart object implementors are strongly encouraged to properly set the Evas_Smart_Class::callbacks callbacks description array, so that the users of the smart object can have introspection on its events API at run time.

See some Evas object smart objects examples of this group of functions.

See also:
Evas_Smart_Group for class definitions.

Typedef Documentation

typedef void(* Evas_Smart_Cb)(void *data, Evas_Object *obj, void *event_info)

Evas smart objects' smart callback function signature.

Since :
2.3

Function Documentation

Instantiates a new smart object described by s.

Since :
2.3
Parameters:
[in]ethe canvas on which to add the object
[in]sthe Evas_Smart describing the smart object
Returns:
a new Evas_Object handle
Remarks:
This is the function one should use when defining the public function adding an instance of the new smart object to a given canvas. It will take care of setting all of its internals to work as they should, if the user set things properly, as seem on the #EVAS_SMART_SUBCLASS_NEW, for example.
void evas_object_smart_callback_add ( Evas_Object obj,
const char *  event,
Evas_Smart_Cb  func,
const void *  data 
)

Add (register) a callback function to the smart event specified by event on the smart object obj.

Since :
2.3
Parameters:
[in]obja smart object
[in]eventthe event's name string
[in]functhe callback function
[in]datauser data to be passed to the callback function
Remarks:
Smart callbacks look very similar to Evas callbacks, but are implemented as smart object's custom ones.
This function adds a function callback to an smart object when the event named event occurs in it. The function is func.
In the event of a memory allocation error during addition of the callback to the object, Evas Alloc Error function should be used to determine the nature of the error, if any, and the program should sensibly try and recover.
A smart callback function must have the Evas_Smart_Cb prototype definition. The first parameter (data) in this definition will have the same value passed to evas_object_smart_callback_add() as the data parameter, at runtime. The second parameter obj is a handle to the object on which the event occurred. The third parameter, event_info, is a pointer to data which is totally dependent on the smart object's implementation and semantic for the given event.
There is an infrastructure for introspection on smart objects' events, but no internal smart objects on Evas implement them yet.
See also:
Smart events and callbacks for more details.
evas_object_smart_callback_del()
void evas_object_smart_callback_call ( Evas_Object obj,
const char *  event,
void *  event_info 
)

Call a given smart callback on the smart object obj.

Since :
2.3
Parameters:
[in]objthe smart object
[in]eventthe event's name string
[in]event_infopointer to an event specific struct or information to pass to the callback functions registered on this smart event
Remarks:
This should be called internally, from the smart object's own code, when some specific event has occurred and the implementor wants is to pertain to the object's events API (see Smart events and callbacks). The documentation for the smart object should include a list of possible events and what type of event_info to expect for each of them. Also, when defining an Evas_Smart_Class, smart object implementors are strongly encouraged to properly set the Evas_Smart_Class::callbacks callbacks description array, so that the users of the smart object can have introspection on its events API at run time.
void* evas_object_smart_callback_del ( Evas_Object obj,
const char *  event,
Evas_Smart_Cb  func 
)

Delete (unregister) a callback function from the smart event specified by event on the smart object obj.

Since :
2.3
Parameters:
[in]obja smart object
[in]eventthe event's name string
[in]functhe callback function
Returns:
the data pointer
Remarks:
This function removes the first added smart callback on the object obj matching the event name event and the registered function pointer func. If the removal is successful it will also return the data pointer that was passed to evas_object_smart_callback_add() (that will be the same as the parameter) when the callback(s) was(were) added to the canvas. If not successful NULL will be returned.
See also:
evas_object_smart_callback_add() for more details.
void* evas_object_smart_callback_del_full ( Evas_Object obj,
const char *  event,
Evas_Smart_Cb  func,
const void *  data 
)

Delete (unregister) a callback function from the smart event specified by event on the smart object obj.

Since :
2.3
Parameters:
[in]obja smart object
[in]eventthe event's name string
[in]functhe callback function
[in]datathe data pointer that was passed to the callback
Returns:
the data pointer
Remarks:
This function removes the first added smart callback on the object obj matching the event name event, the registered function pointer func and the callback data pointer data. If the removal is successful it will also return the data pointer that was passed to evas_object_smart_callback_add() (that will be the same as the parameter) when the callback(s) was(were) added to the canvas. If not successful NULL will be returned. A common use would be to remove an exact match of a callback
See also:
evas_object_smart_callback_add() for more details.
Since (EFL) :
1.2
Remarks:
To delete all smart event callbacks which match type and func, use evas_object_smart_callback_del().
void evas_object_smart_callbacks_descriptions_get ( const Evas_Object_Smart *  obj,
const Evas_Smart_Cb_Description ***  class_descriptions,
unsigned int *  class_count,
const Evas_Smart_Cb_Description ***  instance_descriptions,
unsigned int *  instance_count 
)

Retrieve an smart object's know smart callback descriptions (both instance and class ones).

Since :
2.3
Remarks:
This call searches for registered callback descriptions for both instance and class of the given smart object. These arrays will be sorted by Evas_Smart_Cb_Description.name and also NULL terminated, so both class_count and instance_count can be ignored, if the caller wishes so. The terminator NULL is not counted in these values.
Use NULL pointers on the descriptions/counters you're not interested in: they'll be ignored by the function.
Parameters:
[in]objThe smart object
[out]class_descriptionsWhere to store class callbacks descriptions array, if any is known. If no descriptions are known, NULL is returned
[out]class_countReturns how many class callbacks descriptions are known.
[out]instance_descriptionsWhere to store instance callbacks descriptions array, if any is known. If no descriptions are known, NULL is returned.
[out]instance_countReturns how many instance callbacks descriptions are known.
Eina_Bool evas_object_smart_callbacks_descriptions_set ( Evas_Object_Smart *  obj,
const Evas_Smart_Cb_Description descriptions 
)

Set an smart object instance's smart callbacks descriptions.

Since :
2.3
Returns:
EINA_TRUE on success, EINA_FALSE on failure.
Remarks:
These descriptions are hints to be used by introspection and are not enforced in any way.
It will not be checked if instance callbacks descriptions have the same name as respective possibly registered in the smart object class. Both are kept in different arrays and users of evas_object_smart_callbacks_descriptions_get() should handle this case as they wish.
Becase descriptions must be NULL terminated, and because a NULL name makes little sense, too, Evas_Smart_Cb_Description.name must not be NULL.
While instance callbacks descriptions are possible, they are not recommended. Use class callbacks descriptions instead as they make you smart object user's life simpler and will use less memory, as descriptions and arrays will be shared among all instances.
Parameters:
[in]objThe smart object
[in]descriptionsNULL terminated array with Evas_Smart_Cb_Description descriptions. Array elements won't be modified at run time, but references to them and their contents will be made, so this array should be kept alive during the whole object's lifetime.
void evas_object_smart_changed ( Evas_Object_Smart *  obj)

Mark smart object as changed, dirty.

Since :
2.3
Remarks:
This will flag the given object as needing recalculation, forcefully. As an effect, on the next rendering cycle its calculate() (see Evas_Smart_Class) smart function will be called.
Parameters:
[in]objThe smart object
void* evas_object_smart_data_get ( const Evas_Object obj)

Retrieve user data stored on a given smart object.

Since :
2.3
Returns:
A pointer to data stored using evas_object_smart_data_set(), or NULL, if none has been set.
See also:
evas_object_smart_data_set()
Parameters:
[in]objThe evas object
void evas_object_smart_data_set ( Evas_Object_Smart *  obj,
void *  data 
)

Store a pointer to user data for a given smart object.

Since :
2.3
Remarks:
This data is stored independently of the one set by evas_object_data_set(), naturally.
See also:
evas_object_smart_data_get()
Parameters:
[in]objThe smart object
[in]dataA pointer to user data
void evas_object_smart_member_add ( Evas_Object obj,
Evas_Object smart_obj 
)

Set an Evas object as a member of a given smart object.

Since :
2.3
Parameters:
[in]objThe member object
[in]smart_objThe smart object
Remarks:
Members will automatically be stacked and layered together with the smart object. The various stacking functions will operate on members relative to the other members instead of the entire canvas, since they now live on an exclusive layer (see evas_object_stack_above(), for more details).
Any smart_obj object's specific implementation of the member_add() smart function will take place too, naturally.
See also:
evas_object_smart_member_del()
evas_object_smart_members_get()

Removes a member object from a given smart object.

Since :
2.3
Parameters:
[in]objthe member object
Remarks:
This removes a member object from a smart object, if it was added to any. The object will still be on the canvas, but no longer associated with whichever smart object it was associated with.
See also:
evas_object_smart_member_add() for more details
evas_object_smart_members_get()
Eina_List* evas_object_smart_members_get ( const Evas_Object_Smart *  obj)

Retrieves the list of the member objects of a given Evas smart object.

Since :
2.3
Returns:
Returns the list of the member objects of obj.
Remarks:
The returned list should be freed with eina_list_free() when you no longer need it.
Since (EFL) :
1.7 This function will return NULL when a non-smart object is passed.
See also:
evas_object_smart_member_add()
evas_object_smart_member_del()
Parameters:
[in]objThe smart object

Gets the parent smart object of a given Evas object, if it has one.

Since :
2.3
Returns:
Returns the parent smart object of obj or NULL, if obj is not a smart member of any
Parameters:
[in]objThe evas object
Eina_Bool evas_object_smart_type_check ( const Evas_Object obj,
const char *  type 
)

Checks whether a given smart object or any of its smart object parents is of a given smart class.

Since :
2.3
Returns:
EINA_TRUE, if obj or any of its parents is of type type, EINA_FALSE otherwise
Remarks:
If obj is not a smart object, this call will fail immediately.
This function supports Eo and legacy inheritance mechanisms. However, it is recommended to use eo_isa instead if your object is using Eo from top to bottom.
The checks use smart classes names and string comparison. There is a version of this same check using pointer comparison, since a smart class' name is a single string in Evas.
See also:
eo_isa
Parameters:
[in]objThe evas object
[in]typeThe name (type) of the smart class to check for
void evas_smart_objects_calculate ( Evas_Canvas *  obj)

Call user-provided calculate() smart functions and unset the flag signalling that the object needs to get recalculated to all smart objects in the canvas.

Since :
2.3
Parameters:
[in]objThe canvas object
int evas_smart_objects_calculate_count_get ( const Evas_Canvas *  obj)

This gets the internal counter that counts the number of smart calculations.

Since :
2.3
Remarks:
Whenever evas performs smart object calculations on the whole canvas it increments a counter by 1. This is the smart object calculate counter that this function returns the value of. It starts at the value of 0 and will increase (and eventually wrap around to negative values and so on) by 1 every time objects are calculated. You can use this counter to ensure you don't re-do calculations withint the same calculation generation/run if the calculations maybe cause self-feeding effects.
Since (EFL) :
1.1
Parameters:
[in]objThe canvas object
Since :
2.3
Parameters:
[in]eThe canvas to get the calculate counter from
Remarks:
Whenever evas performs smart object calculations on the whole canvas it increments a counter by 1. This is the smart object calculate counter that this function returns the value of. It starts at the value of 0 and will increase (and eventually wrap around to negative values and so on) by 1 every time objects are calculated. You can use this counter to ensure you don't re-do calculations withint the same calculation generation/run if the calculations maybe cause self-feeding effects.
Since (EFL) :
1.1