summaryrefslogtreecommitdiff
path: root/src/gui/widgets/listbox.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-07 01:53:51 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-07 01:53:51 +0300
commit2492b561385859b7ef76fe816a8dc845f0b9bd09 (patch)
tree62633f8cd7c027c2a8e1bae61264a79394aeb751 /src/gui/widgets/listbox.cpp
parentce14a018a6f66aa1309ebe71a8217082d83cd0da (diff)
downloadplus-2492b561385859b7ef76fe816a8dc845f0b9bd09.tar.gz
plus-2492b561385859b7ef76fe816a8dc845f0b9bd09.tar.bz2
plus-2492b561385859b7ef76fe816a8dc845f0b9bd09.tar.xz
plus-2492b561385859b7ef76fe816a8dc845f0b9bd09.zip
Fix some casts between signed and unsigned in some files.
Diffstat (limited to 'src/gui/widgets/listbox.cpp')
-rw-r--r--src/gui/widgets/listbox.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index d7346b5b2..c827911eb 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -122,7 +122,8 @@ ListBox::ListBox(const Widget2 *const widget,
}
const Font *const font = getFont();
- mRowHeight = font->getHeight() + 2 * mItemPadding;
+ mRowHeight = static_cast<unsigned int>(
+ font->getHeight() + 2 * mItemPadding);
}
void ListBox::postInit()
@@ -156,10 +157,10 @@ void ListBox::draw(Graphics *graphics)
BLOCK_START("ListBox::draw")
updateAlpha();
- mHighlightColor.a = static_cast<int>(mAlpha * 255.0F);
+ mHighlightColor.a = static_cast<unsigned int>(mAlpha * 255.0F);
graphics->setColor(mHighlightColor);
Font *const font = getFont();
- const int rowHeight = getRowHeight();
+ const int rowHeight = static_cast<int>(getRowHeight());
const int width = mDimension.width;
if (mCenterText)
@@ -358,8 +359,8 @@ void ListBox::adjustSize()
BLOCK_START("ListBox::adjustSize")
if (mListModel)
{
- setHeight(getRowHeight() * mListModel->getNumberOfElements()
- + 2 * mPadding);
+ setHeight(static_cast<int>(getRowHeight()) *
+ mListModel->getNumberOfElements() + 2 * mPadding);
}
BLOCK_END("ListBox::adjustSize")
}
@@ -375,7 +376,7 @@ int ListBox::getSelectionByMouse(const int y) const
{
if (y < mPadding)
return -1;
- return static_cast<unsigned int>(y - mPadding) / getRowHeight();
+ return (y - mPadding) / static_cast<int>(getRowHeight());
}
void ListBox::setSelected(const int selected)
@@ -399,9 +400,9 @@ void ListBox::setSelected(const int selected)
if (mSelected < 0)
scroll.y = 0;
else
- scroll.y = getRowHeight() * mSelected;
+ scroll.y = static_cast<int>(getRowHeight()) * mSelected;
- scroll.height = getRowHeight();
+ scroll.height = static_cast<int>(getRowHeight());
showPart(scroll);
distributeValueChangedEvent();