modules/menusystem : add a way to now the source of a widget action
This commit is contained in:
parent
10fb299158
commit
3339e675d3
6 changed files with 12 additions and 12 deletions
|
@ -113,7 +113,7 @@ function FlowBox:keyreleased(key, code)
|
|||
|
||||
if key == "A" then
|
||||
if (self.widget.selected >= 1 and self.widget.selected <= #self.widget.list) then
|
||||
self.widget.list[self.widget.selected]:action()
|
||||
self.widget.list[self.widget.selected]:action("key")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -145,7 +145,7 @@ function FlowBox:mousepressed(x, y, button, isTouch)
|
|||
if widget_selected >= 1 and widget_selected <= #self.widget.list then
|
||||
self.widget.selected = widget_selected
|
||||
self:getFocus()
|
||||
self.widget.list[self.widget.selected]:action()
|
||||
self.widget.list[self.widget.selected]:action("pointer")
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -130,7 +130,7 @@ function GridBox:keyreleased(key, code)
|
|||
end
|
||||
|
||||
if key == "A" and self.widget.selected <= #self.widget.list then
|
||||
self.widget.list[self.widget.selected]:action()
|
||||
self.widget.list[self.widget.selected]:action("key")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -201,7 +201,7 @@ function GridBox:mousepressed(x, y, button, isTouch)
|
|||
self:getFocus()
|
||||
|
||||
if #self.widget.list > 0 and self.widget.selected > 1 and self.widget.selected <= #self.widget.list then
|
||||
self.widget.list[self.widget.selected]:action()
|
||||
self.widget.list[self.widget.selected]:action("pointer")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -48,13 +48,13 @@ function HListBox:keyreleased(key, code)
|
|||
|
||||
if key == "A" then
|
||||
if (self.widget.selected >= 1 and self.widget.selected <= #self.widget.list) then
|
||||
self.widget.list[self.widget.selected]:action()
|
||||
self.widget.list[self.widget.selected]:action("key")
|
||||
end
|
||||
end
|
||||
|
||||
if key == "B" then
|
||||
if (self.widget.cancel >= 1 and self.widget.cancel <= #self.widget.list) then
|
||||
self.widget.list[self.widget.cancel]:action()
|
||||
self.widget.list[self.widget.cancel]:action("key")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -76,7 +76,7 @@ function HListBox:mousepressed(x, y, button, isTouch)
|
|||
self.widget.selected = widget_selected
|
||||
self:getFocus()
|
||||
if #self.widget.list > 0 then
|
||||
self.widget.list[self.widget.selected]:action()
|
||||
self.widget.list[self.widget.selected]:action("pointer")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -48,13 +48,13 @@ function ListBox:keyreleased(key, code)
|
|||
|
||||
if key == "A" then
|
||||
if (self.widget.selected >= 1 and self.widget.selected <= #self.widget.list) then
|
||||
self.widget.list[self.widget.selected]:action()
|
||||
self.widget.list[self.widget.selected]:action("key")
|
||||
end
|
||||
end
|
||||
|
||||
if key == "B" then
|
||||
if (self.widget.cancel >= 1 and self.widget.cancel <= #self.widget.list) then
|
||||
self.widget.list[self.widget.cancel]:action()
|
||||
self.widget.list[self.widget.cancel]:action("key")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -76,7 +76,7 @@ function ListBox:mousepressed(x, y, button, isTouch)
|
|||
self.widget.selected = widget_selected
|
||||
self:getFocus()
|
||||
if #self.widget.list > 0 then
|
||||
self.widget.list[self.widget.selected]:action()
|
||||
self.widget.list[self.widget.selected]:action("pointer")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ end
|
|||
|
||||
function Menu:cancelAction()
|
||||
if (self.widget.cancel ~= 0) then
|
||||
self.widget.list[self.widget.cancel]:action()
|
||||
self.widget.list[self.widget.cancel]:action("key")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ function BaseWidget:update(dt)
|
|||
-- N/A
|
||||
end
|
||||
|
||||
function BaseWidget:action()
|
||||
function BaseWidget:action(source)
|
||||
--self:destroy()
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue