summaryrefslogtreecommitdiff
path: root/src/gui/serverdialog.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/serverdialog.cpp
parent7bedfccf5982534a9cbcb2c18ca0d37df117bfc8 (diff)
downloadManaVerse-2d17967845119a77aec6388bb27c47339052704a.tar.gz
ManaVerse-2d17967845119a77aec6388bb27c47339052704a.tar.bz2
ManaVerse-2d17967845119a77aec6388bb27c47339052704a.tar.xz
ManaVerse-2d17967845119a77aec6388bb27c47339052704a.zip
Improve draw perfomance.
Add new theme color DROPDOWN_SHADOW.
Diffstat (limited to 'src/gui/serverdialog.cpp')
-rw-r--r--src/gui/serverdialog.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 143d3e5a3..763c190d6 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -158,6 +158,10 @@ public:
ServersListBox(ServersListModel *model):
ListBox(model)
{
+ mHighlightColor = Theme::getThemeColor(Theme::HIGHLIGHT);
+ mTextColor = Theme::getThemeColor(Theme::TEXT);
+ mNotSupportedColor = Theme::getThemeColor(
+ Theme::SERVER_VERSION_NOT_SUPPORTED);
}
void draw(gcn::Graphics *graphics)
@@ -169,20 +173,18 @@ public:
updateAlpha();
- graphics->setColor(Theme::getThemeColor(Theme::HIGHLIGHT,
- static_cast<int>(mAlpha * 255.0f)));
+ mHighlightColor.a = static_cast<int>(mAlpha * 255.0f);
+ graphics->setColor(mHighlightColor);
graphics->setFont(getFont());
const int height = getRowHeight();
- const gcn::Color unsupported =
- Theme::getThemeColor(Theme::SERVER_VERSION_NOT_SUPPORTED,
- static_cast<int>(mAlpha * 255.0f));
+ mNotSupportedColor.a = static_cast<int>(mAlpha * 255.0f);
// Draw filled rectangle around the selected list element
if (mSelected >= 0)
{
- graphics->fillRectangle(gcn::Rectangle(0, height * mSelected,
- getWidth(), height));
+ graphics->fillRectangle(gcn::Rectangle(0,
+ height * mSelected, getWidth(), height));
}
// Draw the list elements
@@ -191,7 +193,7 @@ public:
{
ServerInfo info = model->getServer(i);
- graphics->setColor(Theme::getThemeColor(Theme::TEXT));
+ graphics->setColor(mTextColor);
int top;
@@ -212,7 +214,7 @@ public:
if (info.version.first > 0)
{
- graphics->setColor(unsupported);
+ graphics->setColor(mNotSupportedColor);
graphics->drawText(info.version.second,
getWidth() - info.version.first - 2, top);
@@ -224,6 +226,10 @@ public:
{
return 2 * getFont()->getHeight();
}
+private:
+ gcn::Color mHighlightColor;
+ gcn::Color mTextColor;
+ gcn::Color mNotSupportedColor;
};