Initial commit

This commit is contained in:
Matthias Richter 2012-02-07 23:10:29 +01:00
commit 40dbc7134b
11 changed files with 542 additions and 0 deletions

19
checkbox.lua Normal file
View file

@ -0,0 +1,19 @@
local core = require((...):match("^(.+)%.[^%.]+") .. '.core')
return function(info, x,y, w,h, draw)
local id = core.generateID()
core.mouse.updateState(id, x,y,w,h)
core.makeTabable(id)
core.registerDraw(id, draw or core.style.Checkbox, info.checked,x,y,w,h)
local checked = info.checked
local key = core.keyboard.key
if core.mouse.releasedOn(id) or
(core.hasKeyFocus(id) and key == 'return' or key == ' ') then
info.checked = not info.checked
end
return info.checked ~= checked
end