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-08-24 11:18:48 +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, ww,wh, padding)
|
|
|
|
return x, y + wh + padding
|
|
|
|
end
|
|
|
|
|
2022-08-24 11:18:48 +02:00
|
|
|
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
|
|
|
|
2022-08-24 11:18:48 +02:00
|
|
|
|
|
|
|
function Rows.new(args) return setmetatable(Layout.new(args), Rows) end
|
2022-08-15 23:41:17 +02:00
|
|
|
|
|
|
|
return Rows
|