|
|
|
@ -4,6 +4,7 @@ UISpinBox = extends(UITextEdit)
|
|
|
|
|
function UISpinBox.create()
|
|
|
|
|
local spinbox = UISpinBox.internalCreate()
|
|
|
|
|
spinbox:setValidCharacters('0123456789')
|
|
|
|
|
spinbox.displayButtons = true
|
|
|
|
|
spinbox.minimum = 0
|
|
|
|
|
spinbox.maximum = 0
|
|
|
|
|
spinbox.value = 0
|
|
|
|
@ -50,15 +51,33 @@ end
|
|
|
|
|
function UISpinBox:onStyleApply(styleName, styleNode)
|
|
|
|
|
for name, value in pairs(styleNode) do
|
|
|
|
|
if name == 'maximum' then
|
|
|
|
|
addEvent(function() self:setMaximum(value)
|
|
|
|
|
end)
|
|
|
|
|
addEvent(function() self:setMaximum(value) end)
|
|
|
|
|
elseif name == 'minimum' then
|
|
|
|
|
addEvent(function() self:setMinimum(value)
|
|
|
|
|
end)
|
|
|
|
|
addEvent(function() self:setMinimum(value) end)
|
|
|
|
|
elseif name == 'buttons' then
|
|
|
|
|
addEvent(function()
|
|
|
|
|
if value then
|
|
|
|
|
self:showButtons()
|
|
|
|
|
else
|
|
|
|
|
self:hideButtons()
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function UISpinBox:showButtons()
|
|
|
|
|
self:getChildById('up'):show()
|
|
|
|
|
self:getChildById('down'):show()
|
|
|
|
|
self.displayButtons = true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function UISpinBox:hideButtons()
|
|
|
|
|
self:getChildById('up'):hide()
|
|
|
|
|
self:getChildById('down'):hide()
|
|
|
|
|
self.displayButtons = false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function UISpinBox:up()
|
|
|
|
|
self:setValue(self.value + 1)
|
|
|
|
|
end
|
|
|
|
|