summaryrefslogtreecommitdiff
path: root/src/guichan/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-07-18 01:51:36 +0300
committerAndrei Karas <akaras@inbox.ru>2012-07-18 01:51:36 +0300
commitf0e95132f27ceb901fbd779fafc798a1f67a06a6 (patch)
tree52ee9ab21f4e01c2c8ae70b86841b0138349645d /src/guichan/widgets
parent7e0a97d2521b9ce57003176e82a0b5564aa003c2 (diff)
downloadmv-f0e95132f27ceb901fbd779fafc798a1f67a06a6.tar.gz
mv-f0e95132f27ceb901fbd779fafc798a1f67a06a6.tar.bz2
mv-f0e95132f27ceb901fbd779fafc798a1f67a06a6.tar.xz
mv-f0e95132f27ceb901fbd779fafc798a1f67a06a6.zip
Another warning fixes.
Diffstat (limited to 'src/guichan/widgets')
-rw-r--r--src/guichan/widgets/textbox.cpp23
-rw-r--r--src/guichan/widgets/textfield.cpp4
2 files changed, 14 insertions, 13 deletions
diff --git a/src/guichan/widgets/textbox.cpp b/src/guichan/widgets/textbox.cpp
index 0103cdb99..6b03a1cb5 100644
--- a/src/guichan/widgets/textbox.cpp
+++ b/src/guichan/widgets/textbox.cpp
@@ -100,9 +100,9 @@ namespace gcn
pos = text.find("\n", lastPos);
if (pos != std::string::npos)
- length = pos - lastPos;
+ length = static_cast<int>(pos - lastPos);
else
- length = text.size() - lastPos;
+ length = static_cast<int>(text.size() - lastPos);
std::string sub = text.substr(lastPos, length);
mTextRows.push_back(sub);
lastPos = pos + 1;
@@ -133,7 +133,8 @@ namespace gcn
for (size_t i = 0; i < mTextRows.size(); i++)
{
// Move the text one pixel so we can have a caret before a letter.
- graphics->drawText(mTextRows[i], 1, i * getFont()->getHeight());
+ graphics->drawText(mTextRows[i], 1,
+ static_cast<int>(i * getFont()->getHeight()));
}
}
@@ -150,7 +151,7 @@ namespace gcn
mCaretRow = mouseEvent.getY() / getFont()->getHeight();
if (mCaretRow >= static_cast<int>(mTextRows.size()))
- mCaretRow = mTextRows.size() - 1;
+ mCaretRow = static_cast<int>(mTextRows.size() - 1);
mCaretColumn = getFont()->getStringIndexAt(
mTextRows[mCaretRow], mouseEvent.getX());
@@ -177,7 +178,7 @@ namespace gcn
}
setWidth(width + 1);
- setHeight(getFont()->getHeight() * mTextRows.size());
+ setHeight(static_cast<int>(getFont()->getHeight() * mTextRows.size()));
}
void TextBox::setCaretPosition(unsigned int position)
@@ -197,8 +198,8 @@ namespace gcn
}
// position beyond end of text
- mCaretRow = mTextRows.size() - 1;
- mCaretColumn = mTextRows[mCaretRow].size();
+ mCaretRow = static_cast<int>(mTextRows.size() - 1);
+ mCaretColumn = static_cast<int>(mTextRows[mCaretRow].size());
}
unsigned int TextBox::getCaretPosition() const
@@ -206,7 +207,7 @@ namespace gcn
int pos = 0, row;
for (row = 0; row < mCaretRow; row++)
- pos += mTextRows[row].size();
+ pos += static_cast<int>(mTextRows[row].size());
return pos + mCaretColumn;
}
@@ -222,7 +223,7 @@ namespace gcn
mCaretRow = row;
if (mCaretRow >= static_cast<int>(mTextRows.size()))
- mCaretRow = mTextRows.size() - 1;
+ mCaretRow = static_cast<int>(mTextRows.size() - 1);
if (mCaretRow < 0)
mCaretRow = 0;
@@ -240,7 +241,7 @@ namespace gcn
mCaretColumn = column;
if (mCaretColumn > static_cast<int>(mTextRows[mCaretRow].size()))
- mCaretColumn = mTextRows[mCaretRow].size();
+ mCaretColumn = static_cast<int>(mTextRows[mCaretRow].size());
if (mCaretColumn < 0)
mCaretColumn = 0;
@@ -268,7 +269,7 @@ namespace gcn
unsigned int TextBox::getNumberOfRows() const
{
- return mTextRows.size();
+ return static_cast<int>(mTextRows.size());
}
std::string TextBox::getText() const
diff --git a/src/guichan/widgets/textfield.cpp b/src/guichan/widgets/textfield.cpp
index b23722cc4..b74d2333f 100644
--- a/src/guichan/widgets/textfield.cpp
+++ b/src/guichan/widgets/textfield.cpp
@@ -83,7 +83,7 @@ namespace gcn
void TextField::setText(const std::string& text)
{
if (text.size() < mCaretPosition)
- mCaretPosition = text.size();
+ mCaretPosition = static_cast<int>(text.size());
mText = text;
}
@@ -151,7 +151,7 @@ namespace gcn
void TextField::setCaretPosition(unsigned int position)
{
if (position > mText.size())
- mCaretPosition = mText.size();
+ mCaretPosition = static_cast<int>(mText.size());
else
mCaretPosition = position;