mirror of
https://codeberg.org/1414codeforge/yui.git
synced 2025-06-05 22:19:11 +02:00
[*] 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)
This commit is contained in:
17
rows.lua
17
rows.lua
@ -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
|
||||
|
Reference in New Issue
Block a user