diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-08-30 22:53:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-08-30 22:53:27 +0300 |
commit | 5cbd0d2cb7086fda592c00dbc3b07d06af95f080 (patch) | |
tree | d36b4ac344f31f34311c7cb7a9a637ed48356e3e /src/gui/widgets/textfield.cpp | |
parent | 4210163dae7d6266923ab11f78b631173c9533e3 (diff) | |
download | plus-5cbd0d2cb7086fda592c00dbc3b07d06af95f080.tar.gz plus-5cbd0d2cb7086fda592c00dbc3b07d06af95f080.tar.bz2 plus-5cbd0d2cb7086fda592c00dbc3b07d06af95f080.tar.xz plus-5cbd0d2cb7086fda592c00dbc3b07d06af95f080.zip |
Add const to more classes.
Diffstat (limited to 'src/gui/widgets/textfield.cpp')
-rw-r--r-- | src/gui/widgets/textfield.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 1c22a0a7b..c2189e74a 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -47,9 +47,9 @@ int TextField::instances = 0; float TextField::mAlpha = 1.0; ImageRect TextField::skin; -TextField::TextField(const std::string &text, bool loseFocusOnTab, - gcn::ActionListener* listener, std::string eventId, - bool sendAlwaysEvents): +TextField::TextField(const std::string &text, const bool loseFocusOnTab, + gcn::ActionListener *const listener, std::string eventId, + const bool sendAlwaysEvents): gcn::TextField(text), mSendAlwaysEvents(sendAlwaysEvents), mNumeric(false), @@ -86,7 +86,7 @@ TextField::~TextField() void TextField::updateAlpha() { - float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(Client::getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (alpha != mAlpha) @@ -128,13 +128,13 @@ void TextField::drawFrame(gcn::Graphics *graphics) static_cast<Graphics*>(graphics)->drawImageRect(0, 0, w, h, skin); } -void TextField::setNumeric(bool numeric) +void TextField::setNumeric(const bool numeric) { mNumeric = numeric; if (!numeric) return; - const char *text = mText.c_str(); + const char *const text = mText.c_str(); for (const char *textPtr = text; *textPtr; ++textPtr) { if (*textPtr < '0' || *textPtr > '9') @@ -150,7 +150,7 @@ int TextField::getValue() const if (!mNumeric) return 0; - int value = atoi(mText.c_str()); + const int value = atoi(mText.c_str()); if (value < mMinimum) return mMinimum; @@ -162,7 +162,7 @@ int TextField::getValue() const void TextField::keyPressed(gcn::KeyEvent &keyEvent) { - int val = keyEvent.getKey().getValue(); + const int val = keyEvent.getKey().getValue(); if (val >= 32) { @@ -335,7 +335,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) return; } - int action = static_cast<KeyEvent*>(&keyEvent)->getActionId(); + const int action = static_cast<KeyEvent*>(&keyEvent)->getActionId(); switch (action) { @@ -435,7 +435,7 @@ void TextField::handlePaste() } } -void TextField::handleCopy() +void TextField::handleCopy() const { std::string text = getText(); sendBuffer(text); |