2016-03-23 08:05:20 -07:00
|
|
|
import ecore_types;
|
2016-02-16 05:55:20 -08:00
|
|
|
|
2014-06-26 11:37:40 -07:00
|
|
|
class Ecore.Timer (Eo.Base)
|
2014-03-23 22:47:52 -07:00
|
|
|
{
|
2015-06-08 09:36:23 -07:00
|
|
|
[[Timers are objects that will call a given callback at some point
|
|
|
|
in the future.
|
|
|
|
|
|
|
|
They may also optionall repeat themselves if the timer callback returns
|
|
|
|
true. If it does not they will be automatically deleted and never called
|
|
|
|
again. Timers require the ecore mainloop to be running and functioning
|
|
|
|
properly. They do not guarantee exact timing, but try to work on a "best
|
|
|
|
effort basis.
|
|
|
|
]]
|
2014-03-23 22:47:52 -07:00
|
|
|
eo_prefix: ecore_obj_timer;
|
2015-05-07 08:36:45 -07:00
|
|
|
methods {
|
|
|
|
@property interval {
|
2014-03-23 22:47:52 -07:00
|
|
|
set {
|
2015-06-08 09:36:23 -07:00
|
|
|
[[Change the interval the timer ticks off. If set during
|
|
|
|
a timer call, this will affect the next interval.
|
|
|
|
]]
|
2014-03-23 22:47:52 -07:00
|
|
|
}
|
|
|
|
get {
|
2015-06-08 09:36:23 -07:00
|
|
|
[[Get the interval the timer ticks on.]]
|
2014-03-23 22:47:52 -07:00
|
|
|
}
|
|
|
|
values {
|
2015-06-08 09:36:23 -07:00
|
|
|
in: double(-1); [[The new interval in seconds]]
|
2014-03-23 22:47:52 -07:00
|
|
|
}
|
|
|
|
}
|
2015-05-07 08:36:45 -07:00
|
|
|
@property pending {
|
2014-03-23 22:47:52 -07:00
|
|
|
get {
|
2015-06-08 09:36:23 -07:00
|
|
|
[[Get the pending time regarding a timer.]]
|
2014-08-07 08:58:45 -07:00
|
|
|
return: double;
|
2014-03-23 22:47:52 -07:00
|
|
|
}
|
|
|
|
}
|
2014-09-01 07:53:35 -07:00
|
|
|
loop_constructor {
|
2015-06-08 09:36:23 -07:00
|
|
|
[[Create a timer to call in a given time from now]]
|
2014-08-27 07:01:09 -07:00
|
|
|
legacy: null;
|
|
|
|
params {
|
2015-06-08 09:36:23 -07:00
|
|
|
@in in: double; [[The time, in seconds, from now when to go off]]
|
|
|
|
@in func: Ecore_Task_Cb; [[The callback function to call when the
|
|
|
|
timer goes off]]
|
|
|
|
@in data: const(void)*; [[A pointer to pass to the callback function
|
|
|
|
as its data pointer]]
|
2014-08-27 07:01:09 -07:00
|
|
|
}
|
|
|
|
}
|
2014-09-01 07:53:35 -07:00
|
|
|
constructor {
|
2015-06-08 09:36:23 -07:00
|
|
|
[[Create a timer to call in a given time from when the mainloop woke
|
|
|
|
up from sleep]]
|
2014-08-27 07:01:09 -07:00
|
|
|
legacy: null;
|
|
|
|
params {
|
2015-06-08 09:36:23 -07:00
|
|
|
@in in: double; [[The time, in seconds, from when the main loop
|
|
|
|
woke up, to go off]]
|
|
|
|
@in func: Ecore_Task_Cb; [[The callback function to call when the
|
|
|
|
timer goes off]]
|
|
|
|
@in data: const(void)*; [[A pointer to pass to the callback
|
|
|
|
function as its data pointer]]
|
2014-08-27 07:01:09 -07:00
|
|
|
}
|
|
|
|
}
|
2014-03-23 22:47:52 -07:00
|
|
|
reset {
|
2015-06-08 09:36:23 -07:00
|
|
|
/* FIXME-doc:
|
|
|
|
* @note This is equivalent to (but faster than)
|
2014-07-25 17:19:30 -07:00
|
|
|
* @code
|
|
|
|
* ecore_timer_delay(timer, ecore_timer_interval_get(timer) - ecore_timer_pending_get(timer));
|
|
|
|
* @endcode
|
|
|
|
*/
|
2015-06-08 09:36:23 -07:00
|
|
|
[[Reset a timer to its full interval. This effectively makes the
|
|
|
|
timer start ticking off from zero now.
|
|
|
|
|
|
|
|
@since 1.2
|
|
|
|
]]
|
2014-03-23 22:47:52 -07:00
|
|
|
}
|
|
|
|
delay {
|
2015-06-08 09:36:23 -07:00
|
|
|
[[Add some delay for the next occurrence of a timer.
|
|
|
|
This doesn't affect the interval of a timer.
|
|
|
|
]]
|
2014-03-23 22:47:52 -07:00
|
|
|
params {
|
2015-06-08 09:36:23 -07:00
|
|
|
@in add: double; [[The amount of time to delay the timer by in seconds]]
|
2014-03-23 22:47:52 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
implements {
|
2014-06-20 03:14:59 -07:00
|
|
|
Eo.Base.destructor;
|
2015-05-20 06:56:45 -07:00
|
|
|
Eo.Base.finalize;
|
2014-06-20 03:14:59 -07:00
|
|
|
Eo.Base.event_freeze;
|
2014-07-25 17:19:30 -07:00
|
|
|
/* XXX: can't document overriden methods
|
|
|
|
* Pauses a running timer.
|
|
|
|
*
|
|
|
|
* @param timer The timer to be paused.
|
|
|
|
*
|
|
|
|
* The timer callback won't be called while the timer is paused. The remaining
|
|
|
|
* time until the timer expires will be saved, so the timer can be resumed with
|
|
|
|
* that same remaining time to expire, instead of expiring instantly. Use
|
|
|
|
* ecore_timer_thaw() to resume it.
|
|
|
|
*
|
|
|
|
* @note Nothing happens if the timer was already paused.
|
|
|
|
*
|
|
|
|
* @see ecore_timer_thaw()
|
|
|
|
*/
|
2014-06-20 03:14:59 -07:00
|
|
|
Eo.Base.event_freeze_count.get;
|
|
|
|
Eo.Base.event_thaw;
|
2014-07-25 17:19:30 -07:00
|
|
|
/* XXX: can't document overriden methods
|
|
|
|
* Resumes a frozen (paused) timer.
|
|
|
|
*
|
|
|
|
* @param timer The timer to be resumed.
|
|
|
|
*
|
|
|
|
* The timer will be resumed from its previous relative position in time. That
|
|
|
|
* means, if it had X seconds remaining until expire when it was paused, it will
|
|
|
|
* be started now with those same X seconds remaining to expire again. But
|
|
|
|
* notice that the interval time won't be touched by this call or by
|
|
|
|
* ecore_timer_freeze().
|
|
|
|
*
|
|
|
|
* @see ecore_timer_freeze()
|
|
|
|
*/
|
2014-09-01 07:53:35 -07:00
|
|
|
}
|
|
|
|
constructors {
|
|
|
|
.constructor;
|
|
|
|
.loop_constructor;
|
|
|
|
}
|
2014-05-12 03:11:14 -07:00
|
|
|
}
|