summaryrefslogtreecommitdiff
path: root/src/gui/widgets/dropdown.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-08-22 21:16:34 +0300
committerAndrei Karas <akaras@inbox.ru>2011-08-22 21:16:34 +0300
commit2d17967845119a77aec6388bb27c47339052704a (patch)
tree965b636cf677ddf93a30e8606405594a79b7f105 /src/gui/widgets/dropdown.cpp
parent7bedfccf5982534a9cbcb2c18ca0d37df117bfc8 (diff)
downloadmv-2d17967845119a77aec6388bb27c47339052704a.tar.gz
mv-2d17967845119a77aec6388bb27c47339052704a.tar.bz2
mv-2d17967845119a77aec6388bb27c47339052704a.tar.xz
mv-2d17967845119a77aec6388bb27c47339052704a.zip
Improve draw perfomance.
Add new theme color DROPDOWN_SHADOW.
Diffstat (limited to 'src/gui/widgets/dropdown.cpp')
-rw-r--r--src/gui/widgets/dropdown.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 681d7736e..f01d3fb55 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -101,6 +101,10 @@ DropDown::DropDown(gcn::ListModel *listModel):
}
instances++;
+
+ mHighlightColor = Theme::getThemeColor(Theme::HIGHLIGHT);
+ mShadowColor = Theme::getThemeColor(Theme::DROPDOWN_SHADOW);
+ setForegroundColor(Theme::getThemeColor(Theme::TEXT));
}
DropDown::~DropDown()
@@ -163,25 +167,20 @@ void DropDown::draw(gcn::Graphics* graphics)
updateAlpha();
const int alpha = static_cast<int>(mAlpha * 255.0f);
- gcn::Color faceColor = getBaseColor();
- faceColor.a = alpha;
- const gcn::Color *highlightColor = &Theme::getThemeColor(Theme::HIGHLIGHT,
- alpha);
- gcn::Color shadowColor = faceColor - 0x303030;
- shadowColor.a = alpha;
+ mHighlightColor.a = alpha;
+ mShadowColor.a = alpha;
if (mListBox->getListModel() && mListBox->getSelected() >= 0)
{
graphics->setFont(getFont());
- graphics->setColor(Theme::getThemeColor(Theme::TEXT));
+ graphics->setColor(getForegroundColor());
graphics->drawText(mListBox->getListModel()->getElementAt(
mListBox->getSelected()), 1, 0);
}
if (isFocused())
{
- if (highlightColor)
- graphics->setColor(*highlightColor);
+ graphics->setColor(mHighlightColor);
graphics->drawRectangle(gcn::Rectangle(0, 0, getWidth() - h, h));
}
@@ -193,10 +192,9 @@ void DropDown::draw(gcn::Graphics* graphics)
// Draw two lines separating the ListBox with selected
// element view.
- if (highlightColor)
- graphics->setColor(*highlightColor);
+ graphics->setColor(mHighlightColor);
graphics->drawLine(0, h, getWidth(), h);
- graphics->setColor(shadowColor);
+ graphics->setColor(mShadowColor);
graphics->drawLine(0, h + 1, getWidth(), h + 1);
}
}