2015-05-29 03:31:05 -07:00
|
|
|
import eina_types;
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
struct Efl.Event.Description {
|
2015-06-05 09:03:36 -07:00
|
|
|
[[This struct holds the description of a specific event.]]
|
2016-05-31 08:02:26 -07:00
|
|
|
name: string; [[name of the event.]]
|
2016-10-24 07:52:48 -07:00
|
|
|
unfreezable: bool; [[$true if the event cannot be frozen.]]
|
|
|
|
legacy_is: bool; [[Internal use: $true if a legacy event.]]
|
2017-12-20 01:52:31 -08:00
|
|
|
restart: bool; [[$true if when the event is triggered again from a callback it'll start from where it was]]
|
2015-05-29 02:32:48 -07:00
|
|
|
}
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
abstract Efl.Object ()
|
2014-03-09 00:31:28 -08:00
|
|
|
{
|
2016-11-10 05:38:06 -08:00
|
|
|
[[Abstract Efl object class]]
|
2016-08-09 06:10:05 -07:00
|
|
|
eo_prefix: efl;
|
2014-04-02 03:41:25 -07:00
|
|
|
|
2015-05-07 08:36:45 -07:00
|
|
|
methods {
|
|
|
|
@property parent {
|
2016-04-14 10:32:45 -07:00
|
|
|
[[The parent of an object.
|
|
|
|
|
2017-12-20 01:52:31 -08:00
|
|
|
Parents keep references to their children. In order to
|
|
|
|
delete objects which have parents you need to set parent to
|
|
|
|
NULL or use efl_del(). This will both delete & unref
|
2016-04-14 10:32:45 -07:00
|
|
|
the object).
|
|
|
|
|
|
|
|
The Eo parent is conceptually user set. That means that a parent
|
2017-12-20 01:52:31 -08:00
|
|
|
should not be changed behind the scenes in an unexpected way.
|
2015-06-05 09:03:36 -07:00
|
|
|
|
2016-04-14 10:32:45 -07:00
|
|
|
For example:
|
2017-12-20 01:52:31 -08:00
|
|
|
If you have a widget that has a box internally and
|
|
|
|
when you 'swallow' a widget and the swallowed object ends up in
|
|
|
|
the box, the parent should be the widget, not the box.
|
2016-04-14 10:32:45 -07:00
|
|
|
]]
|
|
|
|
|
|
|
|
set {
|
2014-03-09 00:31:28 -08:00
|
|
|
}
|
|
|
|
get {
|
|
|
|
}
|
|
|
|
values {
|
2016-11-10 05:38:06 -08:00
|
|
|
parent: Efl.Object @nullable; [[The new parent]]
|
2014-03-09 00:31:28 -08:00
|
|
|
}
|
|
|
|
}
|
Revert "Eo: Remove eo_del() and make eo_unref() the replacement."
This reverts commit 546ff7bbba788ec834c5608361c0834853f2d5d7.
It seems that eo_del() is useful and removing it was creating bugs.
The issue is that the way we defined parents in eo, both the parent and
the programmer share a reference to the object. When we eo_unref() that
reference as the programmer, eo has no way to know it's this specific
reference we are freeing, and not a general one, so in some
circumstances, for example:
eo_ref(child);
eo_unref(child); // trying to delete here
eo_unref(container); // container is deleted here
eo_unref(child); // child already has 0 refs before this point.
We would have an issue with references and objects being freed too soon
and in general, issue with the references.
Having eo_del() solves that, because this one explicitly unparents if
there is a parent, meaning the reference ownership is explicitly taken
by the programmer.
eo_del() is essentially a convenience function around "check if has
parent, and if so unparent, otherwise, unref". Which should be used when
you want to delete an object although it has a parent, and is equivalent
to eo_unref() when it doesn't have one.
2016-06-01 05:14:30 -07:00
|
|
|
del @const {
|
|
|
|
[[Unrefs the object and reparents it to NULL.
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
Because efl_del() unrefs and reparents to NULL, it doesn't really delete the object.
|
Revert "Eo: Remove eo_del() and make eo_unref() the replacement."
This reverts commit 546ff7bbba788ec834c5608361c0834853f2d5d7.
It seems that eo_del() is useful and removing it was creating bugs.
The issue is that the way we defined parents in eo, both the parent and
the programmer share a reference to the object. When we eo_unref() that
reference as the programmer, eo has no way to know it's this specific
reference we are freeing, and not a general one, so in some
circumstances, for example:
eo_ref(child);
eo_unref(child); // trying to delete here
eo_unref(container); // container is deleted here
eo_unref(child); // child already has 0 refs before this point.
We would have an issue with references and objects being freed too soon
and in general, issue with the references.
Having eo_del() solves that, because this one explicitly unparents if
there is a parent, meaning the reference ownership is explicitly taken
by the programmer.
eo_del() is essentially a convenience function around "check if has
parent, and if so unparent, otherwise, unref". Which should be used when
you want to delete an object although it has a parent, and is equivalent
to eo_unref() when it doesn't have one.
2016-06-01 05:14:30 -07:00
|
|
|
|
|
|
|
This method accepts a const object for convenience, so all objects
|
2017-12-20 01:52:31 -08:00
|
|
|
can be passed to it easily.
|
Revert "Eo: Remove eo_del() and make eo_unref() the replacement."
This reverts commit 546ff7bbba788ec834c5608361c0834853f2d5d7.
It seems that eo_del() is useful and removing it was creating bugs.
The issue is that the way we defined parents in eo, both the parent and
the programmer share a reference to the object. When we eo_unref() that
reference as the programmer, eo has no way to know it's this specific
reference we are freeing, and not a general one, so in some
circumstances, for example:
eo_ref(child);
eo_unref(child); // trying to delete here
eo_unref(container); // container is deleted here
eo_unref(child); // child already has 0 refs before this point.
We would have an issue with references and objects being freed too soon
and in general, issue with the references.
Having eo_del() solves that, because this one explicitly unparents if
there is a parent, meaning the reference ownership is explicitly taken
by the programmer.
eo_del() is essentially a convenience function around "check if has
parent, and if so unparent, otherwise, unref". Which should be used when
you want to delete an object although it has a parent, and is equivalent
to eo_unref() when it doesn't have one.
2016-06-01 05:14:30 -07:00
|
|
|
]]
|
|
|
|
}
|
2016-05-17 08:00:13 -07:00
|
|
|
@property name {
|
|
|
|
[[ The name of the object.
|
2016-04-19 00:34:53 -07:00
|
|
|
|
|
|
|
Every object can have a string name. Names may not contain
|
2017-12-20 01:52:31 -08:00
|
|
|
the following characters:
|
2016-04-20 02:26:35 -07:00
|
|
|
/ ? * [ ] ! \ :
|
2017-12-20 01:52:31 -08:00
|
|
|
Using any of these in a name will result in undefined
|
2016-04-20 02:26:35 -07:00
|
|
|
behavior later on. An empty string is considered the same as a
|
2017-12-20 01:52:31 -08:00
|
|
|
NULL string or no string for the name.
|
2016-04-19 00:34:53 -07:00
|
|
|
]]
|
|
|
|
set {
|
|
|
|
}
|
|
|
|
get {
|
|
|
|
}
|
|
|
|
values {
|
2016-11-10 05:38:06 -08:00
|
|
|
name: string @nullable; [[The name]]
|
2016-04-19 00:34:53 -07:00
|
|
|
}
|
|
|
|
}
|
2016-04-19 01:21:21 -07:00
|
|
|
@property comment {
|
|
|
|
[[ A human readable comment for the object
|
|
|
|
|
2017-12-20 01:52:31 -08:00
|
|
|
Every object can have a string comment. This is intended for developers
|
2016-04-19 01:21:21 -07:00
|
|
|
and debugging. An empty string is considered the same as a NULL
|
2017-12-20 01:52:31 -08:00
|
|
|
string or no string for the comment.
|
2016-04-19 01:21:21 -07:00
|
|
|
]]
|
|
|
|
set {
|
|
|
|
}
|
|
|
|
get {
|
|
|
|
}
|
|
|
|
values {
|
2016-11-10 05:38:06 -08:00
|
|
|
comment: string @nullable; [[The comment]]
|
2016-04-19 01:21:21 -07:00
|
|
|
}
|
|
|
|
}
|
2017-07-20 23:24:08 -07:00
|
|
|
debug_name_override {
|
|
|
|
[[ Build a read-only name for this object used for debugging.
|
|
|
|
|
|
|
|
Multiple calls using efl_super() can be chained in order to build
|
|
|
|
the entire debug name, from parent to child classes. In C the usual
|
|
|
|
way to build the string is as follows:
|
|
|
|
|
2017-10-12 18:54:54 -07:00
|
|
|
efl_debug_name_override(efl_super(obj, MY_CLASS), sb);
|
2017-07-20 23:24:08 -07:00
|
|
|
eina_strbuf_append_printf(sb, "new_information");
|
|
|
|
|
2017-12-20 01:52:31 -08:00
|
|
|
Usually more debug information should be added to $sb after
|
2017-10-12 18:54:54 -07:00
|
|
|
calling the super function.
|
2017-07-13 23:57:36 -07:00
|
|
|
|
|
|
|
@since 1.21
|
|
|
|
]]
|
2017-07-20 23:24:08 -07:00
|
|
|
params {
|
2017-10-12 18:54:54 -07:00
|
|
|
@in sb: ptr(Eina.Strbuf); [[A string buffer, must not be $null.]]
|
2017-07-13 23:57:36 -07:00
|
|
|
}
|
|
|
|
}
|
2015-05-07 08:36:45 -07:00
|
|
|
@property event_global_freeze_count @class {
|
2014-03-09 00:31:28 -08:00
|
|
|
get {
|
2015-06-05 09:03:36 -07:00
|
|
|
[[Return freeze events of object.
|
|
|
|
|
|
|
|
Return event freeze count.
|
|
|
|
]]
|
2014-03-09 00:31:28 -08:00
|
|
|
}
|
|
|
|
values {
|
2015-06-05 09:03:36 -07:00
|
|
|
fcount: int; [[The event freeze count of the object]]
|
2014-03-09 00:31:28 -08:00
|
|
|
}
|
|
|
|
}
|
2015-05-07 08:36:45 -07:00
|
|
|
@property event_freeze_count {
|
2014-03-09 00:31:28 -08:00
|
|
|
get {
|
2015-06-05 09:03:36 -07:00
|
|
|
[[Return freeze events of object.
|
|
|
|
|
|
|
|
Return event freeze count.
|
|
|
|
]]
|
2014-03-09 00:31:28 -08:00
|
|
|
}
|
|
|
|
values {
|
2015-06-05 09:03:36 -07:00
|
|
|
fcount: int; [[The event freeze count of the object]]
|
2014-03-09 00:31:28 -08:00
|
|
|
}
|
|
|
|
}
|
2015-05-07 08:36:45 -07:00
|
|
|
@property finalized {
|
2017-12-20 01:52:31 -08:00
|
|
|
[[True if the object is already finalized, otherwise false.]]
|
2014-08-29 01:55:02 -07:00
|
|
|
get {
|
|
|
|
}
|
|
|
|
values {
|
2016-11-10 05:38:06 -08:00
|
|
|
finalized: bool; [[$true if the object is finalized, $false otherwise]]
|
2014-08-29 01:55:02 -07:00
|
|
|
}
|
|
|
|
}
|
2018-01-04 11:41:49 -08:00
|
|
|
provider_find @const {
|
2017-12-20 01:52:31 -08:00
|
|
|
[[Searches upwards in the object tree for a provider which knows the given class/interface.
|
2016-05-04 01:08:00 -07:00
|
|
|
|
|
|
|
The object from the provider will then be returned.
|
|
|
|
The base implementation calls the provider_find function on the object parent,
|
2016-11-10 05:38:06 -08:00
|
|
|
and returns its result. If no parent is present NULL is returned.
|
2016-05-04 01:08:00 -07:00
|
|
|
Each implementation has to support this function by overriding
|
|
|
|
it and returning itself if the interface matches the parameter.
|
|
|
|
If this is not done the class cannot be found up in the object tree.
|
|
|
|
]]
|
|
|
|
params {
|
2016-08-09 06:10:05 -07:00
|
|
|
klass : const(Efl.Object); [[The class identifier to search for]]
|
2016-05-04 01:08:00 -07:00
|
|
|
}
|
2016-11-10 05:38:06 -08:00
|
|
|
return : Efl.Object; [[Object from the provider list]]
|
2016-04-20 23:15:13 -07:00
|
|
|
}
|
2014-09-01 07:53:35 -07:00
|
|
|
constructor {
|
2015-06-05 09:03:36 -07:00
|
|
|
[[Call the object's constructor.
|
|
|
|
|
|
|
|
Should not be used with #eo_do. Only use it with #eo_do_super.
|
|
|
|
]]
|
2016-08-09 06:10:05 -07:00
|
|
|
return: Efl.Object; [[The new object created, can be NULL if aborting]]
|
2014-08-27 07:01:09 -07:00
|
|
|
}
|
2015-05-01 07:59:57 -07:00
|
|
|
destructor {
|
2015-06-05 09:03:36 -07:00
|
|
|
[[Call the object's destructor.
|
|
|
|
|
|
|
|
Should not be used with #eo_do. Only use it with #eo_do_super.
|
|
|
|
]]
|
2014-03-09 00:31:28 -08:00
|
|
|
}
|
2015-05-01 07:59:57 -07:00
|
|
|
finalize {
|
2018-01-03 06:44:39 -08:00
|
|
|
[[Called at the end of efl_add. Should not be called, just overridden.]]
|
2016-08-09 06:10:05 -07:00
|
|
|
return: Efl.Object; [[The new object created, can be NULL if aborting]]
|
2014-03-09 00:31:28 -08:00
|
|
|
}
|
2017-08-23 04:33:54 -07:00
|
|
|
name_find @const {
|
2016-05-17 08:00:13 -07:00
|
|
|
[[Find a child object with the given name and return it.
|
2017-08-08 02:14:07 -07:00
|
|
|
|
|
|
|
The search string can be a glob (shell style, using *). It can also
|
2016-04-20 02:26:35 -07:00
|
|
|
specify class name in the format of "class:name" where ":"
|
|
|
|
separates class and name. Both class and name can be globs.
|
2017-12-20 01:52:31 -08:00
|
|
|
If the class is specified but the name is empty like "class:" then
|
2016-04-20 02:26:35 -07:00
|
|
|
the search will match any object of that class.
|
|
|
|
]]
|
|
|
|
params {
|
2016-11-10 05:38:06 -08:00
|
|
|
@in search: string; [[The name search string]]
|
2016-04-20 02:26:35 -07:00
|
|
|
}
|
2016-11-10 05:38:06 -08:00
|
|
|
return: Efl.Object; [[The first object found]]
|
2016-04-20 02:26:35 -07:00
|
|
|
}
|
2015-05-01 07:59:57 -07:00
|
|
|
event_thaw {
|
2016-11-10 05:38:06 -08:00
|
|
|
[[Thaw events of object.
|
2015-06-05 09:03:36 -07:00
|
|
|
|
2017-12-20 01:52:31 -08:00
|
|
|
Allows event callbacks to be called for an object.
|
2015-06-05 09:03:36 -07:00
|
|
|
]]
|
2015-05-01 07:59:57 -07:00
|
|
|
}
|
|
|
|
event_freeze {
|
2016-11-10 05:38:06 -08:00
|
|
|
[[Freeze events of object.
|
2015-06-05 09:03:36 -07:00
|
|
|
|
2017-12-20 01:52:31 -08:00
|
|
|
Prevents event callbacks from being called for an object.
|
2015-06-05 09:03:36 -07:00
|
|
|
]]
|
2015-05-01 07:59:57 -07:00
|
|
|
}
|
2014-07-24 06:41:23 -07:00
|
|
|
event_global_thaw @class {
|
2016-11-10 05:38:06 -08:00
|
|
|
[[Thaw events of object.
|
2015-06-05 09:03:36 -07:00
|
|
|
|
2017-12-20 01:52:31 -08:00
|
|
|
Allows event callbacks be called for an object.
|
2015-06-05 09:03:36 -07:00
|
|
|
]]
|
2014-03-09 00:31:28 -08:00
|
|
|
}
|
2015-05-01 07:59:57 -07:00
|
|
|
event_global_freeze @class {
|
2016-11-10 05:38:06 -08:00
|
|
|
[[Freeze events of object.
|
2015-06-05 09:03:36 -07:00
|
|
|
|
2017-12-20 01:52:31 -08:00
|
|
|
Prevents event callbacks from being called for an object.
|
2015-06-05 09:03:36 -07:00
|
|
|
]]
|
2015-05-01 07:59:57 -07:00
|
|
|
}
|
2016-06-20 02:37:02 -07:00
|
|
|
event_callback_stop {
|
|
|
|
[[Stop the current callback call.
|
|
|
|
|
|
|
|
This stops the current callback call. Any other callbacks for the
|
|
|
|
current event will not be called. This is useful when you want to
|
2017-12-20 01:52:31 -08:00
|
|
|
filter out events. Just add higher priority events and call this
|
|
|
|
under certain conditions to block a certain event.
|
2016-06-20 02:37:02 -07:00
|
|
|
]]
|
|
|
|
}
|
2014-03-09 00:31:28 -08:00
|
|
|
event_callback_forwarder_add {
|
2015-06-05 09:03:36 -07:00
|
|
|
[[Add an event callback forwarder for an event and an object.]]
|
2014-03-09 00:31:28 -08:00
|
|
|
params {
|
2017-11-02 08:40:42 -07:00
|
|
|
@cref desc: Efl.Event.Description; [[The description of the event to listen to]]
|
2016-08-09 06:10:05 -07:00
|
|
|
@in new_obj: Efl.Object; [[The object to emit events from]]
|
2014-03-09 00:31:28 -08:00
|
|
|
}
|
|
|
|
}
|
2015-05-01 07:59:57 -07:00
|
|
|
event_callback_forwarder_del {
|
2015-06-05 09:03:36 -07:00
|
|
|
[[Remove an event callback forwarder for an event and an object.]]
|
2014-03-09 00:31:28 -08:00
|
|
|
params {
|
2017-11-02 08:40:42 -07:00
|
|
|
@cref desc: Efl.Event.Description; [[The description of the event to listen to]]
|
2016-08-09 06:10:05 -07:00
|
|
|
@in new_obj: Efl.Object; [[The object to emit events from]]
|
2014-03-09 00:31:28 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
children_iterator_new {
|
2015-06-05 09:03:36 -07:00
|
|
|
[[Get an iterator on all childrens]]
|
2017-09-15 07:44:26 -07:00
|
|
|
return: iterator<Efl.Object> @owned @warn_unused; [[Children iterator]]
|
2014-03-09 00:31:28 -08:00
|
|
|
}
|
2016-06-17 11:22:25 -07:00
|
|
|
composite_attach {
|
2015-06-05 09:03:36 -07:00
|
|
|
[[Make an object a composite object of another.
|
|
|
|
|
|
|
|
The class of comp_obj must be part of the extensions of the class of the parent.
|
2017-12-20 01:52:31 -08:00
|
|
|
It isn't possible to attach more then 1 composite of the same class.
|
|
|
|
This function also sets the parent of comp_obj to parent.
|
2015-06-05 09:03:36 -07:00
|
|
|
|
2015-07-08 07:12:32 -07:00
|
|
|
See @.composite_detach, @.composite_part_is.
|
2015-06-05 09:03:36 -07:00
|
|
|
]]
|
2014-10-21 04:37:00 -07:00
|
|
|
params {
|
2016-08-09 06:10:05 -07:00
|
|
|
@in comp_obj: Efl.Object; [[the object that will be used to composite the parent.]]
|
2014-10-21 04:37:00 -07:00
|
|
|
}
|
2015-09-18 20:54:58 -07:00
|
|
|
return: bool; [[$true if successful. $false otherwise.]]
|
2014-10-21 04:37:00 -07:00
|
|
|
}
|
2016-06-17 11:22:25 -07:00
|
|
|
composite_detach {
|
2015-06-05 09:03:36 -07:00
|
|
|
[[Detach a composite object from another object.
|
|
|
|
|
2015-07-08 07:12:32 -07:00
|
|
|
This functions also sets the parent of comp_obj to $null.
|
2015-06-05 09:03:36 -07:00
|
|
|
|
2015-07-08 07:12:32 -07:00
|
|
|
See @.composite_attach, @.composite_part_is.
|
2015-06-05 09:03:36 -07:00
|
|
|
]]
|
2014-10-21 04:37:00 -07:00
|
|
|
params {
|
2016-11-10 05:38:06 -08:00
|
|
|
@in comp_obj: Efl.Object; [[The object that will be removed from the parent.]]
|
2014-10-21 04:37:00 -07:00
|
|
|
}
|
2015-09-18 20:54:58 -07:00
|
|
|
return: bool; [[$true if successful. $false otherwise.]]
|
2014-10-21 04:37:00 -07:00
|
|
|
}
|
2016-06-17 11:22:25 -07:00
|
|
|
composite_part_is {
|
2015-06-05 09:03:36 -07:00
|
|
|
[[Check if an object is part of a composite object.
|
|
|
|
|
2015-07-08 07:12:32 -07:00
|
|
|
See @.composite_attach, @.composite_part_is.
|
2015-06-05 09:03:36 -07:00
|
|
|
]]
|
2015-07-08 07:12:32 -07:00
|
|
|
return: bool; [[$true if it is. $false otherwise.]]
|
2014-10-21 04:37:00 -07:00
|
|
|
}
|
2017-09-28 00:38:00 -07:00
|
|
|
@property allow_parent_unref {
|
|
|
|
[[Allow an object to be deleted by unref even if it has a parent.
|
|
|
|
|
2017-12-20 01:52:31 -08:00
|
|
|
This simply hides the error message warning that an object being
|
|
|
|
destroyed still has a parent. This property is false by default.
|
2017-09-28 00:38:00 -07:00
|
|
|
|
|
|
|
In a normal object use case, when ownership of an object is given
|
2017-12-20 01:52:31 -08:00
|
|
|
to a caller, said ownership should be released with efl_unref().
|
|
|
|
If the object has a parent, this will print error messages, as
|
2017-09-28 00:38:00 -07:00
|
|
|
$efl_unref() is stealing the ref from the parent.
|
|
|
|
|
2017-12-20 01:52:31 -08:00
|
|
|
Warning: Use this function very carefully, unless you're absolutely
|
2017-09-28 00:38:00 -07:00
|
|
|
sure of what you are doing.
|
|
|
|
]]
|
|
|
|
values {
|
|
|
|
allow: bool(false); [[Whether to allow $efl_unref() to zero
|
|
|
|
even if @.parent is not $null.]]
|
|
|
|
}
|
|
|
|
}
|
2014-03-09 00:31:28 -08:00
|
|
|
}
|
2014-06-03 03:23:53 -07:00
|
|
|
implements {
|
2014-06-20 02:45:55 -07:00
|
|
|
class.constructor;
|
|
|
|
class.destructor;
|
2014-06-03 03:23:53 -07:00
|
|
|
}
|
2014-03-09 00:31:28 -08:00
|
|
|
events {
|
2016-02-02 10:28:28 -08:00
|
|
|
callback,add @hot; [[A callback was added.]]
|
|
|
|
callback,del @hot; [[A callback was deleted.]]
|
2016-11-10 05:38:06 -08:00
|
|
|
del @hot; [[Object is being deleted.]]
|
2014-03-09 00:31:28 -08:00
|
|
|
}
|
|
|
|
}
|
2017-08-16 22:52:41 -07:00
|
|
|
|
|
|
|
struct Efl.Event {
|
|
|
|
[[A parameter passed in event callbacks holding extra event parameters.
|
|
|
|
|
|
|
|
This is the full event information passed to callbacks in C.
|
|
|
|
]]
|
|
|
|
object: Efl.Object; [[The object the callback was called on.]]
|
|
|
|
desc: const(ptr(Efl.Event.Description)); [[The event description.]]
|
|
|
|
info: void_ptr; [[Extra event information passed by the event caller]]
|
|
|
|
}
|