helium/layout/column.lua
Elmārs Āboliņš 5309f35dfc implemented the rest of the state callbacks
redid layout
luadoc + emmylua annotations everywhere
grid layout started
2021-06-15 03:36:09 +03:00

25 lines
562 B
Lua

local path = string.sub(..., 1, string.len(...) - string.len(".column"))
local layout = require(path..'.init')
---@class Column
local column = {}
column.__index = column
---@return layout
function column.new()
local self = setmetatable({}, column)
return layout(self.draw)
end
function column:draw(x, y, width, height, children, hpad, vpad, alignX)
local carriagePos = 0
if children then
for i, e in ipairs(children) do
local _, h = e:getSize()
e:draw(x, y+carriagePos+vpad)
carriagePos = carriagePos + h + vpad
end
end
end
return column