From 5cbd0d2cb7086fda592c00dbc3b07d06af95f080 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 30 Aug 2012 22:53:27 +0300 Subject: Add const to more classes. --- src/gui/widgets/textbox.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/gui/widgets/textbox.cpp') diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 06a24c68f..5079b8bf2 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -41,7 +41,7 @@ TextBox::TextBox() : mMinWidth = getWidth(); } -void TextBox::setTextWrapped(const std::string &text, int minDimension) +void TextBox::setTextWrapped(const std::string &text, const int minDimension) { // Make sure parent scroll area sets width of this widget if (getParent()) @@ -91,7 +91,7 @@ void TextBox::setTextWrapped(const std::string &text, int minDimension) std::string word = line.substr(lastSpacePos, spacePos - lastSpacePos); - int width = getFont()->getWidth(word); + const int width = getFont()->getWidth(word); if (xpos == 0 && width > mMinWidth) { @@ -158,8 +158,8 @@ void TextBox::setTextWrapped(const std::string &text, int minDimension) void TextBox::keyPressed(gcn::KeyEvent& keyEvent) { - gcn::Key key = keyEvent.getKey(); - int action = static_cast(&keyEvent)->getActionId(); + const gcn::Key key = keyEvent.getKey(); + const int action = static_cast(&keyEvent)->getActionId(); switch (action) { @@ -282,11 +282,11 @@ void TextBox::keyPressed(gcn::KeyEvent& keyEvent) case Input::KEY_GUI_PAGE_UP: { - gcn::Widget* par = getParent(); + gcn::Widget *const par = getParent(); if (par) { - int rowsPerPage = par->getChildrenArea().height + const int rowsPerPage = par->getChildrenArea().height / getFont()->getHeight(); mCaretRow -= rowsPerPage; @@ -298,11 +298,11 @@ void TextBox::keyPressed(gcn::KeyEvent& keyEvent) case Input::KEY_GUI_PAGE_DOWN: { - gcn::Widget* par = getParent(); + gcn::Widget *const par = getParent(); if (par) { - int rowsPerPage = par->getChildrenArea().height + const int rowsPerPage = par->getChildrenArea().height / getFont()->getHeight(); mCaretRow += rowsPerPage; -- cgit v1.2.3-70-g09d2