mirror of https://gitea.it/1414codeforge/yui
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
737 B
Lua
29 lines
737 B
Lua
--- 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$', '')
|
|
|
|
local Layout = require(BASE..'layout')
|
|
|
|
-- Advance position to next column
|
|
-- given current position, widget dimensions and padding
|
|
local function columnadvance(x,y, ww,_, 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
|
|
|
|
|
|
function Columns:new(args) return setmetatable(Layout:new(args), self) end
|
|
|
|
return Columns
|