diff --git a/gfx/padding.lua b/gfx/padding.lua index b3337de..6f2ad16 100644 --- a/gfx/padding.lua +++ b/gfx/padding.lua @@ -8,6 +8,17 @@ local Padding = Element:new{ element = nil } +function Padding:new(opts) + local obj = Element.new(self, opts) + obj.element:setPos(obj:getPaddingLeft(), obj:getPaddingTop()) + obj:resize{ + width = obj:getWidth(), + height = obj:getHeight() + } + obj.element:setParent(obj:_getWindow()) + return obj +end + function Padding:resize(opts) -- Un-pad dimensions and pass to child element return self.element:resize{ @@ -16,6 +27,13 @@ function Padding:resize(opts) } end +function Padding:draw() + Element.draw(self) + local win = self:_getWindow() + win.clear() + self.element:draw() +end + function Padding:getPaddingLeft() return self.left end