diff options
Diffstat (limited to 'src/gui/widgets/shoplistbox.cpp')
-rw-r--r-- | src/gui/widgets/shoplistbox.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 31c733a6..afcb97b4 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -71,14 +71,14 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) return; const int alpha = (int)(config.guiAlpha * 255.0f); - const gcn::Color &highlightColor = - Theme::getThemeColor(Theme::HIGHLIGHT, alpha); - const gcn::Color &backgroundColor = - Theme::getThemeColor(Theme::BACKGROUND, alpha); - const gcn::Color &warningColor = - Theme::getThemeColor(Theme::SHOP_WARNING, alpha); - const gcn::Color &textColor = - Theme::getThemeColor(Theme::TEXT); + auto highlightColor = Theme::getThemeColor(Theme::HIGHLIGHT); + auto backgroundColor = Theme::getThemeColor(Theme::BACKGROUND); + auto warningColor = Theme::getThemeColor(Theme::SHOP_WARNING); + auto textColor = Theme::getThemeColor(Theme::TEXT); + auto highlightTextColor = Theme::getThemeColor(Theme::HIGHLIGHT_TEXT); + highlightColor.a = alpha; + backgroundColor.a = alpha; + warningColor.a = alpha; auto *graphics = static_cast<Graphics*>(gcnGraphics); @@ -103,7 +103,8 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) gcn::Color blend = warningColor; blend.r = (blend.r + highlightColor.r) / 2; blend.g = (blend.g + highlightColor.g) / 2; - blend.b = (blend.g + highlightColor.b) / 2; + blend.b = (blend.b + highlightColor.b) / 2; + blend.a = alpha; graphics->setColor(blend); } } @@ -137,7 +138,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) } } - graphics->setColor(textColor); + graphics->setColor(i == mSelected ? highlightTextColor : textColor); graphics->drawText(mListModel->getElementAt(i), ITEM_ICON_SIZE + 5, y + (ITEM_ICON_SIZE - fontHeight) / 2); @@ -168,8 +169,7 @@ void ShopListBox::mouseMoved(gcn::MouseEvent &event) } else { - Item *item = mShopItems->at(index); - if (item) + if (Item *item = mShopItems->at(index)) { mItemPopup->setItem(item->getInfo()); mItemPopup->position(viewport->getMouseX(), viewport->getMouseY()); |