core/menusystem: make widget register themselves
This commit is contained in:
parent
e9d01d1e65
commit
1dfb2a1f70
1 changed files with 9 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue