| 1 |
namespace phoenix { |
| 2 |
|
| 3 |
static guint Timer_trigger(pTimer* self) { |
| 4 |
//timer may have been disabled prior to triggering, so check state |
| 5 |
if(self->timer.state.enabled) { |
| 6 |
if(self->timer.onActivate) self->timer.onActivate(); |
| 7 |
} |
| 8 |
//callback may have disabled timer, so check state again |
| 9 |
if(self->timer.state.enabled) { |
| 10 |
g_timeout_add(self->timer.state.interval, (GSourceFunc)Timer_trigger, (gpointer)self); |
| 11 |
} |
| 12 |
//kill this timer instance (it is spawned above if needed again) |
| 13 |
return false; |
| 14 |
} |
| 15 |
|
| 16 |
void pTimer::setEnabled(bool enabled) { |
| 17 |
if(enabled) { |
| 18 |
g_timeout_add(timer.state.interval, (GSourceFunc)Timer_trigger, (gpointer)this); |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
void pTimer::setInterval(unsigned interval) { |
| 23 |
} |
| 24 |
|
| 25 |
void pTimer::constructor() { |
| 26 |
} |
| 27 |
|
| 28 |
} |