summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-02-16 22:17:22 +0300
committerAndrei Karas <akaras@inbox.ru>2014-02-16 22:17:22 +0300
commit6e6c5b2ba399e0ed364ada843c4c759ee54de219 (patch)
tree562e6a840c856ba8c4d35c6806020289c65d54d2 /src/gui/widgets
parent82ac4641828ec7387863bb18cf4493190c4cc68f (diff)
downloadmv-6e6c5b2ba399e0ed364ada843c4c759ee54de219.tar.gz
mv-6e6c5b2ba399e0ed364ada843c4c759ee54de219.tar.bz2
mv-6e6c5b2ba399e0ed364ada843c4c759ee54de219.tar.xz
mv-6e6c5b2ba399e0ed364ada843c4c759ee54de219.zip
combine font classes in one.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/avatarlistbox.cpp6
-rw-r--r--src/gui/widgets/browserbox.cpp9
-rw-r--r--src/gui/widgets/button.cpp6
-rw-r--r--src/gui/widgets/checkbox.cpp4
-rw-r--r--src/gui/widgets/colorpage.cpp6
-rw-r--r--src/gui/widgets/dropdown.cpp4
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp4
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp5
-rw-r--r--src/gui/widgets/extendedlistbox.cpp5
-rw-r--r--src/gui/widgets/itemcontainer.cpp4
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp5
-rw-r--r--src/gui/widgets/label.cpp8
-rw-r--r--src/gui/widgets/listbox.cpp6
-rw-r--r--src/gui/widgets/progressbar.cpp6
-rw-r--r--src/gui/widgets/radiobutton.cpp6
-rw-r--r--src/gui/widgets/setupitem.cpp6
-rw-r--r--src/gui/widgets/shoplistbox.cpp4
-rw-r--r--src/gui/widgets/sliderlist.cpp5
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp5
-rw-r--r--src/gui/widgets/tabs/setup_colors.cpp4
-rw-r--r--src/gui/widgets/tabs/setup_input.cpp2
-rw-r--r--src/gui/widgets/tabs/tab.cpp2
-rw-r--r--src/gui/widgets/tabs/tab.h2
-rw-r--r--src/gui/widgets/textbox.cpp6
-rw-r--r--src/gui/widgets/textfield.cpp6
-rw-r--r--src/gui/widgets/textpreview.cpp9
-rw-r--r--src/gui/widgets/textpreview.h4
-rw-r--r--src/gui/widgets/window.cpp4
-rw-r--r--src/gui/widgets/window.h4
29 files changed, 67 insertions, 80 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 8e4d9e483..298ab657a 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -28,16 +28,14 @@
#include "being/localplayer.h"
+#include "gui/font.h"
#include "gui/gui.h"
-#include "gui/sdlfont.h"
#include "gui/viewport.h"
#include "gui/windows/chatwindow.h"
#include "resources/image.h"
-#include "gui/base/font.hpp"
-
#include "debug.h"
int AvatarListBox::instances = 0;
@@ -103,7 +101,7 @@ void AvatarListBox::draw(Graphics *graphics)
mListModel);
updateAlpha();
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
const int fontHeight = getFont()->getHeight();
const gcn::Widget *const parent = mParent;
const std::string name = player_node->getName();
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index c158171c0..60b67dc24 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -25,8 +25,8 @@
#include "input/inputmanager.h"
+#include "gui/font.h"
#include "gui/gui.h"
-#include "gui/sdlfont.h"
#include "gui/widgets/linkhandler.h"
@@ -37,7 +37,6 @@
#include "utils/stringutils.h"
#include "utils/timer.h"
-#include "gui/base/font.hpp"
#include "gui/base/cliprectangle.hpp"
#include "render/graphics.h"
@@ -175,7 +174,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop)
std::string tmp = row;
std::string newRow;
size_t idx1;
- const gcn::Font *const font = getFont();
+ const Font *const font = getFont();
int linksCount = 0;
if (getWidth() < 0)
@@ -491,7 +490,7 @@ void BrowserBox::draw(Graphics *graphics)
}
}
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
FOR_EACH (LinePartCIter, i, mLineParts)
{
@@ -530,7 +529,7 @@ int BrowserBox::calcHeight()
if (maxWidth < 0)
return 1;
- const gcn::Font *const font = getFont();
+ const Font *const font = getFont();
const int fontHeight = font->getHeight() + 2 * mItemPadding;
const int fontWidthMinus = font->getWidth("-");
const char *const hyphen = "~";
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 8bc3d7540..5d27af68a 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -31,7 +31,7 @@
#include "resources/imageset.h"
-#include "gui/base/font.hpp"
+#include "gui/font.h"
#include "debug.h"
@@ -426,7 +426,7 @@ void Button::draw(Graphics *graphics)
const gcn::Rectangle &rect = mDimension;
const int width = rect.width;
const int height = rect.height;
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
int textY = height / 2 - font->getHeight() / 2;
if (mImages)
imageY = height / 2 - mImageHeight / 2;
@@ -559,7 +559,7 @@ void Button::widgetMoved(const Event &event A_UNUSED)
void Button::adjustSize()
{
- const gcn::Font *const font = getFont();
+ const Font *const font = getFont();
const Skin *const skin = button[BUTTON_STANDARD];
if (!skin)
return;
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index 9b67b0359..0772c0d4f 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -30,7 +30,7 @@
#include "resources/image.h"
-#include "gui/base/font.hpp"
+#include "gui/font.h"
#include "debug.h"
@@ -100,7 +100,7 @@ void CheckBox::draw(Graphics *const graphics)
BLOCK_START("CheckBox::draw")
drawBox(graphics);
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
graphics->setColorAll(mForegroundColor, mForegroundColor2);
font->drawString(graphics, mCaption, mPadding + mImageSize + mSpacing,
mPadding);
diff --git a/src/gui/widgets/colorpage.cpp b/src/gui/widgets/colorpage.cpp
index a9cf4f71e..6803fbe3c 100644
--- a/src/gui/widgets/colorpage.cpp
+++ b/src/gui/widgets/colorpage.cpp
@@ -22,7 +22,7 @@
#include "gui/widgets/colormodel.h"
-#include "gui/base/font.hpp"
+#include "gui/font.h"
#include "debug.h"
@@ -33,7 +33,7 @@ ColorPage::ColorPage(const Widget2 *const widget,
{
mItemPadding = mSkin ? mSkin->getOption("itemPadding") : 1;
mRowHeight = 13;
- const gcn::Font *const font = getFont();
+ const Font *const font = getFont();
if (font)
mRowHeight = font->getHeight() + 2 * mItemPadding;
if (mListModel)
@@ -57,7 +57,7 @@ void ColorPage::draw(Graphics *graphics)
mHighlightColor.a = static_cast<int>(mAlpha * 255.0F);
graphics->setColor(mHighlightColor);
updateAlpha();
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
const int rowHeight = getRowHeight();
const int width = mDimension.width;
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 225ea11bb..42fa89b30 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -33,7 +33,7 @@
#include "resources/image.h"
-#include "gui/base/font.hpp"
+#include "gui/font.h"
#include <algorithm>
@@ -235,7 +235,7 @@ void DropDown::draw(Graphics* graphics)
gcn::ListModel *const model = mPopup->getListModel();
if (model && mPopup->getSelected() >= 0)
{
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
graphics->setColorAll(mForegroundColor, mForegroundColor2);
if (mExtended)
{
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index 693245c2f..bca1f1e12 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -36,7 +36,7 @@
#include "resources/image.h"
-#include "gui/base/font.hpp"
+#include "gui/font.h"
#include "debug.h"
@@ -116,7 +116,7 @@ void DropShortcutContainer::draw(Graphics *graphics)
return;
}
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
for (unsigned i = 0; i < mMaxItems; i++)
{
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 38c76060b..f5d1c19f0 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -27,14 +27,13 @@
#include "input/inputmanager.h"
+#include "gui/font.h"
#include "gui/viewport.h"
#include "gui/popups/textpopup.h"
#include "resources/image.h"
-#include "gui/base/font.hpp"
-
#include "debug.h"
static const int MAX_ITEMS = 48;
@@ -112,7 +111,7 @@ void EmoteShortcutContainer::draw(Graphics *graphics)
mAlpha = client->getGuiAlpha();
}
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
drawBackground(graphics);
graphics->setColorAll(mForegroundColor, mForegroundColor2);
diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp
index f06e89e55..1fcbabd2b 100644
--- a/src/gui/widgets/extendedlistbox.cpp
+++ b/src/gui/widgets/extendedlistbox.cpp
@@ -22,7 +22,8 @@
#include "gui/widgets/extendedlistmodel.h"
-#include "gui/base/font.hpp"
+#include "gui/font.h"
+
#include "gui/base/listmodel.hpp"
#include "render/graphics.h"
@@ -58,7 +59,7 @@ void ExtendedListBox::draw(Graphics *graphics)
mListModel);
updateAlpha();
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
const int height = mRowHeight;
const int pad2 = 2 + mPadding;
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 4608534b1..b0f887fa2 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -46,7 +46,7 @@
#include "resources/image.h"
-#include "gui/base/font.hpp"
+#include "gui/font.h"
#include "listeners/selectionlistener.h"
#include <algorithm>
@@ -251,7 +251,7 @@ void ItemContainer::draw(Graphics *graphics)
return;
BLOCK_START("ItemContainer::draw")
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
for (int j = 0; j < mGridRows; j++)
{
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 984803a99..2496beaa6 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -33,6 +33,7 @@
#include "input/inputmanager.h"
+#include "gui/font.h"
#include "gui/viewport.h"
#include "gui/popups/itempopup.h"
@@ -45,8 +46,6 @@
#include "resources/image.h"
-#include "gui/base/font.hpp"
-
#include "debug.h"
ItemShortcutContainer::ItemShortcutContainer(const unsigned number) :
@@ -129,7 +128,7 @@ void ItemShortcutContainer::draw(Graphics *graphics)
mAlpha = client->getGuiAlpha();
}
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
drawBackground(graphics);
const Inventory *const inv = PlayerInfo::getInventory();
diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp
index b2b709052..6cc94cc3d 100644
--- a/src/gui/widgets/label.cpp
+++ b/src/gui/widgets/label.cpp
@@ -21,7 +21,7 @@
#include "gui/widgets/label.h"
-#include "gui/base/font.hpp"
+#include "gui/font.h"
#include "debug.h"
@@ -82,7 +82,7 @@ void Label::draw(Graphics* graphics)
int textX;
const gcn::Rectangle &rect = mDimension;
const int textY = rect.height / 2 - getFont()->getHeight() / 2;
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
switch (mAlignment)
{
@@ -108,7 +108,7 @@ void Label::draw(Graphics* graphics)
void Label::adjustSize()
{
- const gcn::Font *const font = getFont();
+ const Font *const font = getFont();
const int pad2 = 2 * mPadding;
setWidth(font->getWidth(mCaption) + pad2);
setHeight(font->getHeight() + pad2);
@@ -129,7 +129,7 @@ void Label::setForegroundColorAll(const gcn::Color &color1,
void Label::resizeTo(const int maxSize, const int minSize)
{
- const gcn::Font *const font = getFont();
+ const Font *const font = getFont();
const int pad2 = 2 * mPadding;
setHeight(font->getHeight() + pad2);
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index 52ff775be..537c7283c 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -28,10 +28,10 @@
#include "input/keydata.h"
+#include "gui/font.h"
#include "gui/gui.h"
#include "gui/base/focushandler.hpp"
-#include "gui/base/font.hpp"
#include "gui/base/listmodel.hpp"
#include "render/graphics.h"
@@ -70,7 +70,7 @@ ListBox::ListBox(const Widget2 *const widget,
mItemPadding = mSkin->getOption("itemPadding");
}
- const gcn::Font *const font = getFont();
+ const Font *const font = getFont();
if (font)
mRowHeight = font->getHeight() + 2 * mItemPadding;
else
@@ -110,7 +110,7 @@ void ListBox::draw(Graphics *graphics)
mHighlightColor.a = static_cast<int>(mAlpha * 255.0F);
graphics->setColor(mHighlightColor);
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
const int rowHeight = getRowHeight();
const int width = mDimension.width;
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index b120e4289..a1f597da8 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -25,10 +25,8 @@
#include "client.h"
#include "graphicsvertexes.h"
+#include "gui/font.h"
#include "gui/gui.h"
-#include "gui/sdlfont.h"
-
-#include "gui/base/font.hpp"
#include "debug.h"
@@ -271,7 +269,7 @@ void ProgressBar::render(Graphics *graphics)
{
const gcn::Color oldColor = graphics->getColor();
- gcn::Font *const font = gui->getFont();
+ Font *const font = gui->getFont();
const int textX = mDimension.width / 2;
const int textY = (mDimension.height - font->getHeight()) / 2;
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index 2fec7a9f6..984d84d76 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -30,7 +30,7 @@
#include "resources/image.h"
-#include "gui/base/font.hpp"
+#include "gui/font.h"
#include "debug.h"
@@ -161,7 +161,7 @@ void RadioButton::draw(Graphics* graphics)
BLOCK_START("RadioButton::draw")
drawBox(graphics);
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
graphics->setColorAll(mForegroundColor, mForegroundColor2);
font->drawString(graphics, mCaption, mPadding + mImageSize + mSpacing,
mPadding);
@@ -191,7 +191,7 @@ void RadioButton::keyPressed(KeyEvent& keyEvent)
void RadioButton::adjustSize()
{
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
setHeight(font->getHeight() + 2 * mPadding);
setWidth(mImagePadding + mImageSize + mSpacing
+ font->getWidth(mCaption) + mPadding);
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index 8b6cca5a7..aeeb8e4bc 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -24,7 +24,7 @@
#include "main.h"
#include "soundmanager.h"
-#include "gui/sdlfont.h"
+#include "gui/font.h"
#include "gui/windows/editdialog.h"
@@ -41,8 +41,6 @@
#include "utils/gettext.h"
#include "utils/mathutils.h"
-#include "gui/base/font.hpp"
-
#include "debug.h"
SetupItem::SetupItem(const std::string &restrict text,
@@ -918,7 +916,7 @@ int SetupItemSlider2::getMaxWidth()
int maxWidth = 0;
SetupItemNamesConstIter it = mValues->begin();
const SetupItemNamesConstIter it_end = mValues->end();
- const gcn::Font *const font = gui->getFont();
+ const Font *const font = gui->getFont();
while (it != it_end)
{
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index f364aaf46..85ff90261 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -27,6 +27,7 @@
#include "being/playerinfo.h"
+#include "gui/font.h"
#include "gui/viewport.h"
#include "gui/popups/itempopup.h"
@@ -35,7 +36,6 @@
#include "resources/image.h"
-#include "gui/base/font.hpp"
#include "gui/base/listmodel.hpp"
#include "debug.h"
@@ -95,7 +95,7 @@ void ShopListBox::draw(Graphics *graphics)
mAlpha = client->getGuiAlpha();
const int alpha = static_cast<int>(mAlpha * 255.0F);
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
const int sz = mListModel->getNumberOfElements();
const int fontHeigh = getFont()->getHeight();
diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp
index 988db85dd..93a6934ba 100644
--- a/src/gui/widgets/sliderlist.cpp
+++ b/src/gui/widgets/sliderlist.cpp
@@ -20,13 +20,12 @@
#include "gui/widgets/sliderlist.h"
+#include "gui/font.h"
#include "gui/gui.h"
#include "gui/widgets/button.h"
#include "gui/widgets/label.h"
-#include "gui/base/font.hpp"
-
#include "debug.h"
static const int buttonWidth = 27;
@@ -209,7 +208,7 @@ int SliderList::getMaxLabelWidth() const
return 1;
int maxWidth = 0;
- const gcn::Font *const font = getFont();
+ const Font *const font = getFont();
const int num = mListModel->getNumberOfElements();
for (int f = 0; f < num; f ++)
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index 511360b91..e8d34c9d8 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -27,6 +27,7 @@
#include "itemshortcut.h"
#include "spellshortcut.h"
+#include "gui/font.h"
#include "gui/viewport.h"
#include "gui/popups/spellpopup.h"
@@ -36,8 +37,6 @@
#include "resources/image.h"
-#include "gui/base/font.hpp"
-
#include "debug.h"
SpellShortcutContainer::SpellShortcutContainer(const unsigned number) :
@@ -103,7 +102,7 @@ void SpellShortcutContainer::draw(Graphics *graphics)
mBackgroundImg->setAlpha(mAlpha);
}
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
const int selectedId = spellShortcut->getSelectedItem();
graphics->setColorAll(mForegroundColor, mForegroundColor2);
diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp
index 1a2bdfeae..d29c56c85 100644
--- a/src/gui/widgets/tabs/setup_colors.cpp
+++ b/src/gui/widgets/tabs/setup_colors.cpp
@@ -21,7 +21,7 @@
#include "gui/widgets/tabs/setup_colors.h"
-#include "gui/sdlfont.h"
+#include "gui/font.h"
#include "gui/userpalette.h"
#include "gui/widgets/browserbox.h"
@@ -101,7 +101,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) :
// TRANSLATORS: color type
std::string longText = _("Static");
- const gcn::Font *const font = getFont();
+ const Font *const font = getFont();
if (getFont()->getWidth(_("Pulse")) > font->getWidth(longText))
{
// TRANSLATORS: color type
diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp
index ba02eb5a2..22bea9a75 100644
--- a/src/gui/widgets/tabs/setup_input.cpp
+++ b/src/gui/widgets/tabs/setup_input.cpp
@@ -125,7 +125,7 @@ Setup_Input::Setup_Input(const Widget2 *const widget) :
mKeyListModel->setSize(mActionDataSize[0]);
refreshKeys();
if (gui)
- mKeyList->setFont(reinterpret_cast<gcn::Font*>(gui->getHelpFont()));
+ mKeyList->setFont(gui->getHelpFont());
mKeyList->addActionListener(this);
mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp
index a85b7927b..a097d28e2 100644
--- a/src/gui/widgets/tabs/tab.cpp
+++ b/src/gui/widgets/tabs/tab.cpp
@@ -264,7 +264,7 @@ void Tab::widgetMoved(const Event &event A_UNUSED)
mRedraw = true;
}
-void Tab::setLabelFont(gcn::Font *const font)
+void Tab::setLabelFont(Font *const font)
{
if (!mLabel)
return;
diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h
index d22c6bea5..655fba7ea 100644
--- a/src/gui/widgets/tabs/tab.h
+++ b/src/gui/widgets/tabs/tab.h
@@ -134,7 +134,7 @@ class Tab : public gcn::BasicContainer,
void widgetMoved(const Event &event) override final;
- void setLabelFont(gcn::Font *const font);
+ void setLabelFont(Font *const font);
Label *getLabel() const A_WARN_UNUSED
{ return mLabel; }
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index ecdc0e4d0..5f74fa1f8 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -26,7 +26,7 @@
#include "input/keydata.h"
-#include "gui/base/font.hpp"
+#include "gui/font.h"
#include <sstream>
@@ -88,7 +88,7 @@ void TextBox::setTextWrapped(const std::string &text, const int minDimension)
text.substr(lastNewlinePos, newlinePos - lastNewlinePos);
size_t lastSpacePos = 0;
xpos = 0;
- const gcn::Font *const font = getFont();
+ const Font *const font = getFont();
const int spaceWidth = font->getWidth(" ");
size_t sz = line.size();
@@ -360,7 +360,7 @@ void TextBox::draw(Graphics* graphics)
graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight()));
}
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
if (isFocused() && isEditable())
{
drawCaret(graphics, font->getWidth(
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 0d01df51d..4dd2f1c7b 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -28,8 +28,8 @@
#include "events/keyevent.h"
+#include "gui/font.h"
#include "gui/sdlinput.h"
-
#include "gui/viewport.h"
#include "gui/popups/popupmenu.h"
@@ -39,8 +39,6 @@
#include "utils/copynpaste.h"
#include "utils/timer.h"
-#include "gui/base/font.hpp"
-
#undef DELETE // Win32 compatibility hack
#include "debug.h"
@@ -142,7 +140,7 @@ void TextField::draw(Graphics *graphics)
BLOCK_START("TextField::draw")
updateAlpha();
- gcn::Font *const font = getFont();
+ Font *const font = getFont();
if (isFocused())
{
drawCaret(graphics,
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index 5ef553b3c..2caf2e44c 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -24,8 +24,8 @@
#include "client.h"
+#include "gui/font.h"
#include "gui/gui.h"
-#include "gui/sdlfont.h"
#include "debug.h"
@@ -100,12 +100,11 @@ void TextPreview::draw(Graphics* graphics)
if (mTextBGColor)
{
- const SDLFont *const font = dynamic_cast<SDLFont*>(mFont);
- if (font)
+ if (mFont)
{
- const int x = font->getWidth(mText) + 1
+ const int x = mFont->getWidth(mText) + 1
+ 2 * ((mOutline || mShadow) ? 1 :0);
- const int y = font->getHeight() + 1
+ const int y = mFont->getHeight() + 1
+ 2 * ((mOutline || mShadow) ? 1 : 0);
graphics->setColor(gcn::Color(static_cast<int>(mTextBGColor->r),
static_cast<int>(mTextBGColor->g),
diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h
index f529e470c..cb524a974 100644
--- a/src/gui/widgets/textpreview.h
+++ b/src/gui/widgets/textpreview.h
@@ -78,7 +78,7 @@ class TextPreview final : public gcn::Widget,
*
* @param font the font to use.
*/
- inline void setFont(gcn::Font *const font)
+ inline void setFont(Font *const font)
{ mFont = font; }
/**
@@ -123,7 +123,7 @@ class TextPreview final : public gcn::Widget,
void adjustSize();
private:
- gcn::Font *mFont;
+ Font *mFont;
std::string mText;
const gcn::Color *mTextColor;
const gcn::Color *mTextColor2;
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index c250e79a1..e2f24a0f2 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -29,6 +29,7 @@
#include "soundconsts.h"
#include "soundmanager.h"
+#include "gui/font.h"
#include "gui/gui.h"
#include "gui/viewport.h"
@@ -38,7 +39,6 @@
#include "resources/image.h"
#include "gui/base/focushandler.hpp"
-#include "gui/base/font.hpp"
#include "debug.h"
@@ -110,7 +110,7 @@ Window::Window(const std::string &caption, const bool modal,
{
setPadding(mSkin->getPadding());
if (getOptionBool("titlebarBold"))
- mCaptionFont = reinterpret_cast<gcn::Font*>(boldFont);
+ mCaptionFont = boldFont;
mTitlePadding = mSkin->getTitlePadding();
mGripPadding = getOption("resizePadding");
mCaptionOffsetX = getOption("captionoffsetx");
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index a5b6be83c..c6b2ca2cb 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -412,7 +412,7 @@ class Window : public gcn::Window,
bool isResizeAllowed(const MouseEvent &event) const A_WARN_UNUSED;
- void setCaptionFont(gcn::Font *font)
+ void setCaptionFont(Font *font)
{ mCaptionFont = font; }
void enableVisibleSound(bool b)
@@ -506,7 +506,7 @@ class Window : public gcn::Window,
int mGripPadding;
int mResizeHandles;
int mOldResizeHandles;
- gcn::Font *mCaptionFont;
+ Font *mCaptionFont;
bool mShowTitle; /**< Window has a title bar */
bool mModal; /**< Window is modal */
bool mCloseWindowButton; /**< Window has a close button */