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

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

View File

@ -4,8 +4,38 @@ SpinBox < UISpinBox
size: 86 20 size: 86 20
text-offset: 0 3 text-offset: 0 3
text-margin: 3 text-margin: 3
image-source: /images/panel_flat.png image-source: /images/textedit.png
image-border: 1 image-border: 1
$disabled: $disabled:
color: #aaaaaa88 color: #aaaaaa88
Button
id: up
size: 10 10
image-source: /images/spinbox_up.png
image-border: 1
image-clip: 0 0 10 10
anchors.top: parent.top
anchors.right: parent.right
@onClick: self:getParent():up()
$hover:
image-clip: 0 10 10 10
$pressed:
image-clip: 0 20 10 10
Button
id: down
size: 10 10
image-source: /images/spinbox_down.png
image-border: 1
image-clip: 0 0 10 10
anchors.bottom: parent.bottom
anchors.right: parent.right
@onClick: self:getParent():down()
$hover:
image-clip: 0 10 10 10
$pressed:
image-clip: 0 20 10 10

View File

@ -4,7 +4,7 @@ TextEdit < UITextEdit
size: 86 20 size: 86 20
text-offset: 0 3 text-offset: 0 3
text-margin: 3 text-margin: 3
image-source: /images/panel_flat.png image-source: /images/textedit.png
image-border: 1 image-border: 1
$disabled: $disabled:

View File

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

View File

@ -1,17 +1,18 @@
CountWindow < MainWindow CountWindow < MainWindow
id: countWindow id: countWindow
!text: tr('Move Stackable Item') !text: tr('Move Stackable Item')
size: 196 112 size: 196 122
Label Label
!text: tr('Amount:') !text: tr('Amount:')
width: 64 text-auto-resize: true
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
margin-top: 2 margin-top: 2
SpinBox SpinBox
id: countSpinBox id: countSpinBox
margin-left: 5
anchors.left: prev.right anchors.left: prev.right
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top

View File

@ -515,7 +515,8 @@ bool Map::loadOtcm(const std::string& fileName)
fin->close(); fin->close();
//g_logger.debug(stdext::format("Otcm load time: %.2f seconds", loadTimer.elapsed_seconds())); // well, this is really slow
g_logger.debug(stdext::format("Otcm load time: %.2f seconds", loadTimer.elapsed_seconds()));
return true; return true;
} catch(stdext::exception& e) { } catch(stdext::exception& e) {
g_logger.error(stdext::format("failed to load OTCM map: %s", e.what())); g_logger.error(stdext::format("failed to load OTCM map: %s", e.what()));