summaryrefslogtreecommitdiff
path: root/src/gui/inttextbox.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2006-03-19 20:43:10 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2006-03-19 20:43:10 +0000
commit654d24e74c56d240b8d622840c135e22a029636d (patch)
tree5eb8b94f7832bdbb6d21c7ded6e6da6b5f8f3464 /src/gui/inttextbox.cpp
parent3ddaec5f355ed1d231514cf0a863c4b9e35cf2a6 (diff)
downloadmana-654d24e74c56d240b8d622840c135e22a029636d.tar.gz
mana-654d24e74c56d240b8d622840c135e22a029636d.tar.bz2
mana-654d24e74c56d240b8d622840c135e22a029636d.tar.xz
mana-654d24e74c56d240b8d622840c135e22a029636d.zip
Unreverted latest change by Doener due to my lack of proper communication abilities.
Diffstat (limited to 'src/gui/inttextbox.cpp')
-rw-r--r--src/gui/inttextbox.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/gui/inttextbox.cpp b/src/gui/inttextbox.cpp
index 560a6cec..92f21e5f 100644
--- a/src/gui/inttextbox.cpp
+++ b/src/gui/inttextbox.cpp
@@ -23,10 +23,10 @@
#include "inttextbox.h"
-#include <sstream>
-
#include <guichan/key.hpp>
+#include "../utils/tostring.h"
+
IntTextBox::IntTextBox(int i):
mValue(i)
{
@@ -40,9 +40,8 @@ void IntTextBox::keyPress(const gcn::Key &key)
gcn::TextBox::keyPress(key);
}
- std::stringstream s;
+ std::stringstream s(gcn::TextBox::getText());
int i;
- s << gcn::TextBox::getText();
s >> i;
if (gcn::TextBox::getText() != "")
setInt(i);
@@ -63,11 +62,10 @@ int IntTextBox::getInt()
void IntTextBox::setInt(int i)
{
- std::stringstream s;
-
if (i >= mMin && i <= mMax)
mValue = i;
- s << mValue;
- setText(s.str());
- setCaretPosition(s.str().length() + 1);
+
+ const std::string valStr = toString(mValue);
+ setText(valStr);
+ setCaretPosition(valStr.length() + 1);
}