Functions dealing with Evas smart objects (instances). More...
Modules | |
Clipped Smart Object | |
Clipped smart object is a base to construct other smart objects based on the concept of having an internal clipper that is applied to all children objects. | |
Box Smart Object | |
A box is a convenience smart object that packs children inside it in sequence, using a layouting function specified by the user. | |
Table Smart Object. | |
Convenience smart object that packs children using a tabular layout using children size hints to define their size and alignment inside their cell space. | |
Grid Smart Object. | |
Convenience smart object that packs children under a regular grid layout, using their virtual grid location and size to determine children's positions inside the grid object's area. | |
Functions | |
EOAPI int | evas_canvas_smart_objects_calculate_count_get (void) |
This gets the internal counter that counts the number of smart calculations. More... | |
EOAPI void | evas_canvas_smart_objects_calculate (void) |
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. More... | |
void | evas::canvas::smart_objects_calculate () const |
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. More... | |
int | evas::canvas::smart_objects_calculate_count_get () const |
This gets the internal counter that counts the number of smart calculations. More... | |
int | evas_smart_objects_calculate_count_get (const Evas_Canvas *obj) |
This gets the internal counter that counts the number of smart calculations. More... | |
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. More... | |
EOAPI void * | evas_obj_smart_data_get (void) |
Retrieve user data stored on a given smart object. More... | |
EOAPI Evas_Object * | evas_obj_smart_parent_get (void) |
Gets the parent smart object of a given Evas object, if it has one. More... | |
EOAPI Eina_Bool | evas_obj_smart_type_check (const char *type) |
Checks whether a given smart object or any of its smart object parents is of a given smart class. More... | |
EOAPI Eina_Bool | evas_obj_smart_type_check_ptr (const char *type) |
Checks whether a given smart object or any of its smart object parents is of a given smart class, using pointer comparison. More... | |
bool | evas::object::smart_type_check (::efl::eina::string_view type_) const |
Checks whether a given smart object or any of its smart object parents is of a given smart class. More... | |
bool | evas::object::smart_type_check_ptr (::efl::eina::string_view type_) const |
Checks whether a given smart object or any of its smart object parents is of a given smart class, using pointer comparison. More... | |
void * | evas::object::smart_data_get () const |
Retrieve user data stored on a given smart object. More... | |
::evas::object | evas::object::smart_parent_get () const |
Gets the parent smart object of a given Evas object, if it has one. More... | |
void * | evas_object_smart_data_get (const Evas_Object *obj) |
Retrieve user data stored on a given smart object. More... | |
Evas_Object * | evas_object_smart_parent_get (const Evas_Object *obj) |
Gets the parent smart object of a given Evas object, if it has one. More... | |
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. More... | |
Eina_Bool | evas_object_smart_type_check_ptr (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, using pointer comparison. More... | |
void | evas_smart_legacy_type_register (const char *type, const Eo_Class *klass) |
Registers an object type and its associated class. More... | |
Evas_Object * | evas_object_smart_add (Evas *e, Evas_Smart *s) |
Instantiates a new smart object described by s . More... | |
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. More... | |
void | evas_object_smart_member_del (Evas_Object *obj) |
Removes a member object from a given smart object. More... | |
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 . More... | |
void | evas_object_smart_callback_priority_add (Evas_Object *obj, const char *event, Evas_Callback_Priority priority, Evas_Smart_Cb func, const void *data) |
Add (register) a callback function to the smart event specified by event on the smart object obj . More... | |
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 . More... | |
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 . More... | |
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 . More... | |
const void * | evas_object_smart_interface_get (const Evas_Object *obj, const char *name) |
Retrieve an Evas smart object's interface, by name string pointer. More... | |
void * | evas_object_smart_interface_data_get (const Evas_Object *obj, const Evas_Smart_Interface *iface) |
Retrieve an Evas smart object interface's private data. More... | |
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 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 examples of this group of functions.
EOAPI int evas_canvas_smart_objects_calculate_count_get | ( | void | ) |
This gets the internal counter that counts the number of smart calculations.
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.
Referenced by evas_smart_objects_calculate_count_get().
EOAPI void evas_canvas_smart_objects_calculate | ( | void | ) |
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.
Referenced by evas_smart_objects_calculate().
void evas::canvas::smart_objects_calculate | ( | ) | const |
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.
int evas::canvas::smart_objects_calculate_count_get | ( | ) | const |
This gets the internal counter that counts the number of smart calculations.
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.
int evas_smart_objects_calculate_count_get | ( | const Evas_Canvas * | obj | ) |
This gets the internal counter that counts the number of smart calculations.
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.
e | The canvas to get the calculate counter from |
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.
References evas_canvas_smart_objects_calculate_count_get().
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.
References evas_canvas_smart_objects_calculate().
EOAPI void* evas_obj_smart_data_get | ( | void | ) |
Retrieve user data stored on a given smart object.
NULL
, if none has been set.Referenced by evas_object_smart_data_get().
EOAPI Evas_Object* evas_obj_smart_parent_get | ( | void | ) |
Gets the parent smart object of a given Evas object, if it has one.
NULL
, if obj is not a smart member of any Referenced by evas_object_smart_parent_get().
EOAPI Eina_Bool evas_obj_smart_type_check | ( | const char * | type | ) |
Checks whether a given smart object or any of its smart object parents is of a given smart class.
EINA_TRUE
, if obj or any of its parents is of type type, EINA_FALSE
otherwiseIf 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.
[in] | type | The name (type) of the smart class to check for |
Referenced by evas_object_smart_type_check().
EOAPI Eina_Bool evas_obj_smart_type_check_ptr | ( | const char * | type | ) |
Checks whether a given smart object or any of its smart object parents is of a given smart class, using pointer comparison.
EINA_TRUE
, if obj or any of its parents is of type type, EINA_FALSE
otherwise[in] | type | The type (name string) to check for. Must be the name |
Referenced by evas_object_smart_type_check_ptr().
bool evas::object::smart_type_check | ( | ::efl::eina::string_view | type_ | ) | const |
Checks whether a given smart object or any of its smart object parents is of a given smart class.
EINA_TRUE
, if obj or any of its parents is of type type, EINA_FALSE
otherwiseIf 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.
type | The name (type) of the smart class to check for |
bool evas::object::smart_type_check_ptr | ( | ::efl::eina::string_view | type_ | ) | const |
Checks whether a given smart object or any of its smart object parents is of a given smart class, using pointer comparison.
EINA_TRUE
, if obj or any of its parents is of type type, EINA_FALSE
otherwisetype | The type (name string) to check for. Must be the name |
void* evas::object::smart_data_get | ( | ) | const |
Retrieve user data stored on a given smart object.
NULL
, if none has been set.::evas::object evas::object::smart_parent_get | ( | ) | const |
Gets the parent smart object of a given Evas object, if it has one.
NULL
, if obj is not a smart member of any void* evas_object_smart_data_get | ( | const Evas_Object * | obj | ) |
Retrieve user data stored on a given smart object.
NULL
, if none has been set.References evas_obj_smart_data_get().
Referenced by emotion_object_image_get().
Evas_Object* evas_object_smart_parent_get | ( | const Evas_Object * | obj | ) |
Gets the parent smart object of a given Evas object, if it has one.
NULL
, if obj is not a smart member of any References evas_obj_smart_parent_get().
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.
EINA_TRUE
, if obj or any of its parents is of type type, EINA_FALSE
otherwiseIf 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.
[in] | type | The name (type) of the smart class to check for |
References evas_obj_smart_type_check().
Eina_Bool evas_object_smart_type_check_ptr | ( | 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, using pointer comparison.
EINA_TRUE
, if obj or any of its parents is of type type, EINA_FALSE
otherwise[in] | type | The type (name string) to check for. Must be the name |
References evas_obj_smart_type_check_ptr().
void evas_smart_legacy_type_register | ( | const char * | type, |
const Eo_Class * | klass | ||
) |
Registers an object type and its associated class.
LEGACY MECHANISM SUPPORT.
This function is invoked in the class constructor of smart classes. It will add the type and the class into a hash table that will then be used to check the type of an object. This function has been implemented to support legacy mechanism that checks objects types by name. USE IT ONLY FOR LEGACY SUPPORT. Otherwise, it is HIGHLY recommended to use eo_isa.
type | The type (name string) to add. |
klass | The class to associate to the type. |
References eina_hash_set().
Evas_Object* evas_object_smart_add | ( | Evas * | e, |
Evas_Smart * | s | ||
) |
Instantiates a new smart object described by s
.
e | the canvas on which to add the object |
s | the Evas_Smart describing the smart object |
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.
References eo_add.
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.
obj | The member object |
smart_obj | The smart object |
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.
void evas_object_smart_member_del | ( | Evas_Object * | obj | ) |
Removes a member object from a given smart object.
obj | the member object |
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.
References eo_data_scope_get().
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
.
obj | a smart object |
event | the event's name string |
func | the callback function |
data | user data to be passed to the callback function |
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() 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 (see evas_smart_callbacks_descriptions_get()), but no internal smart objects on Evas implement them yet.
References EVAS_CALLBACK_PRIORITY_DEFAULT, and evas_object_smart_callback_priority_add().
void evas_object_smart_callback_priority_add | ( | Evas_Object * | obj, |
const char * | event, | ||
Evas_Callback_Priority | priority, | ||
Evas_Smart_Cb | func, | ||
const void * | data | ||
) |
Add (register) a callback function to the smart event specified by event
on the smart object obj
.
Except for the priority field, it's exactly the same as evas_object_smart_callback_add
obj | a smart object |
event | the event's name string |
priority | The priority of the callback, lower values called first. |
func | the callback function |
data | user data to be passed to the callback function |
References eina_inlist_append(), EINA_INLIST_GET, eo_base_legacy_only_event_description_get(), and eo_data_scope_get().
Referenced by evas_object_smart_callback_add().
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
.
obj | a smart object |
event | the event's name string |
func | the callback function |
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.
References EINA_INLIST_FOREACH, EINA_INLIST_GET, eina_inlist_remove(), eo_base_legacy_only_event_description_get(), and eo_data_scope_get().
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
.
obj | a smart object |
event | the event's name string |
func | the callback function |
data | the data pointer that was passed to the callback |
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
type
and func
, use evas_object_smart_callback_del(). References EINA_INLIST_FOREACH, EINA_INLIST_GET, eina_inlist_remove(), eo_base_legacy_only_event_description_get(), and eo_data_scope_get().
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
.
obj | the smart object |
event | the event's name string |
event_info | pointer to an event specific struct or information to pass to the callback functions registered on this smart event |
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.
References eo_base_legacy_only_event_description_get().
const void* evas_object_smart_interface_get | ( | const Evas_Object * | obj, |
const char * | name | ||
) |
Retrieve an Evas smart object's interface, by name string pointer.
obj | An Evas smart object. |
name | Name string of the desired interface, which must be the same pointer used at the interface's declarion, when creating the smart object obj. |
NULL
otherwise. References eo_isa(), and _Evas_Smart_Interface::name.
void* evas_object_smart_interface_data_get | ( | const Evas_Object * | obj, |
const Evas_Smart_Interface * | iface | ||
) |
Retrieve an Evas smart object interface's private data.
obj | An Evas smart object. |
iface | The given object's interface handle. |
NULL
otherwise. References eo_data_scope_get().