yui/columns.lua

29 lines
742 B
Lua
Raw Normal View History

2022-09-12 09:34:46 +02:00
--- Columns layout for widgets
--
-- @classmod yui.Columns
-- @copyright 2022, The DoubleFourteen Code Forge
-- @author Lorenzo Cogotti, Andrea Pasquini
--
--- A widget container, lays down its child widgets into multiple columns.
local BASE = (...):gsub('columns$', '')
2022-08-15 23:41:17 +02:00
2022-08-16 00:23:52 +02:00
local Layout = require(BASE..'layout')
2022-08-15 23:41:17 +02:00
2022-09-12 09:34:46 +02:00
-- Advance position to next column
-- given current position, widget dimensions and padding
2022-08-15 23:41:17 +02:00
local function columnadvance(x,y, ww,wh, padding)
return x + ww + padding, y
end
local Columns = setmetatable({
advance = columnadvance,
__call = function(cls, args) return cls.new(args) end
}, Layout)
Columns.__index = Columns
2022-08-15 23:41:17 +02:00
function Columns.new(args) return setmetatable(Layout.new(args), Columns) end
2022-08-15 23:41:17 +02:00
return Columns