summaryrefslogtreecommitdiff
path: root/src/gui/widgets/inttextfield.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-30 02:10:59 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-30 02:10:59 +0300
commit46f0755975033f37eaae9db73c0e2b6499c2a923 (patch)
tree5c13c361ce4a4e4fd0e07fca1953c54637965666 /src/gui/widgets/inttextfield.cpp
parent1feb7f7edc5f8f383e594b256ef4cab0fae75b99 (diff)
downloadmanaplus-46f0755975033f37eaae9db73c0e2b6499c2a923.tar.gz
manaplus-46f0755975033f37eaae9db73c0e2b6499c2a923.tar.bz2
manaplus-46f0755975033f37eaae9db73c0e2b6499c2a923.tar.xz
manaplus-46f0755975033f37eaae9db73c0e2b6499c2a923.zip
Add const to more classes.
Diffstat (limited to 'src/gui/widgets/inttextfield.cpp')
-rw-r--r--src/gui/widgets/inttextfield.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gui/widgets/inttextfield.cpp b/src/gui/widgets/inttextfield.cpp
index fbc51ee3d..bb7de3a13 100644
--- a/src/gui/widgets/inttextfield.cpp
+++ b/src/gui/widgets/inttextfield.cpp
@@ -31,8 +31,8 @@
#include "debug.h"
-IntTextField::IntTextField(int def, int min, int max,
- bool enabled, int width):
+IntTextField::IntTextField(const int def, const int min, const int max,
+ const bool enabled, const int width) :
TextField(toString(def)),
mDefault(def),
mValue(def)
@@ -47,7 +47,7 @@ IntTextField::IntTextField(int def, int min, int max,
void IntTextField::keyPressed(gcn::KeyEvent &event)
{
- int action = static_cast<KeyEvent*>(&event)->getActionId();
+ const int action = static_cast<KeyEvent*>(&event)->getActionId();
if (action == Input::KEY_GUI_DELETE || action == Input::KEY_GUI_BACKSPACE)
{
@@ -71,7 +71,7 @@ void IntTextField::keyPressed(gcn::KeyEvent &event)
distributeActionEvent();
}
-void IntTextField::setRange(int min, int max)
+void IntTextField::setRange(const int min, const int max)
{
mMin = min;
mMax = max;
@@ -87,12 +87,12 @@ void IntTextField::setRange(int min, int max)
mDefault = mMax;
}
-int IntTextField::getValue()
+int IntTextField::getValue() const
{
return getText().empty() ? mMin : mValue;
}
-void IntTextField::setValue(int i)
+void IntTextField::setValue(const int i)
{
if (i < mMin)
mValue = mMin;
@@ -106,7 +106,7 @@ void IntTextField::setValue(int i)
setCaretPosition(static_cast<unsigned>(valStr.length()) + 1);
}
-void IntTextField::setDefaultValue(int value)
+void IntTextField::setDefaultValue(const int value)
{
if (value < mMin)
mDefault = mMin;