Spinbox changes

This commit is contained in:
Henrique Santiago
2012-08-27 18:56:05 -03:00
parent 5a367cfe27
commit 0c5479b031
8 changed files with 47 additions and 7 deletions

View File

@@ -13,9 +13,9 @@ end
function UISpinBox:onMouseWheel(mousePos, direction)
if direction == MouseWheelUp then
self:setValue(self.value + 1)
self:up()
elseif direction == MouseWheelDown then
self:setValue(self.value - 1)
self:down()
end
return true
end
@@ -59,6 +59,14 @@ function UISpinBox:onStyleApply(styleName, styleNode)
end
end
function UISpinBox:up()
self:setValue(self.value + 1)
end
function UISpinBox:down()
self:setValue(self.value - 1)
end
function UISpinBox:setValue(value)
value = math.max(math.min(self.maximum, value), self.minimum)
if value == self.value then return end