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
columns.lua
17
columns.lua
@ -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
|
||||
|
Reference in New Issue
Block a user