efl/src/lib/eo/efl_object.eo

371 lines
14 KiB
Plaintext
Raw Normal View History

import eina_types;
struct Efl.Event_Description {
[[This struct holds the description of a specific event.]]
name: string; [[name of the event.]]
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]]
}
type Efl.Callback_Priority : short;
[[
Callback priority. Range is -32k - 32k. The lower the number, the higher the priority.
This is used to insert an event handler relative to the existing stack of sorted event
handlers according to that priority. All event handlers always have a priority. If not
specified @Efl.Callback_Priority_Default is to be assumed.
See @Efl.Callback_Priority_Before @Efl.Callback_Priority_Default @Efl.Callback_Priority_After
]]
const Efl.Callback_Priority_Before : Efl.Callback_Priority = -100;
[[Slightly more prioritized than default.]]
const Efl.Callback_Priority_Default : Efl.Callback_Priority = 0;
[[Default priority.]]
const Efl.Callback_Priority_After : Efl.Callback_Priority = 100;
[[Slightly less prioritized than default.]]
abstract Efl.Object
2014-03-09 00:31:28 -08:00
{
[[Abstract Efl object class]]
eo_prefix: efl;
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.
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 {
parent: Efl.Object @nullable; [[The new parent]]
2014-03-09 00:31:28 -08:00
}
}
@property name {
[[ The name of the object.
Every object can have a string name. Names may not contain
2017-12-20 01:52:31 -08:00
the following characters:
/ ? * [ ] ! \ :
2017-12-20 01:52:31 -08:00
Using any of these in a name will result in undefined
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.
]]
set {
}
get {
}
values {
name: string @nullable; [[The name]]
}
}
@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
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.
]]
set {
}
get {
}
values {
comment: string @nullable; [[The comment]]
}
}
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:
efl_debug_name_override(efl_super(obj, MY_CLASS), sb);
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
calling the super function.
@since 1.21
]]
params {
@in sb: ptr(Eina.Strbuf); [[A string buffer, must not be $null.]]
}
}
@property event_global_freeze_count @class {
2014-03-09 00:31:28 -08:00
get {
[[Return the global count of freeze events.
This is the amount of calls to @.event_global_freeze minus
the amount of calls to @.event_global_thaw.
EFL will not emit any event while this count is > 0 (Except
events marked $hot).
]]
2014-03-09 00:31:28 -08:00
}
values {
fcount: int; [[The global event freeze count]]
2014-03-09 00:31:28 -08:00
}
}
@property event_freeze_count {
2014-03-09 00:31:28 -08:00
get {
[[Return the count of freeze events for this object.
This is the amount of calls to @.event_freeze minus
the amount of calls to @.event_thaw.
This object will not emit any event while this count is > 0
(Except events marked $hot).
]]
2014-03-09 00:31:28 -08:00
}
values {
fcount: int; [[The event freeze count of this object]]
2014-03-09 00:31:28 -08:00
}
}
@property finalized {
2017-12-20 01:52:31 -08:00
[[True if the object is already finalized, otherwise false.]]
get {
}
values {
finalized: bool; [[$true if the object is finalized, $false otherwise]]
}
}
@property invalidated {
[[True if the object is already invalidated, otherwise false.]]
get {
}
values {
finalized: bool; [[$true if the object is invalidated, $false otherwise]]
}
}
@property invalidating {
[[True if the object is about to be invalidated, and the invalidation of the children is already happening.
Note this is true before the invalidate call on the object.
]]
get {
}
values {
invalidating: bool; [[$true if the object is invalidating, $false otherwise]]
}
}
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.
The object from the provider will then be returned.
The base implementation calls the provider_find function on the object parent,
and returns its result. If no parent is present NULL is returned.
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 {
klass : const(Efl.Class); [[The class identifier to search for]]
}
return : Efl.Object; [[Object from the provider list]]
}
constructor {
[[Call the object's constructor.
Should not be used with #eo_do. Only use it with #eo_do_super.
]]
return: Efl.Object; [[The new object created, can be NULL if aborting]]
}
destructor {
[[Call the object's destructor.
Should not be used with #efl_do. Only use it with #efl_do_super.
Will be triggered once #invalidate and #noref have been triggered.
]]
2014-03-09 00:31:28 -08:00
}
finalize {
2018-01-03 06:44:39 -08:00
[[Called at the end of efl_add. Should not be called, just overridden.]]
return: Efl.Object; [[The new object created, can be NULL if aborting]]
2014-03-09 00:31:28 -08:00
}
invalidate {
[[Called when parent reference is lost/set to $NULL and switch the state of the object to invalidate.]]
}
name_find @const {
[[Find a child object with the given name and return it.
The search string can be a glob (shell style, using *). It can also
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
the search will match any object of that class.
]]
params {
@in search: string; [[The name search string]]
}
return: Efl.Object; [[The first object found]]
}
event_thaw {
[[Thaw events of object.
Allows event callbacks to be called again for this object after a call
to @.event_freeze. The amount of thaws must match the amount of freezes
for events to be re-enabled.
]]
}
event_freeze {
[[Freeze events of this object.
Prevents event callbacks from being called for this object. Enable
events again using @.event_thaw. Events marked $hot cannot be stopped.
]]
}
event_global_thaw @class {
[[Gobally thaw events for ALL EFL OBJECTS.
Allows event callbacks to be called for all EFL objects after they have
been disabled by @.event_global_freeze. The amount of thaws must match
the amount of freezes for events to be re-enabled.
]]
2014-03-09 00:31:28 -08:00
}
event_global_freeze @class {
[[Globally freeze events for ALL EFL OBJECTS.
Prevents event callbacks from being called for all EFL objects.
Enable events again using @.event_global_thaw. Events marked $hot
cannot be stopped.
Note: USE WITH CAUTION.
]]
}
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.
]]
}
event_callback_forwarder_priority_add {
[[Add an event callback forwarder that will make this object emit an event whenever another
object ($source) emits it. The event is said to be forwarded from $source to this object.
The event is unaffected on $source and behave like any other event being propagated on
any object and will trigger all the handler registered on $source like nothing special
happened.
This allow object that hide internally another object to easily be able to propagate an event
without the need to add custom handler.
Note: The priority is used to make sure that you are intercepting the event when you expect
by inserting a handler at the right position in the stack of event handler on the object that
emit the event.]]
2014-03-09 00:31:28 -08:00
params {
@cref desc: Efl.Event_Description; [[The description of the event to listen to]]
@in priority: Efl.Callback_Priority; [[The priority at which to insert the event forwarder handler
in the existing list of handler on the source of event object. The lower the number, the higher
the priority. As a shortcut @Efl.Callback_Priority_Before,
@Efl.Callback_Priority_Default and @Efl.Callback_Priority_After can be used. See
@Efl.Callback_Priority for more details.]]
@in source: Efl.Object @nonull; [[The object which emits the initial event]]
2014-03-09 00:31:28 -08:00
}
}
event_callback_forwarder_del {
[[Remove an event callback forwarder for a specified event and object.]]
2014-03-09 00:31:28 -08:00
params {
@cref desc: Efl.Event_Description; [[The description of the event to listen to]]
@in new_obj: Efl.Object @nonull; [[The object to emit events from]]
2014-03-09 00:31:28 -08:00
}
}
children_iterator_new {
[[Get an iterator on all childrens]]
return: iterator<Efl.Object> @owned @warn_unused; [[Children iterator]]
2014-03-09 00:31:28 -08:00
}
composite_attach {
[[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.
See @.composite_detach, @.composite_part_is.
]]
params {
@in comp_obj: Efl.Object; [[the object that will be used to composite the parent.]]
}
2015-09-18 20:54:58 -07:00
return: bool; [[$true if successful. $false otherwise.]]
}
composite_detach {
[[Detach a composite object from another object.
This functions also sets the parent of comp_obj to $null.
See @.composite_attach, @.composite_part_is.
]]
params {
@in comp_obj: Efl.Object; [[The object that will be removed from the parent.]]
}
2015-09-18 20:54:58 -07:00
return: bool; [[$true if successful. $false otherwise.]]
}
composite_part_is {
[[Check if an object is part of a composite object.
See @.composite_attach, @.composite_part_is.
]]
return: bool; [[$true if it is. $false otherwise.]]
}
@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.
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
$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
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
}
implements {
class.constructor;
class.destructor;
}
2014-03-09 00:31:28 -08:00
events {
del @hot: void; [[Object is being deleted.]]
invalidate @hot: void; [[Object is being invalidated and loosing its parent.]]
noref @hot: void; [[Object has lost its last reference, only parent relationship is keeping it alive.]]
destruct @hot: void; [[Object has been fully destroyed. It can not be used
beyond this point. This event should only serve to clean up any
dangling pointer.]]
2014-03-09 00:31:28 -08: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]]
}