diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-05-04 17:02:05 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-05-04 17:02:05 +0300 |
commit | 6ed69c8769cd6c8c79c77fc8116059b42f3653e7 (patch) | |
tree | 48ede1453da63c58ba02ccc35ab06c3f7a61ddca /src/gui/widgets | |
parent | 002656b278ab1c2e09bca8f6ffd2d5c42d57b09c (diff) | |
download | plus-6ed69c8769cd6c8c79c77fc8116059b42f3653e7.tar.gz plus-6ed69c8769cd6c8c79c77fc8116059b42f3653e7.tar.bz2 plus-6ed69c8769cd6c8c79c77fc8116059b42f3653e7.tar.xz plus-6ed69c8769cd6c8c79c77fc8116059b42f3653e7.zip |
add function to graphics class to set normal and outline colors at once.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/avatarlistbox.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/emoteshortcutcontainer.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/itemshortcutcontainer.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/label.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/progressbar.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/spellshortcutcontainer.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/textbox.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/textpreview.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 3 |
10 files changed, 15 insertions, 27 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 3202a1e21..964a2ab82 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -110,8 +110,7 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics) const std::string name = player_node->getName(); // Draw the list elements - graphics->setColor(mForegroundColor); - graphics->setColor2(mForegroundColor2); + graphics->setColorAll(mForegroundColor, mForegroundColor2); for (int i = 0, y = 0; i < model->getNumberOfElements(); ++i, y += fontHeight) @@ -260,8 +259,7 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics) } } - graphics->setColor(mForegroundColor); - graphics->setColor2(mForegroundColor2); + graphics->setColorAll(mForegroundColor, mForegroundColor2); // Draw Name if (a->getDisplayBold()) diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 2edd5d67b..946205660 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -430,8 +430,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) break; if (!part.mType) { - graphics2->setColor(part.mColor); - graphics2->setColor2(part.mColor2); + graphics2->setColorAll(part.mColor, part.mColor2); if (part.mBold) boldFont->drawString(graphics, part.mText, part.mX, part.mY); else diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 9629384a4..086a19ef0 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -117,8 +117,7 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics) gcn::Font *const font = getFont(); drawBackground(g); - g->setColor(mForegroundColor); - g->setColor2(mForegroundColor2); + g->setColorAll(mForegroundColor, mForegroundColor2); for (unsigned i = 0; i < mMaxItems; i++) { const int emoteX = (i % mGridWidth) * mBoxWidth; diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index deb0c7c86..6a5392f14 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -138,8 +138,7 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics) // Draw item keyboard shortcut. std::string key = inputManager.getKeyValueString( Input::KEY_SHORTCUT_1 + i); - g->setColor(mForegroundColor); - g->setColor2(mForegroundColor); + g->setColorAll(mForegroundColor, mForegroundColor); font->drawString(g, key, itemX + 2, itemY + 2); diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index 4240ff2ad..854b0f33c 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -95,8 +95,8 @@ void Label::draw(gcn::Graphics* graphics) break; } - graphics->setColor(mForegroundColor); - static_cast<Graphics*>(graphics)->setColor2(mForegroundColor2); + static_cast<Graphics*>(graphics)->setColorAll( + mForegroundColor, mForegroundColor2); font->drawString(graphics, mCaption, textX, textY); BLOCK_END("Label::draw") } diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index 175bb7318..7d0041706 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -218,8 +218,7 @@ void ProgressBar::render(Graphics *graphics) const int textX = mDimension.width / 2; const int textY = (mDimension.height - font->getHeight()) / 2; - graphics->setColor(mForegroundColor); - graphics->setColor2(mOutlineColor); + graphics->setColorAll(mForegroundColor, mOutlineColor); font->drawString(graphics, mText, textX - font->getWidth(mText) / 2, textY); diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 262f49f58..f03f1d4ca 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -109,8 +109,7 @@ void SpellShortcutContainer::draw(gcn::Graphics *graphics) gcn::Font *const font = getFont(); const int selectedId = spellShortcut->getSelectedItem(); - g->setColor(mForegroundColor); - g->setColor2(mForegroundColor2); + g->setColorAll(mForegroundColor, mForegroundColor2); drawBackground(g); for (unsigned i = 0; i < mMaxItems; i++) diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index b0281e9bd..386a89bad 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -362,8 +362,8 @@ void TextBox::draw(gcn::Graphics* graphics) mCaretRow * getFont()->getHeight()); } - graphics->setColor(mForegroundColor); - static_cast<Graphics*>(graphics)->setColor2(mForegroundColor2); + static_cast<Graphics*>(graphics)->setColorAll( + mForegroundColor, mForegroundColor2); gcn::Font *const font = getFont(); const int fontHeight = font->getHeight(); diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index ceede7133..bea96e72a 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -114,16 +114,12 @@ void TextPreview::draw(gcn::Graphics* graphics) } } - g->setColor(gcn::Color(mTextColor->r, mTextColor->g, - mTextColor->b, alpha)); - g->setColor2(gcn::Color(mTextColor2->r, mTextColor2->g, - mTextColor2->b, alpha)); + g->setColorAll(gcn::Color(mTextColor->r, mTextColor->g, mTextColor->b, + alpha), gcn::Color(mTextColor2->r, mTextColor2->g, mTextColor2->b, + alpha)); if (mOutline && mTextColor != mTextColor2) - { - Graphics *const g = static_cast<Graphics *const>(graphics); g->setColor2(Theme::getThemeColor(Theme::OUTLINE)); - } mFont->drawString(graphics, mText, mPadding + 1, mPadding + 1); BLOCK_END("TextPreview::draw") diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 1b9b955f0..d266d3ce8 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -283,8 +283,7 @@ void Window::draw(gcn::Graphics *graphics) // Draw title if (mShowTitle) { - g->setColor(mForegroundColor); - g->setColor2(mForegroundColor2); + g->setColorAll(mForegroundColor, mForegroundColor2); int x; switch (static_cast<gcn::Graphics::Alignment>(mCaptionAlign)) { |