core/menusystem: make widget register themselves

This commit is contained in:
Kazhnuz 2019-02-10 21:12:33 +01:00
parent e9d01d1e65
commit 1dfb2a1f70

View file

@ -3,7 +3,9 @@ local Widget = {}
BaseWidget = Object:extend()
DummyWidget = BaseWidget:extend()
function BaseWidget:new()
function BaseWidget:new(controller)
self.controller = controller
self.destroyed = false
self.selectable = false
self.selection_margin = 0
@ -16,6 +18,12 @@ function BaseWidget:new()
self.canvas = {}
self.canvas.texture = nil
self.canvas.needRedraw = true
self:register()
end
function BaseWidget:register()
self.controller:addWidget(self)
end
function BaseWidget:setCanvas(w, h)