yui/rows.lua

29 lines
702 B
Lua
Raw Normal View History

2022-09-12 09:34:46 +02:00
--- Row layout for widgets
--
-- @classmod yui.Rows
-- @copyright 2022, The DoubleFourteen Code Forge
-- @author Lorenzo Cogotti, Andrea Pasquini
--
-- A widget container, lays down its child widgets into multiple rows.
2022-09-12 09:34:46 +02:00
local BASE = (...):gsub('rows$', '')
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
-- Advance position to next row,
-- given current position, widget dimensions and padding.
local function rowadvance(x,y, _,wh, padding)
2022-08-15 23:41:17 +02:00
return x, y + wh + padding
end
local Rows = setmetatable({
advance = rowadvance,
__call = function(cls, args) return cls:new(args) end
}, Layout)
Rows.__index = Rows
2022-08-15 23:41:17 +02:00
2023-09-19 18:16:18 +02:00
function Rows:new(args) return setmetatable(Layout:new(args), self) end
2022-08-15 23:41:17 +02:00
return Rows