From 2492b561385859b7ef76fe816a8dc845f0b9bd09 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 7 Feb 2016 01:53:51 +0300 Subject: Fix some casts between signed and unsigned in some files. --- src/gui/widgets/listbox.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/gui/widgets/listbox.cpp') 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( + 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(mAlpha * 255.0F); + mHighlightColor.a = static_cast(mAlpha * 255.0F); graphics->setColor(mHighlightColor); Font *const font = getFont(); - const int rowHeight = getRowHeight(); + const int rowHeight = static_cast(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(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(y - mPadding) / getRowHeight(); + return (y - mPadding) / static_cast(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(getRowHeight()) * mSelected; - scroll.height = getRowHeight(); + scroll.height = static_cast(getRowHeight()); showPart(scroll); distributeValueChangedEvent(); -- cgit v1.2.3-70-g09d2