Rename makeTabable() to makeCyclable()
This commit is contained in:
parent
d6ed0f9301
commit
370c10c787
6 changed files with 10 additions and 9 deletions
|
@ -13,9 +13,10 @@ return function(title, x,y, w,h, draw)
|
||||||
-- core.mouse.updateState(id, x,y,w,h) updates the state for this widget.
|
-- core.mouse.updateState(id, x,y,w,h) updates the state for this widget.
|
||||||
core.mouse.updateState(id, x,y,w,h)
|
core.mouse.updateState(id, x,y,w,h)
|
||||||
|
|
||||||
-- core.makeTabable makes the item focus on tab. Tab order is determied
|
-- core.makeCyclable makes the item focus on tab or whatever binding is
|
||||||
-- by the order you call the widget functions.
|
-- in place (see core.keyboard.cycle). Cycle order is determied by the
|
||||||
core.makeTabable(id)
|
-- order you call the widget functions.
|
||||||
|
core.makeCyclable(id)
|
||||||
|
|
||||||
-- core.registerDraw(id, drawfunction, drawfunction-arguments...)
|
-- core.registerDraw(id, drawfunction, drawfunction-arguments...)
|
||||||
-- shows widget when core.draw() is called.
|
-- shows widget when core.draw() is called.
|
||||||
|
|
|
@ -4,7 +4,7 @@ return function(info, x,y, w,h, draw)
|
||||||
local id = core.generateID()
|
local id = core.generateID()
|
||||||
|
|
||||||
core.mouse.updateState(id, x,y,w,h)
|
core.mouse.updateState(id, x,y,w,h)
|
||||||
core.makeTabable(id)
|
core.makeCyclable(id)
|
||||||
core.registerDraw(id, draw or core.style.Checkbox, info.checked,x,y,w,h)
|
core.registerDraw(id, draw or core.style.Checkbox, info.checked,x,y,w,h)
|
||||||
|
|
||||||
local checked = info.checked
|
local checked = info.checked
|
||||||
|
|
4
core.lua
4
core.lua
|
@ -59,7 +59,7 @@ function keyboard.isBindingDown(bind)
|
||||||
return keyboard.key == bind.key and modifiersDown
|
return keyboard.key == bind.key and modifiersDown
|
||||||
end
|
end
|
||||||
|
|
||||||
local function makeTabable(id)
|
local function makeCyclable(id)
|
||||||
keyboard.tryGrab(id)
|
keyboard.tryGrab(id)
|
||||||
if hasKeyFocus(id) then
|
if hasKeyFocus(id) then
|
||||||
if keyboard.isBindingDown(keyboard.cycle.prev) then
|
if keyboard.isBindingDown(keyboard.cycle.prev) then
|
||||||
|
@ -146,7 +146,7 @@ return {
|
||||||
isHot = isHot,
|
isHot = isHot,
|
||||||
isActive = isActive,
|
isActive = isActive,
|
||||||
hasKeyFocus = hasKeyFocus,
|
hasKeyFocus = hasKeyFocus,
|
||||||
makeTabable = makeTabable,
|
makeCyclable = makeCyclable,
|
||||||
|
|
||||||
style = require((...):match("(.-)[^%.]+$") .. '.style-default'),
|
style = require((...):match("(.-)[^%.]+$") .. '.style-default'),
|
||||||
color = color,
|
color = color,
|
||||||
|
|
|
@ -6,7 +6,7 @@ return function(info, x,y,w,h, draw)
|
||||||
|
|
||||||
local id = core.generateID()
|
local id = core.generateID()
|
||||||
core.mouse.updateState(id, x,y,w,h)
|
core.mouse.updateState(id, x,y,w,h)
|
||||||
core.makeTabable(id)
|
core.makeCyclable(id)
|
||||||
if core.isActive(id) then core.setKeyFocus(id) end
|
if core.isActive(id) then core.setKeyFocus(id) end
|
||||||
|
|
||||||
core.registerDraw(id, draw or core.style.Input, info.text, info.cursor, x,y,w,h)
|
core.registerDraw(id, draw or core.style.Input, info.text, info.cursor, x,y,w,h)
|
||||||
|
|
|
@ -9,7 +9,7 @@ return function(info, x,y,w,h, draw)
|
||||||
|
|
||||||
local id = core.generateID()
|
local id = core.generateID()
|
||||||
core.mouse.updateState(id, x,y,w,h)
|
core.mouse.updateState(id, x,y,w,h)
|
||||||
core.makeTabable(id)
|
core.makeCyclable(id)
|
||||||
core.registerDraw(id,draw or core.style.Slider, fraction, x,y,w,h, info.vertical)
|
core.registerDraw(id,draw or core.style.Slider, fraction, x,y,w,h, info.vertical)
|
||||||
|
|
||||||
-- mouse update
|
-- mouse update
|
||||||
|
|
|
@ -12,7 +12,7 @@ return function(info, x,y,w,h, draw)
|
||||||
|
|
||||||
local id = core.generateID()
|
local id = core.generateID()
|
||||||
core.mouse.updateState(id, x,y,w,h)
|
core.mouse.updateState(id, x,y,w,h)
|
||||||
core.makeTabable(id)
|
core.makeCyclable(id)
|
||||||
core.registerDraw(id,draw or core.style.Slider2D, fraction, x,y,w,h)
|
core.registerDraw(id,draw or core.style.Slider2D, fraction, x,y,w,h)
|
||||||
|
|
||||||
-- update value
|
-- update value
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue