local Prop = require("gfx.prop") local Children = require("gfx.prop.children") local Element = require("gfx.element") local Container = Prop.attach(Element:new(), Children) function Container:getHeight() if self:isStrict() then return Element.getHeight(self) end local max = 0 for _,child in self:_iterateChildren() do max = math.max(max, child:getY() + child:getHeight()) end return max end function Container:getWidth() if self:isStrict() then return Element.getWidth(self) end local max = 0 for _,child in self:_iterateChildren() do max = math.max(max, child:getX() + child:getWidth()) end return max end function Container:isStrict() return self.strict == true end function Container:setStrict(strict) local needReload = (not not self.strict) ~= strict self.strict = strict if needReload then self:_reload() end end function Container:_reload() Element._reload(self) -- Reload child windows local win = self:_getWindow() for _,child in self:_iterateChildren() do if child:_getWindow() ~= win then child:setParent(win) end end end return Container