2012-06-26 00:13:30 +02:00
|
|
|
-- @docvars @{
|
2011-08-26 17:06:52 +02:00
|
|
|
|
2012-06-26 00:13:30 +02:00
|
|
|
-- root widget
|
|
|
|
rootWidget = g_ui.getRootWidget()
|
2012-01-05 02:28:29 +01:00
|
|
|
|
2012-06-04 14:38:15 +02:00
|
|
|
-- G is used as a global table to save variables in memory between reloads
|
|
|
|
G = G or {}
|
|
|
|
|
2012-06-26 00:13:30 +02:00
|
|
|
-- @}
|
2012-01-03 01:42:53 +01:00
|
|
|
|
2012-06-26 00:13:30 +02:00
|
|
|
-- @docfuncs @{
|
2012-02-06 20:19:47 +01:00
|
|
|
|
2012-02-20 03:27:08 +01:00
|
|
|
function scheduleEvent(callback, delay)
|
2012-06-26 00:13:30 +02:00
|
|
|
local event = g_dispatcher.scheduleEvent(callback, delay)
|
2012-02-20 03:27:08 +01:00
|
|
|
-- must hold a reference to the callback, otherwise it would be collected
|
|
|
|
event._callback = callback
|
|
|
|
return event
|
|
|
|
end
|
|
|
|
|
|
|
|
function addEvent(callback, front)
|
2012-06-26 00:13:30 +02:00
|
|
|
local event = g_dispatcher.addEvent(callback, front)
|
2012-02-20 03:27:08 +01:00
|
|
|
-- must hold a reference to the callback, otherwise it would be collected
|
|
|
|
event._callback = callback
|
|
|
|
return event
|
|
|
|
end
|
|
|
|
|
2012-06-06 22:14:53 +02:00
|
|
|
function cycleEvent(callback, front)
|
2012-06-26 00:13:30 +02:00
|
|
|
local event = g_dispatcher.cycleEvent(callback, front)
|
2012-06-06 22:14:53 +02:00
|
|
|
-- must hold a reference to the callback, otherwise it would be collected
|
|
|
|
event._callback = callback
|
|
|
|
return event
|
|
|
|
end
|
|
|
|
|
2012-02-20 03:27:08 +01:00
|
|
|
function removeEvent(event)
|
|
|
|
if event then
|
|
|
|
event:cancel()
|
|
|
|
event._callback = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-06-26 00:13:30 +02:00
|
|
|
-- @}
|