mirror of https://gitea.it/1414codeforge/yui
[*] General code improvement.
* Rework navigation allowing direct management and triggering for grabkeyboard widgets. * Navigation code now behaves better with deeply nested layouts. * Allow widget hierarchies deeper than 2 (__call() is implemented for every Widget metatable). * Make BASE locals more secure (match '<filename>$' in regexp)master
parent
3b2b460012
commit
1d42498ee7
@ -1,21 +1,20 @@
|
||||
local BASE = (...):gsub('columns', '')
|
||||
local BASE = (...):gsub('columns$', '')
|
||||
|
||||
local Layout = require(BASE..'layout')
|
||||
|
||||
|
||||
-- Advance position to next column,
|
||||
-- given current position, widget dimensions and padding.
|
||||
local function columnadvance(x,y, ww,wh, padding)
|
||||
return x + ww + padding, y
|
||||
end
|
||||
|
||||
function Columns(args)
|
||||
local self = Layout.new(args)
|
||||
local Columns = setmetatable({
|
||||
advance = columnadvance,
|
||||
__call = function(cls, args) return cls.new(args) end
|
||||
}, Layout)
|
||||
Columns.__index = Columns
|
||||
|
||||
self.advance = columnadvance
|
||||
self.prev = 'left'
|
||||
self.next = 'right'
|
||||
return self
|
||||
end
|
||||
|
||||
function Columns.new(args) return setmetatable(Layout.new(args), Columns) end
|
||||
|
||||
return Columns
|
||||
|
@ -1,21 +1,20 @@
|
||||
local BASE = (...):gsub('rows', '')
|
||||
local BASE = (...):gsub('rows$', '')
|
||||
|
||||
local Layout = require(BASE..'layout')
|
||||
|
||||
|
||||
-- Advance position to next row,
|
||||
-- given current position, widget dimensions and padding.
|
||||
local function rowadvance(x,y, ww,wh, padding)
|
||||
return x, y + wh + padding
|
||||
end
|
||||
|
||||
function Rows(args)
|
||||
local self = Layout.new(args)
|
||||
local Rows = setmetatable({
|
||||
advance = rowadvance,
|
||||
__call = function(cls, args) return cls.new(args) end
|
||||
}, Layout)
|
||||
Rows.__index = Rows
|
||||
|
||||
self.advance = rowadvance
|
||||
self.prev = 'up'
|
||||
self.next = 'down'
|
||||
return self
|
||||
end
|
||||
|
||||
function Rows.new(args) return setmetatable(Layout.new(args), Rows) end
|
||||
|
||||
return Rows
|
||||
|
@ -1,14 +1,15 @@
|
||||
local BASE = (...):gsub('spacer', '')
|
||||
local BASE = (...):gsub('spacer$', '')
|
||||
|
||||
local Widget = require(BASE..'widget')
|
||||
|
||||
-- Spacers don't accept focus
|
||||
local Spacer = setmetatable({ nofocus = true }, Widget)
|
||||
local Spacer = setmetatable({
|
||||
nofocus = true,
|
||||
__call = function(cls, args) return cls.new(args) end
|
||||
}, Widget)
|
||||
Spacer.__index = Spacer
|
||||
|
||||
|
||||
function Spacer.new(args)
|
||||
return setmetatable(args, Spacer)
|
||||
end
|
||||
function Spacer.new(args) return setmetatable(args, Spacer) end
|
||||
|
||||
return Spacer
|
||||
|
Loading…
Reference in New Issue