DRAFT
Ecore events provide two main features that are of use to those using ecore: creating events and being notified of events.
Those two will usually be used in different contexts, creating events is mainly done by libraries wrapping some system functionality while being notified of events is mainly a necessity of applications.
For a program to be notified of events it's interested in it needs to have a function to process the event and to register that function as the callback to the event, that's all.
efl.Ecore.Event.NONE
- None event.efl.Ecore.Event.SIGNAL_USER
- User signal event.efl.Ecore.Event.SIGNAL_HUP
- Hup signal event.efl.Ecore.Event.SIGNAL_EXIT
- Exit signal event.efl.Ecore.Event.SIGNAL_POWER
- Power signal event.efl.Ecore.Event.SIGNAL_REALTIME
- Realtime signal event.efl.Ecore.Event.MEMORY_STATE
- Memory state changed.efl.Ecore.Event.POWER_STATE
- Power state changed.efl.Ecore.Event.MEMORY_STATE_NORMAL
- Memory state normal.efl.Ecore.Event.MEMORY_STATE_LOW
- Memory state low.efl.Ecore.Event.POWER_STATE_MAINS
- Connected to power supply.efl.Ecore.Event.POWER_STATE_BATTERY
- Running on battery power.efl.Ecore.Event.POWER_STATE_LOW
- Low on battery power.efl.Ecore.Event.LOCALE_CHANGED
- System locale changed.efl.Ecore.Event.HOSTNAME_CHANGED
- System hostname changed.efl.Ecore.Event.SYSTEM_TIMEDATE_CHANGED
- System time and date changed.Syntax
var event = efl.Ecore.Event.add(type)
Parameters
Return value
If it succeeds, an event of type type will be added to the queue for processing by event handlers added by efl.Ecore.Event.addHandler()
. You can call del()
on the returned object to cancel the event.
Syntax
function func_start() {...}; function func_filter(loop_data, eventType) {...}; function func_end(loop_data) {...}; efl.Ecore.Event.addFilter(func_start, func_filter, func_end)
Parameters
Return value
Adds a callback to filter events from the event queue. Filters are called on the queue just before Event handler processing to try and remove redundant events. Just as processing is about to start func_start
is called, the return value of this functions is passed to func_filter
as loop_data
. func_filter
is also passed the event type. If this func_filter
returns false
, the event is removed from the queue, if it returns true
, the event is kept. When processing is finished func_end
is called and is passed the loop_data
(returned by func_start
) to clean up.
Syntax
function mycallback(type) { ... }; var handler = efl.Ecore.Event.addHandler(type, mycallback);
Parameters
Return value
Add an event handler to the list of handlers. This will, on success, return a handle to the event handler object that was created, that can be used later to remove the handler using the del()
method on it. The type parameter is the integer of the event type that will trigger this callback to be called. The callback func is called when this event is processed and will be passed the event type.
Syntax
function mycallback(type) { ... }; var handler = efl.Ecore.Event.addSignalUserHandler(mycallback);
Parameters
Return value
Adds an event handler for the efl.Ecore.Event.SIGNAL_USER
event type.
Syntax
function mycallback(type) { ... }; var handler = efl.Ecore.Event.addSignalExitHandler(mycallback);
Parameters
Return value
Adds an event handler for the efl.Ecore.Event.SIGNAL_EXIT
event type.
Syntax
function mycallback(type) { ... }; var handler = efl.Ecore.Event.addSignalRealtimeHandler(mycallback);
Parameters
Return value
Adds an event handler for the efl.Ecore.Event.SIGNAL_REALTIME
event type.
Syntax
var type = efl.Ecore.Event.getCurrentType()
Return value
efl.Ecore.Event.NONE
otherwise.If the program is currently inside an Ecore event handler callback this will return the type of the current event being processed.
Syntax
var eventType = efl.Ecore.Event.newType()
Return value
This function allocates a new event type id and returns it. Once an event type has been allocated it can never be de-allocated during the life of the program. There is no guarantee of the contents of this event ID, or how it is calculated, except that the ID will be unique to the current instance of the process.
Syntax
eventObj.del();
Deletes from the queue an event that was added through efl.Ecore.Event.add
.
Syntax
filterObj.del();
Deletes from the queue an filter that was added through efl.Ecore.Event.addFilter
.
Syntax
handlerObj.del();
Deletes from the queue an handler that was added through efl.Ecore.Event.addHandler
& friends.