From 1768a3c449f0bb9ac1533781f5134eebe0f9c458 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 19 Aug 2012 00:45:35 +0300 Subject: Fix hightlight selected shop item. --- src/gui/widgets/shoplistbox.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index c7a3bdb1e..7dcd38a88 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -102,7 +102,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) i < mListModel->getNumberOfElements(); ++i, y += mRowHeight) { -/* + bool needDraw(false); gcn::Color temp; gcn::Color* backgroundColor = &mBackgroundColor; mBackgroundColor.a = alpha; @@ -124,15 +124,20 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) temp.a = alpha; backgroundColor = &temp; } + needDraw = true; } else if (i == mSelected) { backgroundColor = &mHighlightColor; + needDraw = true; + } + + if (needDraw) + { + graphics->setColor(*backgroundColor); + graphics->fillRectangle(gcn::Rectangle(0, y, getWidth(), mRowHeight)); } -// graphics->setColor(*backgroundColor); -// graphics->fillRectangle(gcn::Rectangle(0, y, getWidth(), mRowHeight)); -*/ if (mShopItems) { Image *icon = mShopItems->at(i)->getImage(); @@ -142,6 +147,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) graphics->drawImage(icon, 1, y); } } + graphics->setColor(getForegroundColor()); graphics->drawText(mListModel->getElementAt(i), ITEM_ICON_SIZE + 5, y + (ITEM_ICON_SIZE - getFont()->getHeight()) / 2); } -- cgit v1.2.3-70-g09d2