summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-27 16:48:32 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-27 23:15:05 +0300
commitcdc721a1c6c5cf80736101352161b66ea3f90c50 (patch)
treec32e7e25fe1ad6f23efd2dc50c4eeb5431967249 /src/gui/widgets
parentcc78907ee5b2ed84760534897f88f8c1fcce957d (diff)
downloadplus-cdc721a1c6c5cf80736101352161b66ea3f90c50.tar.gz
plus-cdc721a1c6c5cf80736101352161b66ea3f90c50.tar.bz2
plus-cdc721a1c6c5cf80736101352161b66ea3f90c50.tar.xz
plus-cdc721a1c6c5cf80736101352161b66ea3f90c50.zip
Remove set font from graphics object.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/avatarlistbox.cpp28
-rw-r--r--src/gui/widgets/button.cpp1
-rw-r--r--src/gui/widgets/checkbox.cpp1
-rw-r--r--src/gui/widgets/dropdown.cpp1
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp1
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp1
-rw-r--r--src/gui/widgets/extendedlistbox.cpp1
-rw-r--r--src/gui/widgets/itemcontainer.cpp1
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp1
-rw-r--r--src/gui/widgets/label.cpp1
-rw-r--r--src/gui/widgets/listbox.cpp1
-rw-r--r--src/gui/widgets/radiobutton.cpp1
-rw-r--r--src/gui/widgets/shoplistbox.cpp1
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp1
-rw-r--r--src/gui/widgets/textbox.cpp1
-rw-r--r--src/gui/widgets/textfield.cpp1
-rw-r--r--src/gui/widgets/window.cpp1
17 files changed, 18 insertions, 26 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index d9fe65dfe..a8052fd8d 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -106,7 +106,6 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
mHighlightColor.a = static_cast<int>(mAlpha * 255.0f);
gcn::Font *const font = getFont();
- graphics->setFont(font);
const int fontHeight = getFont()->getHeight();
const gcn::Widget *const parent = mParent;
@@ -131,9 +130,6 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
graphics->drawImage(icon, mPadding, y + mPadding);
}
- if (a->getDisplayBold())
- graphics->setFont(boldFont);
-
std::string text;
if (a->getMaxHp() > 0)
@@ -268,13 +264,25 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
graphics->setColor(mForegroundColor);
// Draw Name
- if (a->getType() == MapItem::SEPARATOR)
- font->drawString(graphics, text, mPadding, y + mPadding);
- else
- font->drawString(graphics, text, 15 + mPadding, y + mPadding);
-
if (a->getDisplayBold())
- graphics->setFont(getFont());
+ {
+ if (a->getType() == MapItem::SEPARATOR)
+ {
+ boldFont->drawString(graphics, text, mPadding, y + mPadding);
+ }
+ else
+ {
+ boldFont->drawString(graphics, text,
+ 15 + mPadding, y + mPadding);
+ }
+ }
+ else
+ {
+ if (a->getType() == MapItem::SEPARATOR)
+ font->drawString(graphics, text, mPadding, y + mPadding);
+ else
+ font->drawString(graphics, text, 15 + mPadding, y + mPadding);
+ }
}
setWidth(parent->getWidth() - 10);
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 4606cca57..f0337766f 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -355,7 +355,6 @@ void Button::draw(gcn::Graphics *graphics)
// need move calculation from draw!!!
gcn::Font *const font = getFont();
- graphics->setFont(font);
switch (mAlignment)
{
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index 75c3960db..2d005c8bf 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -95,7 +95,6 @@ void CheckBox::draw(gcn::Graphics* graphics)
drawBox(graphics);
gcn::Font *const font = getFont();
- graphics->setFont(font);
graphics->setColor(mForegroundColor);
font->drawString(graphics, mCaption, mPadding + mImageSize + mSpacing,
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index ec564146e..384371107 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -228,7 +228,6 @@ void DropDown::draw(gcn::Graphics* graphics)
if (mPopup->getListModel() && mPopup->getSelected() >= 0)
{
gcn::Font *const font = getFont();
- graphics->setFont(font);
graphics->setColor(mForegroundColor);
font->drawString(graphics, mPopup->getListModel()->getElementAt(
mPopup->getSelected()), mPadding, mPadding);
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index 6f20be38a..ed45c15ab 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -102,7 +102,6 @@ void DropShortcutContainer::draw(gcn::Graphics *graphics)
}
Graphics *const g = static_cast<Graphics*>(graphics);
- graphics->setFont(getFont());
drawBackground(g);
const Inventory *const inv = PlayerInfo::getInventory();
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 68296ffc8..cb872ac5c 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -113,7 +113,6 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
Graphics *const g = static_cast<Graphics *const>(graphics);
gcn::Font *const font = getFont();
- graphics->setFont(font);
drawBackground(g);
graphics->setColor(mForegroundColor);
diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp
index af1480f86..8e27aace8 100644
--- a/src/gui/widgets/extendedlistbox.cpp
+++ b/src/gui/widgets/extendedlistbox.cpp
@@ -61,7 +61,6 @@ void ExtendedListBox::draw(gcn::Graphics *graphics)
updateAlpha();
gcn::Font *const font = getFont();
- graphics->setFont(font);
const int height = getRowHeight();
int textPos = (height - getFont()->getHeight()) / 2 + mPadding;
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index ffb6c590f..30cd9d063 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -236,7 +236,6 @@ void ItemContainer::draw(gcn::Graphics *graphics)
BLOCK_START("ItemContainer::draw")
Graphics *const g = static_cast<Graphics *const>(graphics);
gcn::Font *const font = getFont();
- g->setFont(font);
for (int j = 0; j < mGridRows; j++)
{
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index eaffa8fad..5308588d8 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -119,7 +119,6 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics)
Graphics *const g = static_cast<Graphics*>(graphics);
gcn::Font *const font = getFont();
- graphics->setFont(font);
drawBackground(g);
const Inventory *const inv = PlayerInfo::getInventory();
diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp
index 9efa375d7..04bb38662 100644
--- a/src/gui/widgets/label.cpp
+++ b/src/gui/widgets/label.cpp
@@ -73,7 +73,6 @@ void Label::draw(gcn::Graphics* graphics)
int textX;
const int textY = getHeight() / 2 - getFont()->getHeight() / 2;
gcn::Font *const font = getFont();
- graphics->setFont(font);
switch (mAlignment)
{
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index dbd54f3f3..c7d59f124 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -93,7 +93,6 @@ void ListBox::draw(gcn::Graphics *graphics)
mHighlightColor.a = static_cast<int>(mAlpha * 255.0f);
graphics->setColor(mHighlightColor);
gcn::Font *const font = getFont();
- graphics->setFont(font);
const int height = getRowHeight();
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index b2f38db4a..c5d14a261 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -153,7 +153,6 @@ void RadioButton::draw(gcn::Graphics* graphics)
drawBox(graphics);
gcn::Font *const font = getFont();
- graphics->setFont(font);
graphics->setColor(mForegroundColor);
font->drawString(graphics, mCaption, mPadding + mImageSize + mSpacing,
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index 11f350165..bd7c7ad11 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -97,7 +97,6 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics)
const int alpha = static_cast<int>(mAlpha * 255.0f);
Graphics *graphics = static_cast<Graphics*>(gcnGraphics);
gcn::Font *const font = getFont();
- graphics->setFont(font);
// Draw the list elements
for (int i = 0, y = 0;
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index ee43a5d3f..bc45a6432 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -105,7 +105,6 @@ void SpellShortcutContainer::draw(gcn::Graphics *graphics)
Graphics *const g = static_cast<Graphics *const>(graphics);
gcn::Font *const font = getFont();
- graphics->setFont(font);
const int selectedId = spellShortcut->getSelectedItem();
g->setColor(mForegroundColor);
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index 976d7f772..e5e8b50e5 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -357,7 +357,6 @@ void TextBox::draw(gcn::Graphics* graphics)
graphics->setColor(mForegroundColor);
gcn::Font *const font = getFont();
- graphics->setFont(font);
const int fontHeight = font->getHeight();
for (size_t i = 0, sz = mTextRows.size(); i < sz; i++)
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 02ad7699e..260b0fe57 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -131,7 +131,6 @@ void TextField::draw(gcn::Graphics *graphics)
graphics->setColor(mForegroundColor);
gcn::Font *const font = getFont();
- graphics->setFont(font);
font->drawString(graphics, mText, mPadding - mXScroll, mPadding);
BLOCK_END("TextField::draw")
}
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index ffeac0cb1..94256956b 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -267,7 +267,6 @@ void Window::draw(gcn::Graphics *graphics)
if (mShowTitle)
{
g->setColor(mForegroundColor);
- g->setFont(mCaptionFont);
int x;
switch (static_cast<gcn::Graphics::Alignment>(mCaptionAlign))
{