summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-14 18:50:27 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-14 18:50:27 +0300
commit066488a6f4d086b57f4fe32e8799c207552cccb7 (patch)
tree2c73d80030ff0da73fc5f5b4b664a34030a51633 /src
parent0b3aafe2859d9ea1c4009eed8a87f69c41cbc14b (diff)
downloadplus-066488a6f4d086b57f4fe32e8799c207552cccb7.tar.gz
plus-066488a6f4d086b57f4fe32e8799c207552cccb7.tar.bz2
plus-066488a6f4d086b57f4fe32e8799c207552cccb7.tar.xz
plus-066488a6f4d086b57f4fe32e8799c207552cccb7.zip
Add theming to labels.
New theme file: label.xml Parameters: padding
Diffstat (limited to 'src')
-rw-r--r--src/gui/buydialog.h8
-rw-r--r--src/gui/changeemaildialog.cpp4
-rw-r--r--src/gui/changepassworddialog.cpp2
-rw-r--r--src/gui/charcreatedialog.h22
-rw-r--r--src/gui/charselectdialog.h6
-rw-r--r--src/gui/connectiondialog.cpp2
-rw-r--r--src/gui/itempopup.h4
-rw-r--r--src/gui/killstats.h18
-rw-r--r--src/gui/logindialog.cpp8
-rw-r--r--src/gui/logindialog.h6
-rw-r--r--src/gui/npcpostdialog.cpp2
-rw-r--r--src/gui/registerdialog.cpp8
-rw-r--r--src/gui/selldialog.h6
-rw-r--r--src/gui/setup_colors.h14
-rw-r--r--src/gui/setup_joystick.h4
-rw-r--r--src/gui/setup_relations.cpp2
-rw-r--r--src/gui/setup_theme.h22
-rw-r--r--src/gui/setup_video.h10
-rw-r--r--src/gui/shopwindow.h6
-rw-r--r--src/gui/speechbubble.h8
-rw-r--r--src/gui/spellpopup.h10
-rw-r--r--src/gui/statuspopup.cpp4
-rw-r--r--src/gui/statuspopup.h35
-rw-r--r--src/gui/statuswindow.h20
-rw-r--r--src/gui/textdialog.cpp2
-rw-r--r--src/gui/textpopup.h12
-rw-r--r--src/gui/tradewindow.cpp2
-rw-r--r--src/gui/tradewindow.h4
-rw-r--r--src/gui/unregisterdialog.cpp4
-rw-r--r--src/gui/updaterwindow.h8
-rw-r--r--src/gui/widgets/desktop.h8
-rw-r--r--src/gui/widgets/label.cpp69
-rw-r--r--src/gui/widgets/label.h15
-rw-r--r--src/guichan/widgets/label.cpp23
34 files changed, 205 insertions, 173 deletions
diff --git a/src/gui/buydialog.h b/src/gui/buydialog.h
index 352f2a7ff..04d4205d7 100644
--- a/src/gui/buydialog.h
+++ b/src/gui/buydialog.h
@@ -31,12 +31,12 @@
class ShopItems;
class ShopListBox;
class IntTextField;
+class Label;
class ListBox;
namespace gcn
{
class Button;
- class Label;
class ScrollArea;
class Slider;
}
@@ -136,10 +136,10 @@ class BuyDialog final : public Window, public gcn::ActionListener,
gcn::Button *mDecreaseButton;
ShopListBox *mShopItemList;
gcn::ScrollArea *mScrollArea;
- gcn::Label *mMoneyLabel;
- gcn::Label *mQuantityLabel;
+ Label *mMoneyLabel;
+ Label *mQuantityLabel;
gcn::Slider *mSlider;
- gcn::Label *mAmountLabel;
+ Label *mAmountLabel;
IntTextField *mAmountField;
ShopItems *mShopItems;
diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp
index 3f208cc8f..7f85ab80c 100644
--- a/src/gui/changeemaildialog.cpp
+++ b/src/gui/changeemaildialog.cpp
@@ -54,9 +54,9 @@ ChangeEmailDialog::ChangeEmailDialog(LoginData *const data):
mWrongDataNoticeListener(new WrongDataNoticeListener),
mLoginData(data)
{
- gcn::Label *const accountLabel = new Label(strprintf(_("Account: %s"),
+ Label *const accountLabel = new Label(strprintf(_("Account: %s"),
mLoginData->username.c_str()));
- gcn::Label *const newEmailLabel = new Label(
+ Label *const newEmailLabel = new Label(
_("Type new email address twice:"));
const int width = 200;
diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp
index be5bdb7c4..d63626fe3 100644
--- a/src/gui/changepassworddialog.cpp
+++ b/src/gui/changepassworddialog.cpp
@@ -56,7 +56,7 @@ ChangePasswordDialog::ChangePasswordDialog(LoginData *const data):
mWrongDataNoticeListener(new WrongDataNoticeListener),
mLoginData(data)
{
- gcn::Label *const accountLabel = new Label(
+ Label *const accountLabel = new Label(
strprintf(_("Account: %s"), mLoginData->username.c_str()));
place(0, 0, accountLabel, 3);
diff --git a/src/gui/charcreatedialog.h b/src/gui/charcreatedialog.h
index 256b49465..b7257dd44 100644
--- a/src/gui/charcreatedialog.h
+++ b/src/gui/charcreatedialog.h
@@ -30,13 +30,13 @@
#include <guichan/actionlistener.hpp>
#include <guichan/keylistener.hpp>
+class Label;
class LocalPlayer;
class PlayerBox;
class TextField;
namespace gcn
{
- class Label;
class RadioButton;
class Slider;
}
@@ -105,19 +105,19 @@ class CharCreateDialog final : public Window,
CharSelectDialog *mCharSelectDialog;
TextField *mNameField;
- gcn::Label *mNameLabel;
+ Label *mNameLabel;
gcn::Button *mNextHairColorButton;
gcn::Button *mPrevHairColorButton;
- gcn::Label *mHairColorLabel;
- gcn::Label *mHairColorNameLabel;
+ Label *mHairColorLabel;
+ Label *mHairColorNameLabel;
gcn::Button *mNextHairStyleButton;
gcn::Button *mPrevHairStyleButton;
- gcn::Label *mHairStyleLabel;
- gcn::Label *mHairStyleNameLabel;
+ Label *mHairStyleLabel;
+ Label *mHairStyleNameLabel;
gcn::Button *mNextRaceButton;
gcn::Button *mPrevRaceButton;
- gcn::Label *mRaceLabel;
- gcn::Label *mRaceNameLabel;
+ Label *mRaceLabel;
+ Label *mRaceNameLabel;
gcn::Button *mActionButton;
gcn::Button *mRotateButton;
@@ -127,9 +127,9 @@ class CharCreateDialog final : public Window,
gcn::RadioButton *mOther;
std::vector<gcn::Slider*> mAttributeSlider;
- std::vector<gcn::Label*> mAttributeLabel;
- std::vector<gcn::Label*> mAttributeValue;
- gcn::Label *mAttributesLeft;
+ std::vector<Label*> mAttributeLabel;
+ std::vector<Label*> mAttributeValue;
+ Label *mAttributesLeft;
int mMaxPoints;
int mUsedPoints;
diff --git a/src/gui/charselectdialog.h b/src/gui/charselectdialog.h
index 91cfa7e43..f12084dc5 100644
--- a/src/gui/charselectdialog.h
+++ b/src/gui/charselectdialog.h
@@ -34,6 +34,7 @@
#include <guichan/keylistener.hpp>
class CharacterDisplay;
+class Label;
class LocalPlayer;
class LoginData;
class PlayerBox;
@@ -42,7 +43,6 @@ class TextDialog;
namespace gcn
{
class Button;
- class Label;
}
namespace Net
@@ -114,8 +114,8 @@ class CharSelectDialog final : public Window,
LoginData *mLoginData;
- gcn::Label *mAccountNameLabel;
- gcn::Label *mLastLoginLabel;
+ Label *mAccountNameLabel;
+ Label *mLastLoginLabel;
gcn::Button *mSwitchLoginButton;
gcn::Button *mChangePasswordButton;
diff --git a/src/gui/connectiondialog.cpp b/src/gui/connectiondialog.cpp
index 9e4163839..9a5beb725 100644
--- a/src/gui/connectiondialog.cpp
+++ b/src/gui/connectiondialog.cpp
@@ -44,7 +44,7 @@ ConnectionDialog::ConnectionDialog(const std::string &text,
setMinWidth(0);
ProgressIndicator *const progressIndicator = new ProgressIndicator;
- gcn::Label *const label = new Label(text);
+ Label *const label = new Label(text);
Button *const cancelButton = new Button(_("Cancel"), "cancelButton", this);
place(0, 0, progressIndicator);
diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h
index bb33832c1..4d2d2468d 100644
--- a/src/gui/itempopup.h
+++ b/src/gui/itempopup.h
@@ -31,13 +31,13 @@
#include <guichan/mouselistener.hpp>
class Icon;
+class Label;
class TextBox;
namespace gcn
{
class Button;
class CheckBox;
- class Label;
class ScrollArea;
}
@@ -70,7 +70,7 @@ class ItemPopup final : public Popup
void mouseMoved(gcn::MouseEvent &mouseEvent) override;
private:
- gcn::Label *mItemName;
+ Label *mItemName;
TextBox *mItemDesc;
TextBox *mItemEffect;
TextBox *mItemWeight;
diff --git a/src/gui/killstats.h b/src/gui/killstats.h
index 165178921..f0fbab9ab 100644
--- a/src/gui/killstats.h
+++ b/src/gui/killstats.h
@@ -108,15 +108,15 @@ class KillStats final : public Window,
Label *mLine6;
Label *mLine7;
- gcn::Label *mExpSpeed1Label;
- gcn::Label *mExpTime1Label;
- gcn::Label *mExpSpeed5Label;
- gcn::Label *mExpTime5Label;
- gcn::Label *mExpSpeed15Label;
- gcn::Label *mExpTime15Label;
-
- gcn::Label *mLastKillExpLabel;
- gcn::Label *mTimeBeforeJackoLabel;
+ Label *mExpSpeed1Label;
+ Label *mExpTime1Label;
+ Label *mExpSpeed5Label;
+ Label *mExpTime5Label;
+ Label *mExpSpeed15Label;
+ Label *mExpTime15Label;
+
+ Label *mLastKillExpLabel;
+ Label *mTimeBeforeJackoLabel;
int m1minExpTime;
int m1minExpNum;
diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp
index cbdc657bb..f155d7293 100644
--- a/src/gui/logindialog.cpp
+++ b/src/gui/logindialog.cpp
@@ -139,11 +139,11 @@ LoginDialog::LoginDialog(LoginData *const data, std::string serverName,
mUpdateHost(updateHost),
mServerName(serverName)
{
- gcn::Label *const serverLabel1 = new Label(_("Server:"));
- gcn::Label *const serverLabel2 = new Label(serverName);
+ Label *const serverLabel1 = new Label(_("Server:"));
+ Label *const serverLabel2 = new Label(serverName);
serverLabel2->adjustSize();
- gcn::Label *const userLabel = new Label(_("Name:"));
- gcn::Label *const passLabel = new Label(_("Password:"));
+ Label *const userLabel = new Label(_("Name:"));
+ Label *const passLabel = new Label(_("Password:"));
if (mLoginData && mLoginData->updateHosts.size() > 1)
{
mUpdateHostLabel = new Label(strprintf(_("Update host: %s"),
diff --git a/src/gui/logindialog.h b/src/gui/logindialog.h
index 0b8584d71..190a50f65 100644
--- a/src/gui/logindialog.h
+++ b/src/gui/logindialog.h
@@ -33,6 +33,7 @@
#include <vector>
class DropDown;
+class Label;
class LoginData;
class UpdateListModel;
class UpdateTypeModel;
@@ -41,7 +42,6 @@ namespace gcn
{
class Button;
class CheckBox;
- class Label;
class TextField;
}
@@ -91,8 +91,8 @@ class LoginDialog final : public Window, public gcn::ActionListener,
gcn::TextField *mUserField;
gcn::TextField *mPassField;
gcn::CheckBox *mKeepCheck;
- gcn::Label *mUpdateTypeLabel;
- gcn::Label *mUpdateHostLabel;
+ Label *mUpdateTypeLabel;
+ Label *mUpdateHostLabel;
UpdateTypeModel *mUpdateTypeModel;
DropDown *mUpdateTypeDropDown;
gcn::Button *mServerButton;
diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp
index 846788204..304467f20 100644
--- a/src/gui/npcpostdialog.cpp
+++ b/src/gui/npcpostdialog.cpp
@@ -48,7 +48,7 @@ NpcPostDialog::NpcPostDialog(const int npcId):
setContentSize(400, 180);
// create text field for receiver
- gcn::Label *const senderText = new Label(_("To:"));
+ Label *const senderText = new Label(_("To:"));
senderText->setPosition(5, 5);
mSender->setPosition(senderText->getWidth() + 5, 5);
mSender->setWidth(65);
diff --git a/src/gui/registerdialog.cpp b/src/gui/registerdialog.cpp
index 7beec0abc..8edc8fd80 100644
--- a/src/gui/registerdialog.cpp
+++ b/src/gui/registerdialog.cpp
@@ -79,9 +79,9 @@ RegisterDialog::RegisterDialog(LoginData *const data):
{
int optionalActions = Net::getLoginHandler()->supportedOptionalActions();
- gcn::Label *const userLabel = new Label(_("Name:"));
- gcn::Label *const passwordLabel = new Label(_("Password:"));
- gcn::Label *const confirmLabel = new Label(_("Confirm:"));
+ Label *const userLabel = new Label(_("Name:"));
+ Label *const passwordLabel = new Label(_("Password:"));
+ Label *const confirmLabel = new Label(_("Confirm:"));
ContainerPlacer placer;
placer = getPlacer(0, 0);
@@ -117,7 +117,7 @@ RegisterDialog::RegisterDialog(LoginData *const data):
if (optionalActions & Net::LoginHandler::SetEmailOnRegister)
{
- gcn::Label *const emailLabel = new Label(_("Email:"));
+ Label *const emailLabel = new Label(_("Email:"));
mEmailField = new TextField;
placer(0, row, emailLabel);
placer(1, row, mEmailField, 3).setPadding(2);
diff --git a/src/gui/selldialog.h b/src/gui/selldialog.h
index 2edfd07cc..d77ad689c 100644
--- a/src/gui/selldialog.h
+++ b/src/gui/selldialog.h
@@ -31,13 +31,13 @@
#include <SDL_types.h>
class Item;
+class Label;
class ShopItems;
class ShopListBox;
namespace gcn
{
class Button;
- class Label;
class ScrollArea;
class Slider;
}
@@ -137,8 +137,8 @@ class SellDialog final : public Window,
gcn::Button *mDecreaseButton;
ShopListBox *mShopItemList;
gcn::ScrollArea *mScrollArea;
- gcn::Label *mMoneyLabel;
- gcn::Label *mQuantityLabel;
+ Label *mMoneyLabel;
+ Label *mQuantityLabel;
gcn::Slider *mSlider;
ShopItems *mShopItems;
diff --git a/src/gui/setup_colors.h b/src/gui/setup_colors.h
index 2f92bfc8f..3f7be10b9 100644
--- a/src/gui/setup_colors.h
+++ b/src/gui/setup_colors.h
@@ -30,12 +30,12 @@
#include <string>
class BrowserBox;
+class Label;
class TextField;
class TextPreview;
namespace gcn
{
- class Label;
class ListBox;
class ScrollArea;
class Slider;
@@ -69,25 +69,25 @@ class Setup_Colors final : public SetupTab,
gcn::ScrollArea *mPreviewBox;
int mSelected;
- gcn::Label *mGradTypeLabel;
+ Label *mGradTypeLabel;
gcn::Slider *mGradTypeSlider;
- gcn::Label *mGradTypeText;
+ Label *mGradTypeText;
- gcn::Label *mGradDelayLabel;
+ Label *mGradDelayLabel;
gcn::Slider *mGradDelaySlider;
TextField *mGradDelayText;
- gcn::Label *mRedLabel;
+ Label *mRedLabel;
gcn::Slider *mRedSlider;
TextField *mRedText;
int mRedValue;
- gcn::Label *mGreenLabel;
+ Label *mGreenLabel;
gcn::Slider *mGreenSlider;
TextField *mGreenText;
int mGreenValue;
- gcn::Label *mBlueLabel;
+ Label *mBlueLabel;
gcn::Slider *mBlueSlider;
TextField *mBlueText;
int mBlueValue;
diff --git a/src/gui/setup_joystick.h b/src/gui/setup_joystick.h
index ee63fcff6..cd80d51a0 100644
--- a/src/gui/setup_joystick.h
+++ b/src/gui/setup_joystick.h
@@ -28,13 +28,13 @@
#include <guichan/actionlistener.hpp>
class DropDown;
+class Label;
class NamesModel;
namespace gcn
{
class Button;
class CheckBox;
- class Label;
}
class Setup_Joystick final : public SetupTab
@@ -55,7 +55,7 @@ class Setup_Joystick final : public SetupTab
void setTempEnabled(const bool sel);
private:
- gcn::Label *mCalibrateLabel;
+ Label *mCalibrateLabel;
gcn::Button *mCalibrateButton;
bool mOriginalJoystickEnabled;
gcn::CheckBox *mJoystickEnabled;
diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp
index d4792f610..ed2f995e0 100644
--- a/src/gui/setup_relations.cpp
+++ b/src/gui/setup_relations.cpp
@@ -270,7 +270,7 @@ Setup_Relations::Setup_Relations() :
mPlayerTable->setLinewiseSelection(true);
mPlayerTable->addActionListener(this);
- gcn::Label *const ignore_action_label = new Label(_("When ignoring:"));
+ Label *const ignore_action_label = new Label(_("When ignoring:"));
mIgnoreActionChoicesBox->setActionEventId(ACTION_STRATEGY);
mIgnoreActionChoicesBox->addActionListener(this);
diff --git a/src/gui/setup_theme.h b/src/gui/setup_theme.h
index 1da8ef1a7..1aceda440 100644
--- a/src/gui/setup_theme.h
+++ b/src/gui/setup_theme.h
@@ -31,13 +31,13 @@ class DropDown;
class EditDialog;
class FontsModel;
class FontSizeChoiceListModel;
+class Label;
class LangListModel;
class ThemesModel;
namespace gcn
{
class DropDown;
- class Label;
}
class Setup_Theme final : public SetupTab
@@ -56,49 +56,49 @@ class Setup_Theme final : public SetupTab
void action(const gcn::ActionEvent &event) override;
private:
- gcn::Label *mThemeLabel;
+ Label *mThemeLabel;
ThemesModel *mThemesModel;
DropDown *mThemeDropDown;
std::string mTheme;
FontsModel *mFontsModel;
- gcn::Label *mFontLabel;
+ Label *mFontLabel;
DropDown *mFontDropDown;
std::string mFont;
LangListModel *mLangListModel;
- gcn::Label *mLangLabel;
+ Label *mLangLabel;
DropDown *mLangDropDown;
std::string mLang;
- gcn::Label *mBoldFontLabel;
+ Label *mBoldFontLabel;
DropDown *mBoldFontDropDown;
std::string mBoldFont;
- gcn::Label *mParticleFontLabel;
+ Label *mParticleFontLabel;
DropDown *mParticleFontDropDown;
std::string mParticleFont;
- gcn::Label *mHelpFontLabel;
+ Label *mHelpFontLabel;
DropDown *mHelpFontDropDown;
std::string mHelpFont;
- gcn::Label *mSecureFontLabel;
+ Label *mSecureFontLabel;
DropDown *mSecureFontDropDown;
std::string mSecureFont;
- gcn::Label *mJapanFontLabel;
+ Label *mJapanFontLabel;
DropDown *mJapanFontDropDown;
std::string mJapanFont;
FontSizeChoiceListModel *mFontSizeListModel;
- gcn::Label *mFontSizeLabel;
+ Label *mFontSizeLabel;
int mFontSize;
gcn::DropDown *mFontSizeDropDown;
FontSizeChoiceListModel *mNpcFontSizeListModel;
- gcn::Label *mNpcFontSizeLabel;
+ Label *mNpcFontSizeLabel;
int mNpcFontSize;
gcn::DropDown *mNpcFontSizeDropDown;
diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h
index 6f130c4ae..99c8a2269 100644
--- a/src/gui/setup_video.h
+++ b/src/gui/setup_video.h
@@ -30,6 +30,7 @@
#include <guichan/actionlistener.hpp>
#include <guichan/keylistener.hpp>
+class Label;
class ModeListModel;
class OpenGLListModel;
class TextDialog;
@@ -39,7 +40,6 @@ namespace gcn
class Button;
class CheckBox;
class DropDown;
- class Label;
class ListBox;
class Slider;
}
@@ -74,8 +74,8 @@ class Setup_Video final : public SetupTab, public gcn::KeyListener
OpenGLListModel *mOpenGLListModel;
- gcn::Label *scrollRadiusLabel;
- gcn::Label *scrollLazinessLabel;
+ Label *scrollRadiusLabel;
+ Label *scrollLazinessLabel;
gcn::ListBox *mModeList;
gcn::CheckBox *mFsCheckBox;
@@ -87,9 +87,9 @@ class Setup_Video final : public SetupTab, public gcn::KeyListener
gcn::CheckBox *mFpsCheckBox;
gcn::Slider *mFpsSlider;
- gcn::Label *mFpsLabel;
+ Label *mFpsLabel;
gcn::Slider *mAltFpsSlider;
- gcn::Label *mAltFpsLabel;
+ Label *mAltFpsLabel;
gcn::Button *mDetectButton;
TextDialog *mDialog;
diff --git a/src/gui/shopwindow.h b/src/gui/shopwindow.h
index 06787795a..7474a1be2 100644
--- a/src/gui/shopwindow.h
+++ b/src/gui/shopwindow.h
@@ -30,6 +30,7 @@
class CheckBox;
class Item;
+class Label;
class ListBox;
class ShopItem;
class ShopItems;
@@ -39,7 +40,6 @@ namespace gcn
{
class Button;
class CheckBox;
- class Label;
class ScrollArea;
}
@@ -154,8 +154,8 @@ class ShopWindow final : public Window, public gcn::ActionListener,
ShopListBox *mSellShopItemList;
gcn::ScrollArea *mBuyScrollArea;
gcn::ScrollArea *mSellScrollArea;
- gcn::Label *mBuyLabel;
- gcn::Label *mSellLabel;
+ Label *mBuyLabel;
+ Label *mSellLabel;
gcn::Button *mBuyAddButton;
gcn::Button *mBuyDeleteButton;
gcn::Button *mBuyAnnounceButton;
diff --git a/src/gui/speechbubble.h b/src/gui/speechbubble.h
index 246ea8bd8..428210f85 100644
--- a/src/gui/speechbubble.h
+++ b/src/gui/speechbubble.h
@@ -28,13 +28,9 @@
#include "gui/widgets/popup.h"
+class Label;
class TextBox;
-namespace gcn
-{
- class Label;
-}
-
class SpeechBubble final : public Popup
{
public:
@@ -59,7 +55,7 @@ class SpeechBubble final : public Popup
private:
std::string mText;
- gcn::Label *mCaption;
+ Label *mCaption;
TextBox *mSpeechBox;
};
diff --git a/src/gui/spellpopup.h b/src/gui/spellpopup.h
index 51e43d0d5..7e11ba53a 100644
--- a/src/gui/spellpopup.h
+++ b/src/gui/spellpopup.h
@@ -30,13 +30,9 @@
#include <guichan/mouselistener.hpp>
+class Label;
class TextBox;
-namespace gcn
-{
- class Label;
-}
-
/**
* A popup that displays information about an item.
*/
@@ -68,9 +64,9 @@ class SpellPopup final : public Popup
void mouseMoved(gcn::MouseEvent &mouseEvent) override;
private:
- gcn::Label *mItemName;
+ Label *mItemName;
- gcn::Label *mItemComment;
+ Label *mItemComment;
};
#endif // SPELLPOPUP_H
diff --git a/src/gui/statuspopup.cpp b/src/gui/statuspopup.cpp
index 0f523aa31..55f9b59d6 100644
--- a/src/gui/statuspopup.cpp
+++ b/src/gui/statuspopup.cpp
@@ -179,14 +179,14 @@ void StatusPopup::view(const int x, const int y)
requestMoveToTop();
}
-void StatusPopup::setLabelText(gcn::Label *const label, const char *const text,
+void StatusPopup::setLabelText(Label *const label, const char *const text,
int const key) const
{
label->setCaption(strprintf("%s %s", text,
inputManager.getKeyValueString(key).c_str()));
}
-void StatusPopup::setLabelText2(gcn::Label *const label,
+void StatusPopup::setLabelText2(Label *const label,
const std::string &text,
const Input::KeyAction key) const
{
diff --git a/src/gui/statuspopup.h b/src/gui/statuspopup.h
index cbccaf98d..c10a0b8ea 100644
--- a/src/gui/statuspopup.h
+++ b/src/gui/statuspopup.h
@@ -32,6 +32,7 @@
#include <guichan/mouselistener.hpp>
+class Label;
class TextBox;
namespace gcn
@@ -67,27 +68,27 @@ class StatusPopup final : public Popup
private:
void updateLabels();
- void setLabelText(gcn::Label *const label, const char *const text,
+ void setLabelText(Label *const label, const char *const text,
const int key) const;
- void setLabelText2(gcn::Label *const label, const std::string &text,
+ void setLabelText2(Label *const label, const std::string &text,
const Input::KeyAction key) const;
- gcn::Label *mMoveType;
- gcn::Label *mCrazyMoveType;
- gcn::Label *mMoveToTargetType;
- gcn::Label *mFollowMode;
- gcn::Label *mAttackType;
- gcn::Label *mAttackWeaponType;
- gcn::Label *mDropCounter;
- gcn::Label *mPickUpType;
- gcn::Label *mMapType;
- gcn::Label *mMagicAttackType;
- gcn::Label *mPvpAttackType;
- gcn::Label *mDisableGameModifiers;
- gcn::Label *mImitationMode;
- gcn::Label *mAwayMode;
- gcn::Label *mCameraMode;
+ Label *mMoveType;
+ Label *mCrazyMoveType;
+ Label *mMoveToTargetType;
+ Label *mFollowMode;
+ Label *mAttackType;
+ Label *mAttackWeaponType;
+ Label *mDropCounter;
+ Label *mPickUpType;
+ Label *mMapType;
+ Label *mMagicAttackType;
+ Label *mPvpAttackType;
+ Label *mDisableGameModifiers;
+ Label *mImitationMode;
+ Label *mAwayMode;
+ Label *mCameraMode;
};
#endif // StatusPopup_H
diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h
index dce48c8fc..8f74951eb 100644
--- a/src/gui/statuswindow.h
+++ b/src/gui/statuswindow.h
@@ -32,6 +32,7 @@
#include <map>
class AttrDisplay;
+class Label;
class ProgressBar;
class ScrollArea;
class VertContainer;
@@ -39,7 +40,6 @@ class VertContainer;
namespace gcn
{
class Button;
- class Label;
}
/**
@@ -98,17 +98,17 @@ class StatusWindow final : public Window,
/**
* Status Part
*/
- gcn::Label *mLvlLabel;
- gcn::Label *mMoneyLabel;
- gcn::Label *mHpLabel;
- gcn::Label *mMpLabel;
- gcn::Label *mXpLabel;
+ Label *mLvlLabel;
+ Label *mMoneyLabel;
+ Label *mHpLabel;
+ Label *mMpLabel;
+ Label *mXpLabel;
ProgressBar *mHpBar;
ProgressBar *mMpBar;
ProgressBar *mXpBar;
- gcn::Label *mJobLvlLabel;
- gcn::Label *mJobLabel;
+ Label *mJobLvlLabel;
+ Label *mJobLabel;
ProgressBar *mJobBar;
VertContainer *mAttrCont;
@@ -116,8 +116,8 @@ class StatusWindow final : public Window,
VertContainer *mDAttrCont;
ScrollArea *mDAttrScroll;
- gcn::Label *mCharacterPointsLabel;
- gcn::Label *mCorrectionPointsLabel;
+ Label *mCharacterPointsLabel;
+ Label *mCorrectionPointsLabel;
gcn::Button *mCopyButton;
typedef std::map<int, AttrDisplay*> Attrs;
diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp
index 96b653d76..7d5b35c85 100644
--- a/src/gui/textdialog.cpp
+++ b/src/gui/textdialog.cpp
@@ -47,7 +47,7 @@ TextDialog::TextDialog(const std::string &title, const std::string &msg,
{
keyboard.setEnabled(false);
- gcn::Label *const textLabel = new Label(msg);
+ Label *const textLabel = new Label(msg);
gcn::Button *const cancelButton = new Button(_("Cancel"), "CANCEL", this);
place(0, 0, textLabel, 4);
diff --git a/src/gui/textpopup.h b/src/gui/textpopup.h
index 7d6893b9f..02cf89d6f 100644
--- a/src/gui/textpopup.h
+++ b/src/gui/textpopup.h
@@ -28,13 +28,9 @@
#include <guichan/mouselistener.hpp>
+class Label;
class TextBox;
-namespace gcn
-{
- class Label;
-}
-
/**
* A popup that displays information about an item.
*/
@@ -78,9 +74,9 @@ class TextPopup final : public Popup
void mouseMoved(gcn::MouseEvent &mouseEvent) override;
private:
- gcn::Label *mText1;
- gcn::Label *mText2;
- gcn::Label *mText3;
+ Label *mText1;
+ Label *mText2;
+ Label *mText3;
};
#endif // TEXTPOPUP_H
diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp
index 054a0237f..437b8bc9f 100644
--- a/src/gui/tradewindow.cpp
+++ b/src/gui/tradewindow.cpp
@@ -112,7 +112,7 @@ TradeWindow::TradeWindow():
true, "trade_background.xml");
partnerScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- gcn::Label *const moneyLabel2 = new Label(_("You give:"));
+ Label *const moneyLabel2 = new Label(_("You give:"));
mMoneyField->setWidth(40);
diff --git a/src/gui/tradewindow.h b/src/gui/tradewindow.h
index 7a48cf9b3..c53afd21e 100644
--- a/src/gui/tradewindow.h
+++ b/src/gui/tradewindow.h
@@ -33,12 +33,12 @@
class Inventory;
class Item;
class ItemContainer;
+class Label;
class ScrollArea;
namespace gcn
{
class Button;
- class Label;
class TextField;
}
@@ -169,7 +169,7 @@ class TradeWindow final : public Window,
ItemContainer *mMyItemContainer;
ItemContainer *mPartnerItemContainer;
- gcn::Label *mMoneyLabel;
+ Label *mMoneyLabel;
gcn::Button *mAddButton;
gcn::Button *mOkButton;
gcn::Button *mMoneyChangeButton;
diff --git a/src/gui/unregisterdialog.cpp b/src/gui/unregisterdialog.cpp
index edceb54e8..300912ca4 100644
--- a/src/gui/unregisterdialog.cpp
+++ b/src/gui/unregisterdialog.cpp
@@ -53,9 +53,9 @@ UnRegisterDialog::UnRegisterDialog(LoginData *const data):
mCancelButton(new Button(_("Cancel"), "cancel", this)),
mWrongDataNoticeListener(new WrongDataNoticeListener)
{
- gcn::Label *const userLabel = new Label(strprintf(_("Name: %s"),
+ Label *const userLabel = new Label(strprintf(_("Name: %s"),
mLoginData->username.c_str()));
- gcn::Label *const passwordLabel = new Label(_("Password:"));
+ Label *const passwordLabel = new Label(_("Password:"));
const int width = 210;
const int height = 80;
diff --git a/src/gui/updaterwindow.h b/src/gui/updaterwindow.h
index 9f7134e6e..111a01f5c 100644
--- a/src/gui/updaterwindow.h
+++ b/src/gui/updaterwindow.h
@@ -38,15 +38,11 @@
class BrowserBox;
class Button;
+class Label;
class ProgressBar;
class ResourceManager;
class ScrollArea;
-namespace gcn
-{
- class Label;
-}
-
struct updateFile final
{
public:
@@ -231,7 +227,7 @@ private:
int mUpdateType;
- gcn::Label *mLabel; /**< Progress bar caption. */
+ Label *mLabel; /**< Progress bar caption. */
Button *mCancelButton; /**< Button to stop the update process. */
Button *mPlayButton; /**< Button to start playing. */
ProgressBar *mProgressBar; /**< Update progress bar. */
diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h
index 0a9759835..2e5eeea24 100644
--- a/src/gui/widgets/desktop.h
+++ b/src/gui/widgets/desktop.h
@@ -27,11 +27,7 @@
#include <guichan/widgetlistener.hpp>
class Image;
-
-namespace gcn
-{
- class Label;
-}
+class Label;
/**
* Desktop widget, for drawing a background image and color.
@@ -68,7 +64,7 @@ class Desktop final : public Container, private gcn::WidgetListener
void setBestFittingWallpaper();
Image *mWallpaper;
- gcn::Label *mVersionLabel;
+ Label *mVersionLabel;
gcn::Color mBackgroundColor;
gcn::Color mBackgroundGrayColor;
};
diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp
index e6f603fb2..188da1bf4 100644
--- a/src/gui/widgets/label.cpp
+++ b/src/gui/widgets/label.cpp
@@ -23,21 +23,80 @@
#include "gui/theme.h"
+#include <guichan/font.hpp>
+
#include "debug.h"
+Skin *Label::mSkin = nullptr;
+int Label::mInstances = 0;
+
Label::Label() :
- gcn::Label()
+ gcn::Label(),
+ mPadding(0)
{
- mForegroundColor = Theme::getThemeColor(Theme::LABEL);
+ init();
}
Label::Label(const std::string &caption) :
- gcn::Label(caption)
+ gcn::Label(caption),
+ mPadding(0)
+{
+ init();
+}
+
+Label::~Label()
+{
+ mInstances --;
+ if (mInstances == 0 && Theme::instance())
+ {
+ Theme::instance()->unload(mSkin);
+ }
+}
+
+void Label::init()
{
mForegroundColor = Theme::getThemeColor(Theme::LABEL);
+ if (mInstances == 0)
+ {
+ if (Theme::instance())
+ mSkin = Theme::instance()->load("label.xml", "");
+ mInstances ++;
+ }
+ if (mSkin)
+ mPadding = mSkin->getPadding();
+ else
+ mPadding = 0;
+}
+
+void Label::draw(gcn::Graphics* graphics)
+{
+ int textX;
+ const int textY = getHeight() / 2 - getFont()->getHeight() / 2;
+
+ switch (getAlignment())
+ {
+ case Graphics::LEFT:
+ default:
+ textX = mPadding;
+ break;
+ case Graphics::CENTER:
+ textX = getWidth() / 2;
+ break;
+ case Graphics::RIGHT:
+ if (getWidth() > mPadding)
+ textX = getWidth() - mPadding;
+ else
+ textX = 0;
+ break;
+ }
+
+ graphics->setFont(getFont());
+ graphics->setColor(mForegroundColor);
+ graphics->drawText(getCaption(), textX, textY, getAlignment());
}
-void Label::draw(gcn::Graphics *graphics)
+void Label::adjustSize()
{
- gcn::Label::draw(graphics);
+ setWidth(getFont()->getWidth(getCaption()) + 2 * mPadding);
+ setHeight(getFont()->getHeight() + 2 * mPadding);
}
diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h
index 046f2ca00..40632109d 100644
--- a/src/gui/widgets/label.h
+++ b/src/gui/widgets/label.h
@@ -24,6 +24,8 @@
#include <guichan/widgets/label.hpp>
+class Skin;
+
/**
* Label widget. Same as the Guichan label but modified to use the palette
* system.
@@ -46,10 +48,23 @@ class Label final : public gcn::Label
A_DELETE_COPY(Label);
+ ~Label();
+
+ void init();
+
/**
* Draws the label.
*/
void draw(gcn::Graphics *graphics) override;
+
+ void adjustSize();
+
+ static Skin *mSkin;
+
+ static int mInstances;
+
+ private:
+ int mPadding;
};
#endif
diff --git a/src/guichan/widgets/label.cpp b/src/guichan/widgets/label.cpp
index cfd62630a..dc88deb69 100644
--- a/src/guichan/widgets/label.cpp
+++ b/src/guichan/widgets/label.cpp
@@ -93,32 +93,9 @@ namespace gcn
void Label::draw(Graphics* graphics)
{
- int textX;
- const int textY = getHeight() / 2 - getFont()->getHeight() / 2;
-
- switch (getAlignment())
- {
- case Graphics::LEFT:
- textX = 0;
- break;
- case Graphics::CENTER:
- textX = getWidth() / 2;
- break;
- case Graphics::RIGHT:
- textX = getWidth();
- break;
- default:
- throw GCN_EXCEPTION("Unknown alignment.");
- }
-
- graphics->setFont(getFont());
- graphics->setColor(mForegroundColor);
- graphics->drawText(getCaption(), textX, textY, getAlignment());
}
void Label::adjustSize()
{
- setWidth(getFont()->getWidth(getCaption()));
- setHeight(getFont()->getHeight());
}
}