diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-03-19 15:09:27 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-03-19 15:09:27 +0000 |
commit | 3ddaec5f355ed1d231514cf0a863c4b9e35cf2a6 (patch) | |
tree | 5084eaa47d4874a3a573de226f19c4be072e4888 /src/gui/inttextbox.cpp | |
parent | 19d5cc3a6bbbd911361b7e8b956840d0189d4c2b (diff) | |
download | mana-client-3ddaec5f355ed1d231514cf0a863c4b9e35cf2a6.tar.gz mana-client-3ddaec5f355ed1d231514cf0a863c4b9e35cf2a6.tar.bz2 mana-client-3ddaec5f355ed1d231514cf0a863c4b9e35cf2a6.tar.xz mana-client-3ddaec5f355ed1d231514cf0a863c4b9e35cf2a6.zip |
Reverted changeset r2269 (toString) as requested by ElvenProgrammer.
Diffstat (limited to 'src/gui/inttextbox.cpp')
-rw-r--r-- | src/gui/inttextbox.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gui/inttextbox.cpp b/src/gui/inttextbox.cpp index 92f21e5f..560a6cec 100644 --- a/src/gui/inttextbox.cpp +++ b/src/gui/inttextbox.cpp @@ -23,9 +23,9 @@ #include "inttextbox.h" -#include <guichan/key.hpp> +#include <sstream> -#include "../utils/tostring.h" +#include <guichan/key.hpp> IntTextBox::IntTextBox(int i): mValue(i) @@ -40,8 +40,9 @@ void IntTextBox::keyPress(const gcn::Key &key) gcn::TextBox::keyPress(key); } - std::stringstream s(gcn::TextBox::getText()); + std::stringstream s; int i; + s << gcn::TextBox::getText(); s >> i; if (gcn::TextBox::getText() != "") setInt(i); @@ -62,10 +63,11 @@ int IntTextBox::getInt() void IntTextBox::setInt(int i) { + std::stringstream s; + if (i >= mMin && i <= mMax) mValue = i; - - const std::string valStr = toString(mValue); - setText(valStr); - setCaretPosition(valStr.length() + 1); + s << mValue; + setText(s.str()); + setCaretPosition(s.str().length() + 1); } |