require("common.class") local Field = require("components.pager.field") ---@class ContainerField: Field ---@field content Field[] local ContainerField = { __tostring = function() return "ContainerField" end, } ---Create a new ContainerField instance --- ---Inherits from Field ---@param o Field ---@return ContainerField function ContainerField:new(o) o = o or {} --set instance members o.content = o.content or {} return Inherit(self, o, Field) end ---Add field to list container ---@param field Field function ContainerField:addField(field) field.parent = self.parent table.insert(self.content, field) end function ContainerField:drawBackground(deltaTime) end function ContainerField:drawContent(deltaTime) for _, child in ipairs(self.content) do child:render(deltaTime) end end function ContainerField:drawForeground(deltaTime) end function ContainerField:render(deltaTime) gfx.Save() gfx.Translate(self.posX, self.posY) gfx.Scissor(self.offX, self.offY, self.aabbW, self.aabbH) self:drawBackground(deltaTime) self:drawContent(deltaTime) self:drawForeground(deltaTime) gfx.Restore() end return ContainerField