summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-20 02:23:16 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-20 13:55:43 +0300
commit0153e8fa499b7bbdd712339bfb3921ead15a37a2 (patch)
tree0e12bc130aa40d3bc41f86e16754f060b450977e
parent4c7a11b639ec94c8a32a9a52e99652c464745037 (diff)
downloadplus-0153e8fa499b7bbdd712339bfb3921ead15a37a2.tar.gz
plus-0153e8fa499b7bbdd712339bfb3921ead15a37a2.tar.bz2
plus-0153e8fa499b7bbdd712339bfb3921ead15a37a2.tar.xz
plus-0153e8fa499b7bbdd712339bfb3921ead15a37a2.zip
Add palette inheritance to label class.
-rw-r--r--src/gui/beingpopup.cpp10
-rw-r--r--src/gui/botcheckerwindow.cpp34
-rw-r--r--src/gui/buydialog.cpp6
-rw-r--r--src/gui/changeemaildialog.cpp4
-rw-r--r--src/gui/changepassworddialog.cpp6
-rw-r--r--src/gui/charcreatedialog.cpp20
-rw-r--r--src/gui/charselectdialog.cpp10
-rw-r--r--src/gui/connectiondialog.cpp2
-rw-r--r--src/gui/debugwindow.cpp46
-rw-r--r--src/gui/editserverdialog.cpp10
-rw-r--r--src/gui/itemamountwindow.cpp2
-rw-r--r--src/gui/itempopup.cpp2
-rw-r--r--src/gui/killstats.cpp30
-rw-r--r--src/gui/logindialog.cpp12
-rw-r--r--src/gui/npcpostdialog.cpp2
-rw-r--r--src/gui/outfitwindow.cpp4
-rw-r--r--src/gui/registerdialog.cpp8
-rw-r--r--src/gui/selldialog.cpp4
-rw-r--r--src/gui/serverdialog.cpp2
-rw-r--r--src/gui/setup.cpp2
-rw-r--r--src/gui/setup_colors.cpp12
-rw-r--r--src/gui/setup_joystick.cpp3
-rw-r--r--src/gui/setup_relations.cpp6
-rw-r--r--src/gui/setup_theme.cpp20
-rw-r--r--src/gui/setup_video.cpp4
-rw-r--r--src/gui/shopwindow.cpp4
-rw-r--r--src/gui/skilldialog.cpp2
-rw-r--r--src/gui/specialswindow.cpp6
-rw-r--r--src/gui/speechbubble.cpp2
-rw-r--r--src/gui/spellpopup.cpp4
-rw-r--r--src/gui/statuspopup.cpp30
-rw-r--r--src/gui/statuswindow.cpp24
-rw-r--r--src/gui/textcommandeditor.cpp18
-rw-r--r--src/gui/textdialog.cpp2
-rw-r--r--src/gui/textpopup.cpp6
-rw-r--r--src/gui/tradewindow.cpp4
-rw-r--r--src/gui/unregisterdialog.cpp4
-rw-r--r--src/gui/updaterwindow.cpp2
-rw-r--r--src/gui/widgets/desktop.cpp4
-rw-r--r--src/gui/widgets/label.cpp6
-rw-r--r--src/gui/widgets/label.h4
-rw-r--r--src/gui/widgets/setupitem.cpp18
-rw-r--r--src/gui/widgets/sliderlist.cpp2
-rw-r--r--src/gui/widgets/tab.cpp2
44 files changed, 205 insertions, 200 deletions
diff --git a/src/gui/beingpopup.cpp b/src/gui/beingpopup.cpp
index bdc7b9c27..5ab7a8c89 100644
--- a/src/gui/beingpopup.cpp
+++ b/src/gui/beingpopup.cpp
@@ -41,11 +41,11 @@
BeingPopup::BeingPopup() :
Popup("BeingPopup", "beingpopup.xml"),
- mBeingName(new Label("A")),
- mBeingParty(new Label("A")),
- mBeingGuild(new Label("A")),
- mBeingRank(new Label("A")),
- mBeingComment(new Label("A"))
+ mBeingName(new Label(this, "A")),
+ mBeingParty(new Label(this, "A")),
+ mBeingGuild(new Label(this, "A")),
+ mBeingRank(new Label(this, "A")),
+ mBeingComment(new Label(this, "A"))
{
// Being Name
mBeingName->setFont(boldFont);
diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp
index 6430a9d37..4f3381dec 100644
--- a/src/gui/botcheckerwindow.cpp
+++ b/src/gui/botcheckerwindow.cpp
@@ -58,11 +58,13 @@ const int TIME_COLUMN_WIDTH = 70;
#define WIDGET_AT(row, column) (((row) * COLUMNS_NR) + column)
-class UsersTableModel final : public TableModel
+class UsersTableModel final : public TableModel,
+ public Widget2
{
public:
- UsersTableModel() :
+ UsersTableModel(const Widget2 *const widget) :
TableModel(),
+ Widget2(widget),
mPlayers(0)
{
playersUpdated();
@@ -130,42 +132,42 @@ public:
const Being *const player = mPlayers.at(r);
std::string name = player->getName();
- gcn::Widget *widget = new Label(name);
+ gcn::Widget *widget = new Label(this, name);
mWidgets.push_back(widget);
if (player->getAttackTime() != 0)
{
- widget = new Label(toString(curTime
+ widget = new Label(this, toString(curTime
- player->getAttackTime()));
}
else
{
- widget = new Label(toString(curTime
+ widget = new Label(this, toString(curTime
- player->getTestTime()) + "?");
}
mWidgets.push_back(widget);
if (player->getTalkTime() != 0)
{
- widget = new Label(toString(curTime
+ widget = new Label(this, toString(curTime
- player->getTalkTime()));
}
else
{
- widget = new Label(toString(curTime
+ widget = new Label(this, toString(curTime
- player->getTestTime()) + "?");
}
mWidgets.push_back(widget);
if (player->getMoveTime() != 0)
{
- widget = new Label(toString(curTime
+ widget = new Label(this, toString(curTime
- player->getMoveTime()));
}
else
{
- widget = new Label(toString(curTime
+ widget = new Label(this, toString(curTime
- player->getTestTime()) + "?");
}
mWidgets.push_back(widget);
@@ -229,7 +231,7 @@ public:
str = "ok";
}
- widget = new Label(str);
+ widget = new Label(this, str);
mWidgets.push_back(widget);
}
@@ -267,7 +269,7 @@ protected:
BotCheckerWindow::BotCheckerWindow():
Window(_("Bot Checker"), false, nullptr, "botchecker.xml"),
gcn::ActionListener(),
- mTableModel(new UsersTableModel()),
+ mTableModel(new UsersTableModel(this)),
mTable(new GuiTable(this, mTableModel)),
playersScrollArea(new ScrollArea(mTable, true,
"bochecker_background.xml")),
@@ -299,11 +301,11 @@ BotCheckerWindow::BotCheckerWindow():
mPlayerTitleTable->setHeight(1);
- mPlayerTableTitleModel->set(0, 0, new Label(_("Name")));
- mPlayerTableTitleModel->set(0, 1, new Label(_("Attack")));
- mPlayerTableTitleModel->set(0, 2, new Label(_("Talk")));
- mPlayerTableTitleModel->set(0, 3, new Label(_("Move")));
- mPlayerTableTitleModel->set(0, 4, new Label(_("Result")));
+ mPlayerTableTitleModel->set(0, 0, new Label(this, _("Name")));
+ mPlayerTableTitleModel->set(0, 1, new Label(this, _("Attack")));
+ mPlayerTableTitleModel->set(0, 2, new Label(this, _("Talk")));
+ mPlayerTableTitleModel->set(0, 3, new Label(this, _("Move")));
+ mPlayerTableTitleModel->set(0, 4, new Label(this, _("Result")));
mPlayerTitleTable->setLinewiseSelection(true);
diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp
index 94305c9a0..ed152cc82 100644
--- a/src/gui/buydialog.cpp
+++ b/src/gui/buydialog.cpp
@@ -86,9 +86,9 @@ void BuyDialog::init()
mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
mSlider = new Slider(1.0);
- mQuantityLabel = new Label(strprintf("%d / %d", mAmountItems, mMaxItems));
+ mQuantityLabel = new Label(this, strprintf("%d / %d", mAmountItems, mMaxItems));
mQuantityLabel->setAlignment(gcn::Graphics::CENTER);
- mMoneyLabel = new Label(strprintf(_("Price: %s / Total: %s"), "", ""));
+ mMoneyLabel = new Label(this, strprintf(_("Price: %s / Total: %s"), "", ""));
mAmountField = new IntTextField(this, 1, 1, 123);
mAmountField->setActionEventId("amount");
@@ -96,7 +96,7 @@ void BuyDialog::init()
mAmountField->setSendAlwaysEvents(true);
mAmountField->setEnabled(false);
- mAmountLabel = new Label(_("Amount:"));
+ mAmountLabel = new Label(this, _("Amount:"));
mAmountLabel->adjustSize();
// TRANSLATORS: This is a narrow symbol used to denote 'increasing'.
diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp
index 7026077e8..bbd2aa6c3 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)
{
- Label *const accountLabel = new Label(strprintf(_("Account: %s"),
+ Label *const accountLabel = new Label(this, strprintf(_("Account: %s"),
mLoginData->username.c_str()));
- Label *const newEmailLabel = new Label(
+ Label *const newEmailLabel = new Label(this,
_("Type new email address twice:"));
const int width = 200;
diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp
index a7cb8a834..7da2bdf8d 100644
--- a/src/gui/changepassworddialog.cpp
+++ b/src/gui/changepassworddialog.cpp
@@ -56,13 +56,13 @@ ChangePasswordDialog::ChangePasswordDialog(LoginData *const data):
mWrongDataNoticeListener(new WrongDataNoticeListener),
mLoginData(data)
{
- Label *const accountLabel = new Label(
+ Label *const accountLabel = new Label(this,
strprintf(_("Account: %s"), mLoginData->username.c_str()));
place(0, 0, accountLabel, 3);
- place(0, 1, new Label(_("Password:")), 3);
+ place(0, 1, new Label(this, _("Password:")), 3);
place(0, 2, mOldPassField, 3).setPadding(1);
- place(0, 3, new Label(_("Type new password twice:")), 3);
+ place(0, 3, new Label(this, _("Type new password twice:")), 3);
place(0, 4, mFirstPassField, 3).setPadding(1);
place(0, 5, mSecondPassField, 3).setPadding(1);
place(1, 6, mCancelButton);
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp
index 885a58497..560f565f4 100644
--- a/src/gui/charcreatedialog.cpp
+++ b/src/gui/charcreatedialog.cpp
@@ -71,25 +71,25 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
gcn::KeyListener(),
mCharSelectDialog(parent),
mNameField(new TextField(this, "")),
- mNameLabel(new Label(_("Name:"))),
+ mNameLabel(new Label(this, _("Name:"))),
// TRANSLATORS: This is a narrow symbol used to denote 'next'.
// You may change this symbol if your language uses another.
mNextHairColorButton(new Button(this, _(">"), "nextcolor", this)),
// TRANSLATORS: This is a narrow symbol used to denote 'previous'.
// You may change this symbol if your language uses another.
mPrevHairColorButton(new Button(this, _("<"), "prevcolor", this)),
- mHairColorLabel(new Label(_("Hair color:"))),
- mHairColorNameLabel(new Label("")),
+ mHairColorLabel(new Label(this, _("Hair color:"))),
+ mHairColorNameLabel(new Label(this, "")),
mNextHairStyleButton(new Button(this, _(">"), "nextstyle", this)),
mPrevHairStyleButton(new Button(this, _("<"), "prevstyle", this)),
- mHairStyleLabel(new Label(_("Hair style:"))),
- mHairStyleNameLabel(new Label("")),
+ mHairStyleLabel(new Label(this, _("Hair style:"))),
+ mHairStyleNameLabel(new Label(this, "")),
mActionButton(new Button(this, _("^"), "action", this)),
mRotateButton(new Button(this, _(">"), "rotate", this)),
mMale(new RadioButton(_("Male"), "gender")),
mFemale(new RadioButton(_("Female"), "gender")),
mOther(new RadioButton(_("Other"), "gender")),
- mAttributesLeft(new Label(
+ mAttributesLeft(new Label(this,
strprintf(_("Please distribute %d points"), 99))),
mMaxPoints(0),
mUsedPoints(0),
@@ -136,8 +136,8 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
{
mNextRaceButton = new Button(this, _(">"), "nextrace", this);
mPrevRaceButton = new Button(this, _("<"), "prevrace", this);
- mRaceLabel = new Label(_("Race:"));
- mRaceNameLabel = new Label("");
+ mRaceLabel = new Label(this, _("Race:"));
+ mRaceNameLabel = new Label(this, "");
}
// Default to a Male character
@@ -441,7 +441,7 @@ void CharCreateDialog::setAttributes(const StringVect &labels,
for (unsigned i = 0, sz = static_cast<unsigned>(labels.size());
i < sz; i++)
{
- mAttributeLabel[i] = new Label(labels[i]);
+ mAttributeLabel[i] = new Label(this, labels[i]);
mAttributeLabel[i]->setWidth(70);
mAttributeLabel[i]->setPosition(5, 145 + i * 24);
mAttributeLabel[i]->adjustSize();
@@ -454,7 +454,7 @@ void CharCreateDialog::setAttributes(const StringVect &labels,
mAttributeSlider[i]->addActionListener(this);
add(mAttributeSlider[i]);
- mAttributeValue[i] = new Label(toString(min));
+ mAttributeValue[i] = new Label(this, toString(min));
mAttributeValue[i]->setPosition(295, 145 + i * 24);
add(mAttributeValue[i]);
}
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index 8e0ced99d..d822e005c 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -141,8 +141,8 @@ CharSelectDialog::CharSelectDialog(LoginData *const data):
gcn::KeyListener(),
mLocked(false),
mLoginData(data),
- mAccountNameLabel(new Label(mLoginData->username)),
- mLastLoginLabel(new Label(mLoginData->lastLogin)),
+ mAccountNameLabel(new Label(this, mLoginData->username)),
+ mLastLoginLabel(new Label(this, mLoginData->lastLogin)),
mSwitchLoginButton(new Button(this, _("Switch Login"), "switch", this)),
mChangePasswordButton(new Button(this, _("Change Password"),
"change_password", this)),
@@ -561,9 +561,9 @@ CharacterDisplay::CharacterDisplay(const Widget2 *const widget,
Container(widget),
mCharacter(nullptr),
mPlayerBox(new PlayerBox(nullptr)),
- mName(new Label("wwwwwwwwwwwwwwwwwwwwwwww")),
- mLevel(new Label("(888)")),
- mMoney(new Label("wwwwwwwww")),
+ mName(new Label(this, "wwwwwwwwwwwwwwwwwwwwwwww")),
+ mLevel(new Label(this, "(888)")),
+ mMoney(new Label(this, "wwwwwwwww")),
mButton(new Button(this, "wwwwwwwww", "go", charSelectDialog)),
mDelete(new Button(this, _("Delete"), "delete", charSelectDialog))
{
diff --git a/src/gui/connectiondialog.cpp b/src/gui/connectiondialog.cpp
index 3206fefc6..00c5a58f2 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;
- Label *const label = new Label(text);
+ Label *const label = new Label(this, text);
Button *const cancelButton = new Button(
this, _("Cancel"), "cancelButton", this);
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index 120195aef..c78d3e12d 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -136,19 +136,19 @@ void DebugWindow::widgetResized(const gcn::Event &event)
MapDebugTab::MapDebugTab(const Widget2 *const widget) :
DebugTab(widget),
- mMusicFileLabel(new Label(strprintf(_("Music:")))),
- mMapLabel(new Label(strprintf(_("Map:")))),
- mMinimapLabel(new Label(strprintf(_("Minimap:")))),
- mTileMouseLabel(new Label(strprintf("%s (%d, %d)", _("Cursor:"), 0, 0))),
- mParticleCountLabel(new Label(strprintf("%s %d",
+ mMusicFileLabel(new Label(this, strprintf(_("Music:")))),
+ mMapLabel(new Label(this, strprintf(_("Map:")))),
+ mMinimapLabel(new Label(this, strprintf(_("Minimap:")))),
+ mTileMouseLabel(new Label(this, strprintf("%s (%d, %d)", _("Cursor:"), 0, 0))),
+ mParticleCountLabel(new Label(this, strprintf("%s %d",
_("Particle count:"), 88888))),
- mMapActorCountLabel(new Label(strprintf("%s %d",
+ mMapActorCountLabel(new Label(this, strprintf("%s %d",
_("Map actors count:"), 88888))),
- mXYLabel(new Label(strprintf("%s (?,?)", _("Player Position:")))),
+ mXYLabel(new Label(this, strprintf("%s (?,?)", _("Player Position:")))),
mTexturesLabel(nullptr),
mUpdateTime(0),
- mFPSLabel(new Label(strprintf(_("%d FPS"), 0))),
- mLPSLabel(new Label(strprintf(_("%d LPS"), 0)))
+ mFPSLabel(new Label(this, strprintf(_("%d FPS"), 0))),
+ mLPSLabel(new Label(this, strprintf(_("%d LPS"), 0)))
{
LayoutHelper h(this);
ContainerPlacer place = h.getPlacer(0, 0);
@@ -182,7 +182,7 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) :
place(0, 8, mMapActorCountLabel, 2);
#ifdef USE_OPENGL
#ifdef DEBUG_OPENGL_LEAKS
- mTexturesLabel = new Label(strprintf("%s %s", _("Textures count:"), "?"));
+ mTexturesLabel = new Label(this, strprintf("%s %s", _("Textures count:"), "?"));
place(0, 9, mTexturesLabel, 2);
#endif
#endif
@@ -260,16 +260,16 @@ void MapDebugTab::logic()
TargetDebugTab::TargetDebugTab(const Widget2 *const widget) :
DebugTab(widget),
- mTargetLabel(new Label(strprintf("%s ?", _("Target:")))),
- mTargetIdLabel(new Label(strprintf("%s ? ", _("Target Id:")))),
- mTargetLevelLabel(new Label(strprintf("%s ?", _("Target level:")))),
- mTargetRaceLabel(new Label(strprintf("%s ?", _("Target race:")))),
- mTargetPartyLabel(new Label(strprintf("%s ?", _("Target party:")))),
- mTargetGuildLabel(new Label(strprintf("%s ?", _("Target guild:")))),
- mAttackDelayLabel(new Label(strprintf("%s ?", _("Attack delay:")))),
- mMinHitLabel(new Label(strprintf("%s ?", _("Minimal hit:")))),
- mMaxHitLabel(new Label(strprintf("%s ?", _("Maximum hit:")))),
- mCriticalHitLabel(new Label(strprintf("%s ?", _("Critical hit:"))))
+ mTargetLabel(new Label(this, strprintf("%s ?", _("Target:")))),
+ mTargetIdLabel(new Label(this, strprintf("%s ? ", _("Target Id:")))),
+ mTargetLevelLabel(new Label(this, strprintf("%s ?", _("Target level:")))),
+ mTargetRaceLabel(new Label(this, strprintf("%s ?", _("Target race:")))),
+ mTargetPartyLabel(new Label(this, strprintf("%s ?", _("Target party:")))),
+ mTargetGuildLabel(new Label(this, strprintf("%s ?", _("Target guild:")))),
+ mAttackDelayLabel(new Label(this, strprintf("%s ?", _("Attack delay:")))),
+ mMinHitLabel(new Label(this, strprintf("%s ?", _("Minimal hit:")))),
+ mMaxHitLabel(new Label(this, strprintf("%s ?", _("Maximum hit:")))),
+ mCriticalHitLabel(new Label(this, strprintf("%s ?", _("Critical hit:"))))
{
LayoutHelper h(this);
ContainerPlacer place = h.getPlacer(0, 0);
@@ -364,9 +364,9 @@ void TargetDebugTab::logic()
NetDebugTab::NetDebugTab(const Widget2 *const widget) :
DebugTab(widget),
- mPingLabel(new Label(" ")),
- mInPackets1Label(new Label(" ")),
- mOutPackets1Label(new Label(" "))
+ mPingLabel(new Label(this, " ")),
+ mInPackets1Label(new Label(this, " ")),
+ mOutPackets1Label(new Label(this, " "))
{
LayoutHelper h(this);
ContainerPlacer place = h.getPlacer(0, 0);
diff --git a/src/gui/editserverdialog.cpp b/src/gui/editserverdialog.cpp
index 907a706b8..f51236513 100644
--- a/src/gui/editserverdialog.cpp
+++ b/src/gui/editserverdialog.cpp
@@ -81,11 +81,11 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent,
{
setWindowName("EditServerDialog");
- Label *const nameLabel = new Label(_("Name:"));
- Label *const serverAdressLabel = new Label(_("Address:"));
- Label *const portLabel = new Label(_("Port:"));
- Label *const typeLabel = new Label(_("Server type:"));
- Label *const descriptionLabel = new Label(_("Description:"));
+ Label *const nameLabel = new Label(this, _("Name:"));
+ Label *const serverAdressLabel = new Label(this, _("Address:"));
+ Label *const portLabel = new Label(this, _("Port:"));
+ Label *const typeLabel = new Label(this, _("Server type:"));
+ Label *const descriptionLabel = new Label(this, _("Description:"));
mPortField->setNumeric(true);
mPortField->setRange(1, 65535);
diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp
index 5e29f130c..e25647436 100644
--- a/src/gui/itemamountwindow.cpp
+++ b/src/gui/itemamountwindow.cpp
@@ -192,7 +192,7 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent,
mItemPriceSlide->setActionEventId("slidePrice");
mItemPriceSlide->addActionListener(this);
- mGPLabel = new Label(" GP");
+ mGPLabel = new Label(this, " GP");
}
if (mUsage == ShopBuyAdd)
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index 3c4241022..2b7ddff9c 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -47,7 +47,7 @@
ItemPopup::ItemPopup() :
Popup("ItemPopup", "itempopup.xml"),
- mItemName(new Label),
+ mItemName(new Label(this)),
mItemDesc(new TextBox),
mItemEffect(new TextBox),
mItemWeight(new TextBox),
diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp
index 9763742ea..47409fe03 100644
--- a/src/gui/killstats.cpp
+++ b/src/gui/killstats.cpp
@@ -48,27 +48,27 @@ KillStats::KillStats():
mKillTimer(0),
mResetButton(new Button(this, _("Reset stats"), "reset", this)),
mTimerButton(new Button(this, _("Reset timer"), "timer", this)),
- mLine4(new Label(strprintf(_("Kills: %s, total exp: %s"), "?", "?"))),
- mLine5(new Label(strprintf(_("Avg Exp: %s"), "?"))),
- mLine6(new Label(strprintf(_("No. of avg mob to next level: %s"), "?"))),
- mLine7(new Label(strprintf(_("Kills/Min: %s, Exp/Min: %s"), "?", "?"))),
- mExpSpeed1Label(new Label(strprintf(ngettext("Exp speed per %d min: %s",
+ mLine4(new Label(this, strprintf(_("Kills: %s, total exp: %s"), "?", "?"))),
+ mLine5(new Label(this, strprintf(_("Avg Exp: %s"), "?"))),
+ mLine6(new Label(this, strprintf(_("No. of avg mob to next level: %s"), "?"))),
+ mLine7(new Label(this, strprintf(_("Kills/Min: %s, Exp/Min: %s"), "?", "?"))),
+ mExpSpeed1Label(new Label(this, strprintf(ngettext("Exp speed per %d min: %s",
"Exp speed per %d min: %s", 1), 1, "?"))),
- mExpTime1Label(new Label(strprintf(ngettext(
+ mExpTime1Label(new Label(this, strprintf(ngettext(
"Time for next level per %d min: %s",
"Time for next level per %d min: %s", 1), 1, "?"))),
- mExpSpeed5Label(new Label(strprintf(ngettext("Exp speed per %d min: %s",
+ mExpSpeed5Label(new Label(this, strprintf(ngettext("Exp speed per %d min: %s",
"Exp speed per %d min: %s", 5), 5, "?"))),
- mExpTime5Label(new Label(strprintf(ngettext(
+ mExpTime5Label(new Label(this, strprintf(ngettext(
"Time for next level per %d min: %s",
"Time for next level per %d min: %s", 5), 5, "?"))),
- mExpSpeed15Label(new Label(strprintf(ngettext("Exp speed per %d min: %s",
+ mExpSpeed15Label(new Label(this, strprintf(ngettext("Exp speed per %d min: %s",
"Exp speed per %d min: %s", 15), 15, "?"))),
- mExpTime15Label(new Label(strprintf(ngettext(
+ mExpTime15Label(new Label(this, strprintf(ngettext(
"Time for next level per %d min: %s",
"Time for next level per %d min: %s", 15), 15, "?"))),
- mLastKillExpLabel(new Label(strprintf("%s ?", _("Last kill exp:")))),
- mTimeBeforeJackoLabel(new Label(strprintf(
+ mLastKillExpLabel(new Label(this, strprintf("%s ?", _("Last kill exp:")))),
+ mTimeBeforeJackoLabel(new Label(this, strprintf(
"%s ?", _("Time before jacko spawn:")))),
m1minExpTime(0),
m1minExpNum(0),
@@ -100,14 +100,14 @@ KillStats::KillStats():
if (!xpNextLevel)
xpNextLevel = 1;
- mLine1 = new Label(strprintf(_("Level: %d at %f%%"),
+ mLine1 = new Label(this, strprintf(_("Level: %d at %f%%"),
player_node->getLevel(), static_cast<double>(xp)
/ static_cast<double>(xpNextLevel) * 100.0));
- mLine2 = new Label(strprintf(_("Exp: %d/%d Left: %d"),
+ mLine2 = new Label(this, strprintf(_("Exp: %d/%d Left: %d"),
xp, xpNextLevel, xpNextLevel - xp));
- mLine3 = new Label(strprintf(_("1%% = %d exp, avg mob for 1%%: %s"),
+ mLine3 = new Label(this, strprintf(_("1%% = %d exp, avg mob for 1%%: %s"),
xpNextLevel / 100, "?"));
place(0, 0, mLine1, 6).setPadding(0);
diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp
index b16082485..8b2ff0d7d 100644
--- a/src/gui/logindialog.cpp
+++ b/src/gui/logindialog.cpp
@@ -124,7 +124,7 @@ LoginDialog::LoginDialog(LoginData *const data, std::string serverName,
mPassField(new PasswordField(this, mLoginData->password)),
mKeepCheck(new CheckBox(this, _("Remember username"),
mLoginData->remember)),
- mUpdateTypeLabel(new Label(_("Update:"))),
+ mUpdateTypeLabel(new Label(this, _("Update:"))),
mUpdateHostLabel(nullptr),
mUpdateTypeModel(new UpdateTypeModel()),
mUpdateTypeDropDown(new DropDown(this, mUpdateTypeModel)),
@@ -140,14 +140,14 @@ LoginDialog::LoginDialog(LoginData *const data, std::string serverName,
mUpdateHost(updateHost),
mServerName(serverName)
{
- Label *const serverLabel1 = new Label(_("Server:"));
- Label *const serverLabel2 = new Label(serverName);
+ Label *const serverLabel1 = new Label(this, _("Server:"));
+ Label *const serverLabel2 = new Label(this, serverName);
serverLabel2->adjustSize();
- Label *const userLabel = new Label(_("Name:"));
- Label *const passLabel = new Label(_("Password:"));
+ Label *const userLabel = new Label(this, _("Name:"));
+ Label *const passLabel = new Label(this, _("Password:"));
if (mLoginData && mLoginData->updateHosts.size() > 1)
{
- mUpdateHostLabel = new Label(strprintf(_("Update host: %s"),
+ mUpdateHostLabel = new Label(this, strprintf(_("Update host: %s"),
mLoginData->updateHost.c_str()));
mUpdateListModel = new UpdateListModel(mLoginData);
mUpdateHostDropDown = new DropDown(this, mUpdateListModel,
diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp
index 0a78ef61c..6d1064ef6 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
- Label *const senderText = new Label(_("To:"));
+ Label *const senderText = new Label(this, _("To:"));
senderText->setPosition(5, 5);
mSender->setPosition(senderText->getWidth() + 5, 5);
mSender->setWidth(65);
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index 9f9c05565..2c1800c82 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -61,12 +61,12 @@ OutfitWindow::OutfitWindow():
mPreviousButton(new Button(this, _("<"), "previous", this)),
mNextButton(new Button(this, _(">"), "next", this)),
mEquipButtom(new Button(this, _("Equip"), "equip", this)),
- mCurrentLabel(new Label(strprintf(_("Outfit: %d"), 1))),
+ mCurrentLabel(new Label(this, strprintf(_("Outfit: %d"), 1))),
mUnequipCheck(new CheckBox(this, _("Unequip first"),
serverConfig.getValueBool("OutfitUnequip0", true))),
mAwayOutfitCheck(new CheckBox(this, _("Away outfit"),
serverConfig.getValue("OutfitAwayIndex", OUTFITS_COUNT - 1))),
- mKeyLabel(new Label(strprintf(_("Key: %s"),
+ mKeyLabel(new Label(this, strprintf(_("Key: %s"),
keyName(mCurrentOutfit).c_str()))),
mBoxWidth(33),
mBoxHeight(33),
diff --git a/src/gui/registerdialog.cpp b/src/gui/registerdialog.cpp
index d48e2f2c0..54d6dc149 100644
--- a/src/gui/registerdialog.cpp
+++ b/src/gui/registerdialog.cpp
@@ -80,9 +80,9 @@ RegisterDialog::RegisterDialog(LoginData *const data):
const int optionalActions = Net::getLoginHandler()->
supportedOptionalActions();
- Label *const userLabel = new Label(_("Name:"));
- Label *const passwordLabel = new Label(_("Password:"));
- Label *const confirmLabel = new Label(_("Confirm:"));
+ Label *const userLabel = new Label(this, _("Name:"));
+ Label *const passwordLabel = new Label(this, _("Password:"));
+ Label *const confirmLabel = new Label(this, _("Confirm:"));
ContainerPlacer placer;
placer = getPlacer(0, 0);
@@ -118,7 +118,7 @@ RegisterDialog::RegisterDialog(LoginData *const data):
if (optionalActions & Net::LoginHandler::SetEmailOnRegister)
{
- Label *const emailLabel = new Label(_("Email:"));
+ Label *const emailLabel = new Label(this, _("Email:"));
mEmailField = new TextField(this);
placer(0, row, emailLabel);
placer(1, row, mEmailField, 3).setPadding(2);
diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp
index e9889de91..3e8c89d86 100644
--- a/src/gui/selldialog.cpp
+++ b/src/gui/selldialog.cpp
@@ -86,9 +86,9 @@ void SellDialog::init()
mSlider = new Slider(1.0);
- mQuantityLabel = new Label(strprintf("%d / %d", mAmountItems, mMaxItems));
+ mQuantityLabel = new Label(this, strprintf("%d / %d", mAmountItems, mMaxItems));
mQuantityLabel->setAlignment(gcn::Graphics::CENTER);
- mMoneyLabel = new Label(strprintf(_("Price: %s / Total: %s"),
+ mMoneyLabel = new Label(this, strprintf(_("Price: %s / Total: %s"),
"", ""));
mIncreaseButton = new Button(this, _("+"), "inc", this);
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 6aec0d6de..b3fb9df5c 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -247,7 +247,7 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo,
gcn::ActionListener(),
gcn::KeyListener(),
gcn::SelectionListener(),
- mDescription(new Label(std::string())),
+ mDescription(new Label(this, std::string())),
mQuitButton(new Button(this, _("Quit"), "quit", this)),
mConnectButton(new Button(this, _("Connect"), "connect", this)),
mAddEntryButton(new Button(this, _("Add"), "addEntry", this)),
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 91d2bd33f..92900cffc 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -116,7 +116,7 @@ Setup::Setup():
add(mPanel);
- Label *const version = new Label(FULL_VERSION);
+ Label *const version = new Label(this, FULL_VERSION);
// version->setPosition(9, height - version->getHeight() - 9);
if (mResetWindows)
{
diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp
index 4e93fbb0c..2cc3bac1d 100644
--- a/src/gui/setup_colors.cpp
+++ b/src/gui/setup_colors.cpp
@@ -58,21 +58,21 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) :
mPreviewBox(new ScrollArea(mPreview, true,
"setup_colors_preview_background.xml")),
mSelected(-1),
- mGradTypeLabel(new Label(_("Type:"))),
+ mGradTypeLabel(new Label(this, _("Type:"))),
mGradTypeSlider(new Slider(0, 3)),
- mGradTypeText(new Label),
- mGradDelayLabel(new Label(_("Delay:"))),
+ mGradTypeText(new Label(this)),
+ mGradDelayLabel(new Label(this, _("Delay:"))),
mGradDelaySlider(new Slider(20, 100)),
mGradDelayText(new TextField(this)),
- mRedLabel(new Label(_("Red:"))),
+ mRedLabel(new Label(this, _("Red:"))),
mRedSlider(new Slider(0, 255)),
mRedText(new TextField(this)),
mRedValue(0),
- mGreenLabel(new Label(_("Green:"))),
+ mGreenLabel(new Label(this, _("Green:"))),
mGreenSlider(new Slider(0, 255)),
mGreenText(new TextField(this)),
mGreenValue(0),
- mBlueLabel(new Label(_("Blue:"))),
+ mBlueLabel(new Label(this, _("Blue:"))),
mBlueSlider(new Slider(0, 255)),
mBlueText(new TextField(this)),
mBlueValue(0)
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp
index 96dbbd917..1c38008a5 100644
--- a/src/gui/setup_joystick.cpp
+++ b/src/gui/setup_joystick.cpp
@@ -43,7 +43,8 @@ extern Joystick *joystick;
Setup_Joystick::Setup_Joystick(const Widget2 *const widget) :
SetupTab(widget),
- mCalibrateLabel(new Label(_("Press the button to start calibration"))),
+ mCalibrateLabel(new Label(this,
+ _("Press the button to start calibration"))),
mCalibrateButton(new Button(this, _("Calibrate"), "calibrate", this)),
mJoystickEnabled(new CheckBox(this, _("Enable joystick"))),
mNamesModel(new NamesModel()),
diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp
index 97d962f2a..2e1ba95bb 100644
--- a/src/gui/setup_relations.cpp
+++ b/src/gui/setup_relations.cpp
@@ -158,7 +158,7 @@ public:
player_names->size()); r < sz; ++r)
{
std::string name = (*player_names)[r];
- gcn::Widget *const widget = new Label(name);
+ gcn::Widget *const widget = new Label(this, name);
mWidgets.push_back(widget);
DropDown *const choicebox = new DropDown(this, mListModel);
@@ -262,7 +262,7 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) :
mIgnoreActionChoicesBox = new DropDown(widget, mIgnoreActionChoicesModel);
for (int i = 0; i < COLUMNS_NR; i++)
- mPlayerTableTitleModel->set(0, i, new Label(gettext(table_titles[i])));
+ mPlayerTableTitleModel->set(0, i, new Label(this, gettext(table_titles[i])));
mPlayerTitleTable->setLinewiseSelection(true);
@@ -271,7 +271,7 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) :
mPlayerTable->setLinewiseSelection(true);
mPlayerTable->addActionListener(this);
- Label *const ignore_action_label = new Label(_("When ignoring:"));
+ Label *const ignore_action_label = new Label(this, _("When ignoring:"));
mIgnoreActionChoicesBox->setActionEventId(ACTION_STRATEGY);
mIgnoreActionChoicesBox->addActionListener(this);
diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp
index 13422348d..c3b38dd23 100644
--- a/src/gui/setup_theme.cpp
+++ b/src/gui/setup_theme.cpp
@@ -161,39 +161,39 @@ public:
Setup_Theme::Setup_Theme(const Widget2 *const widget) :
SetupTab(widget),
- mThemeLabel(new Label(_("Gui theme"))),
+ mThemeLabel(new Label(this, _("Gui theme"))),
mThemesModel(new ThemesModel),
mThemeDropDown(new DropDown(this, mThemesModel)),
mTheme(config.getStringValue("theme")),
mFontsModel(new FontsModel),
- mFontLabel(new Label(_("Main Font"))),
+ mFontLabel(new Label(this, _("Main Font"))),
mFontDropDown(new DropDown(this, mFontsModel)),
mFont(config.getStringValue("font")),
mLangListModel(new LangListModel),
- mLangLabel(new Label(_("Language"))),
+ mLangLabel(new Label(this, _("Language"))),
mLangDropDown(new DropDown(this, mLangListModel)),
mLang(config.getStringValue("lang")),
- mBoldFontLabel(new Label(_("Bold font"))),
+ mBoldFontLabel(new Label(this, _("Bold font"))),
mBoldFontDropDown(new DropDown(this, mFontsModel)),
mBoldFont(config.getStringValue("boldFont")),
- mParticleFontLabel(new Label(_("Particle font"))),
+ mParticleFontLabel(new Label(this, _("Particle font"))),
mParticleFontDropDown(new DropDown(this, mFontsModel)),
mParticleFont(config.getStringValue("particleFont")),
- mHelpFontLabel(new Label(_("Help font"))),
+ mHelpFontLabel(new Label(this, _("Help font"))),
mHelpFontDropDown(new DropDown(this, mFontsModel)),
mHelpFont(config.getStringValue("helpFont")),
- mSecureFontLabel(new Label(_("Secure font"))),
+ mSecureFontLabel(new Label(this, _("Secure font"))),
mSecureFontDropDown(new DropDown(this, mFontsModel)),
mSecureFont(config.getStringValue("secureFont")),
- mJapanFontLabel(new Label(_("Japanese font"))),
+ mJapanFontLabel(new Label(this, _("Japanese font"))),
mJapanFontDropDown(new DropDown(this, mFontsModel)),
mJapanFont(config.getStringValue("japanFont")),
mFontSizeListModel(new FontSizeChoiceListModel),
- mFontSizeLabel(new Label(_("Font size"))),
+ mFontSizeLabel(new Label(this, _("Font size"))),
mFontSize(config.getIntValue("fontSize")),
mFontSizeDropDown(new DropDown(this, mFontSizeListModel)),
mNpcFontSizeListModel(new FontSizeChoiceListModel),
- mNpcFontSizeLabel(new Label(_("Npc font size"))),
+ mNpcFontSizeLabel(new Label(this, _("Npc font size"))),
mNpcFontSize(config.getIntValue("npcfontSize")),
mNpcFontSizeDropDown(new DropDown(this, mNpcFontSizeListModel)),
// TRANSLATORS: button name with information about selected theme
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 3da6167c0..2c33ba91e 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -238,9 +238,9 @@ Setup_Video::Setup_Video(const Widget2 *const widget) :
mNoFrameCheckBox(new CheckBox(this,_("No frame"), mNoFrame)),
mFpsCheckBox(new CheckBox(this,_("FPS limit:"))),
mFpsSlider(new Slider(2, 160)),
- mFpsLabel(new Label),
+ mFpsLabel(new Label(this)),
mAltFpsSlider(new Slider(2, 160)),
- mAltFpsLabel(new Label(_("Alt FPS limit: "))),
+ mAltFpsLabel(new Label(this, _("Alt FPS limit: "))),
mDetectButton(new Button(this, _("Detect best mode"), "detect", this)),
mDialog(nullptr)
{
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp
index a0e91dd26..87d2e8f25 100644
--- a/src/gui/shopwindow.cpp
+++ b/src/gui/shopwindow.cpp
@@ -84,8 +84,8 @@ ShopWindow::ShopWindow():
getOptionBool("showbuybackground"), "shop_buy_background.xml")),
mSellScrollArea(new ScrollArea(mSellShopItemList,
getOptionBool("showsellbackground"), "shop_sell_background.xml")),
- mBuyLabel(new Label(_("Buy items"))),
- mSellLabel(new Label(_("Sell items"))),
+ mBuyLabel(new Label(this, _("Buy items"))),
+ mSellLabel(new Label(this, _("Sell items"))),
mBuyAddButton(new Button(this, _("Add"), "add buy", this)),
mBuyDeleteButton(new Button(this, _("Delete"), "delete buy", this)),
mBuyAnnounceButton(new Button(this, _("Announce"), "announce buy", this)),
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index c50ed8761..9cc365c4b 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -233,7 +233,7 @@ SkillDialog::SkillDialog() :
Window(_("Skills"), false, nullptr, "skills.xml"),
gcn::ActionListener(),
mTabs(new TabbedArea(this)),
- mPointsLabel(new Label("0")),
+ mPointsLabel(new Label(this, "0")),
mUseButton(new Button(this, _("Use"), "use", this)),
mIncreaseButton(new Button(this, _("Up"), "inc", this)),
mDefaultModel(nullptr)
diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp
index b1d105aeb..05aea6b96 100644
--- a/src/gui/specialswindow.cpp
+++ b/src/gui/specialswindow.cpp
@@ -210,16 +210,16 @@ SpecialEntry::SpecialEntry(SpecialInfo *const info) :
add(mIcon);
if (info)
- mNameLabel = new Label(info->name);
+ mNameLabel = new Label(this, info->name);
else
- mNameLabel = new Label("");
+ mNameLabel = new Label(this, "");
mNameLabel->setPosition(35, 0);
add(mNameLabel);
if (info && info->hasLevel)
{
- mLevelLabel = new Label(toString(info->level));
+ mLevelLabel = new Label(this, toString(info->level));
mLevelLabel->setPosition(getWidth() - mLevelLabel->getWidth(), 0);
add(mLevelLabel);
}
diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp
index 84d42c649..453408229 100644
--- a/src/gui/speechbubble.cpp
+++ b/src/gui/speechbubble.cpp
@@ -35,7 +35,7 @@
SpeechBubble::SpeechBubble() :
Popup("Speech", "speechbubble.xml"),
- mCaption(new Label),
+ mCaption(new Label(this)),
mSpeechBox(new TextBox)
{
setContentSize(140, 46);
diff --git a/src/gui/spellpopup.cpp b/src/gui/spellpopup.cpp
index fd589a40c..f9ba2c9e7 100644
--- a/src/gui/spellpopup.cpp
+++ b/src/gui/spellpopup.cpp
@@ -40,8 +40,8 @@
SpellPopup::SpellPopup():
Popup("SpellPopup", "spellpopup.xml"),
- mItemName(new Label),
- mItemComment(new Label)
+ mItemName(new Label(this)),
+ mItemComment(new Label(this))
{
mItemName->setFont(boldFont);
mItemName->setForegroundColor(getThemeColor(Theme::POPUP));
diff --git a/src/gui/statuspopup.cpp b/src/gui/statuspopup.cpp
index 46527a431..a0cd790c1 100644
--- a/src/gui/statuspopup.cpp
+++ b/src/gui/statuspopup.cpp
@@ -43,21 +43,21 @@
StatusPopup::StatusPopup() :
Popup("StatusPopup", "statuspopup.xml"),
- mMoveType(new Label),
- mCrazyMoveType(new Label),
- mMoveToTargetType(new Label),
- mFollowMode(new Label),
- mAttackType(new Label),
- mAttackWeaponType(new Label),
- mDropCounter(new Label),
- mPickUpType(new Label),
- mMapType(new Label),
- mMagicAttackType(new Label),
- mPvpAttackType(new Label),
- mDisableGameModifiers(new Label),
- mImitationMode(new Label),
- mAwayMode(new Label),
- mCameraMode(new Label)
+ mMoveType(new Label(this)),
+ mCrazyMoveType(new Label(this)),
+ mMoveToTargetType(new Label(this)),
+ mFollowMode(new Label(this)),
+ mAttackType(new Label(this)),
+ mAttackWeaponType(new Label(this)),
+ mDropCounter(new Label(this)),
+ mPickUpType(new Label(this)),
+ mMapType(new Label(this)),
+ mMagicAttackType(new Label(this)),
+ mPvpAttackType(new Label(this)),
+ mDisableGameModifiers(new Label(this)),
+ mImitationMode(new Label(this)),
+ mAwayMode(new Label(this)),
+ mCameraMode(new Label(this))
{
const int fontHeight = getFont()->getHeight();
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index 0b7bd63f4..d47d5928f 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -131,11 +131,11 @@ StatusWindow::StatusWindow() :
Window(player_node ? player_node->getName() :
"?", false, nullptr, "status.xml"),
gcn::ActionListener(),
- mLvlLabel(new Label(strprintf(_("Level: %d"), 0))),
- mMoneyLabel(new Label(strprintf(_("Money: %s"), ""))),
- mHpLabel(new Label(_("HP:"))),
+ mLvlLabel(new Label(this, strprintf(_("Level: %d"), 0))),
+ mMoneyLabel(new Label(this, strprintf(_("Money: %s"), ""))),
+ mHpLabel(new Label(this, _("HP:"))),
mMpLabel(nullptr),
- mXpLabel(new Label(_("Exp:"))),
+ mXpLabel(new Label(this, _("Exp:"))),
mHpBar(nullptr),
mMpBar(nullptr),
mXpBar(nullptr),
@@ -146,7 +146,7 @@ StatusWindow::StatusWindow() :
mAttrScroll(new ScrollArea(mAttrCont, false)),
mDAttrCont(new VertContainer(this, 32)),
mDAttrScroll(new ScrollArea(mDAttrCont, false)),
- mCharacterPointsLabel(new Label("C")),
+ mCharacterPointsLabel(new Label(this, "C")),
mCorrectionPointsLabel(nullptr),
mCopyButton(new Button(this, _("Copy to chat"), "copy", this))
{
@@ -189,7 +189,7 @@ StatusWindow::StatusWindow() :
if (magicBar)
{
max = PlayerInfo::getAttribute(PlayerInfo::MAX_MP);
- mMpLabel = new Label(_("MP:"));
+ mMpLabel = new Label(this, _("MP:"));
mMpBar = new ProgressBar(max ? static_cast<float>(
PlayerInfo::getAttribute(PlayerInfo::MAX_MP))
/ static_cast<float>(max) : static_cast<float>(0),
@@ -221,8 +221,8 @@ StatusWindow::StatusWindow() :
if (job)
{
- mJobLvlLabel = new Label(strprintf(_("Job: %d"), 0));
- mJobLabel = new Label(_("Job:"));
+ mJobLvlLabel = new Label(this, strprintf(_("Job: %d"), 0));
+ mJobLabel = new Label(this, _("Job:"));
mJobBar = new ProgressBar(0.0f, 80, 0, Theme::PROG_JOB);
place(5, 0, mJobLvlLabel, 3);
@@ -257,7 +257,7 @@ StatusWindow::StatusWindow() :
if (Net::getPlayerHandler()->canCorrectAttributes())
{
- mCorrectionPointsLabel = new Label("C");
+ mCorrectionPointsLabel = new Label(this, "C");
place(0, 7, mCorrectionPointsLabel, 5);
}
@@ -757,8 +757,8 @@ AttrDisplay::AttrDisplay(const Widget2 *const widget,
mId(id),
mName(name),
mLayout(new LayoutHelper(this)),
- mLabel(new Label(name)),
- mValue(new Label("1 "))
+ mLabel(new Label(this, name)),
+ mValue(new Label(this, "1 "))
{
setSize(100, 32);
@@ -803,7 +803,7 @@ ChangeDisplay::ChangeDisplay(const Widget2 *const widget,
AttrDisplay(widget, id, name),
gcn::ActionListener(),
mNeeded(1),
- mPoints(new Label(_("Max"))),
+ mPoints(new Label(this, _("Max"))),
mDec(nullptr),
mInc(new Button(this, _("+"), "inc", this))
{
diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp
index 05ad61a5c..f8db77d6d 100644
--- a/src/gui/textcommandeditor.cpp
+++ b/src/gui/textcommandeditor.cpp
@@ -170,26 +170,26 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) :
mCommand(command),
mIsMagic(new RadioButton(_("magic"), "magic", mIsMagicCommand)),
mIsOther(new RadioButton(_("other"), "magic", !mIsMagicCommand)),
- mSymbolLabel(new Label(_("Symbol:"))),
+ mSymbolLabel(new Label(this, _("Symbol:"))),
mSymbolTextField(new TextField(this)),
- mCommandLabel(new Label(_("Command:"))),
+ mCommandLabel(new Label(this, _("Command:"))),
mCommandTextField(new TextField(this)),
- mCommentLabel(new Label(_("Comment:"))),
+ mCommentLabel(new Label(this, _("Comment:"))),
mCommentTextField(new TextField(this)),
mTargetTypeModel(new TargetTypeModel),
- mTypeLabel(new Label(_("Target Type:"))),
+ mTypeLabel(new Label(this, _("Target Type:"))),
mTypeDropDown(new DropDown(this, mTargetTypeModel)),
mIconsModal(new IconsModal),
- mIconLabel(new Label(_("Icon:"))),
+ mIconLabel(new Label(this, _("Icon:"))),
mIconDropDown(new DropDown(this, mIconsModal)),
- mManaLabel(new Label(_("Mana:"))),
+ mManaLabel(new Label(this, _("Mana:"))),
mManaField(new IntTextField(this, 0)),
- mMagicLvlLabel(new Label(_("Magic level:"))),
+ mMagicLvlLabel(new Label(this, _("Magic level:"))),
mMagicLvlField(new IntTextField(this, 0)),
mMagicSchoolModel(new MagicSchoolModel),
- mSchoolLabel(new Label(_("Magic School:"))),
+ mSchoolLabel(new Label(this, _("Magic School:"))),
mSchoolDropDown(new DropDown(this, mMagicSchoolModel)),
- mSchoolLvlLabel(new Label(_("School level:"))),
+ mSchoolLvlLabel(new Label(this, _("School level:"))),
mSchoolLvlField(new IntTextField(this, 0)),
mCancelButton(new Button(this, _("Cancel"), "cancel", this)),
mSaveButton(new Button(this, _("Save"), "save", this)),
diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp
index 88160e9aa..815ffac4c 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);
- Label *const textLabel = new Label(msg);
+ Label *const textLabel = new Label(this, msg);
Button *const cancelButton = new Button(this, _("Cancel"), "CANCEL", this);
place(0, 0, textLabel, 4);
diff --git a/src/gui/textpopup.cpp b/src/gui/textpopup.cpp
index ed3461685..876c85b78 100644
--- a/src/gui/textpopup.cpp
+++ b/src/gui/textpopup.cpp
@@ -40,9 +40,9 @@
TextPopup::TextPopup():
Popup("TextPopup", "textpopup.xml"),
- mText1(new Label),
- mText2(new Label),
- mText3(new Label)
+ mText1(new Label(this)),
+ mText2(new Label(this)),
+ mText3(new Label(this))
{
const int fontHeight = getFont()->getHeight();
diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp
index f5f593b2e..46a9179b5 100644
--- a/src/gui/tradewindow.cpp
+++ b/src/gui/tradewindow.cpp
@@ -67,7 +67,7 @@ TradeWindow::TradeWindow():
mPartnerInventory(new Inventory(Inventory::TRADE)),
mMyItemContainer(new ItemContainer(this, mMyInventory.get())),
mPartnerItemContainer(new ItemContainer(this, mPartnerInventory.get())),
- mMoneyLabel(new Label(strprintf(_("You get %s"), ""))),
+ mMoneyLabel(new Label(this, strprintf(_("You get %s"), ""))),
mAddButton(new Button(this, _("Add"), "add", this)),
mOkButton(new Button(this, "", "", this)), // Will be filled in later
mMoneyChangeButton(new Button(this, _("Change"), "money", this)),
@@ -112,7 +112,7 @@ TradeWindow::TradeWindow():
true, "trade_background.xml");
partnerScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
- Label *const moneyLabel2 = new Label(_("You give:"));
+ Label *const moneyLabel2 = new Label(this, _("You give:"));
mMoneyField->setWidth(40);
diff --git a/src/gui/unregisterdialog.cpp b/src/gui/unregisterdialog.cpp
index 081b846c3..69c06da09 100644
--- a/src/gui/unregisterdialog.cpp
+++ b/src/gui/unregisterdialog.cpp
@@ -53,9 +53,9 @@ UnRegisterDialog::UnRegisterDialog(LoginData *const data):
mCancelButton(new Button(this, _("Cancel"), "cancel", this)),
mWrongDataNoticeListener(new WrongDataNoticeListener)
{
- Label *const userLabel = new Label(strprintf(_("Name: %s"),
+ Label *const userLabel = new Label(this, strprintf(_("Name: %s"),
mLoginData->username.c_str()));
- Label *const passwordLabel = new Label(_("Password:"));
+ Label *const passwordLabel = new Label(this, _("Password:"));
const int width = 210;
const int height = 80;
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index c746bc1ea..cddc689a2 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -156,7 +156,7 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost,
mUpdateIndexOffset(0),
mLoadUpdates(applyUpdates),
mUpdateType(updateType),
- mLabel(new Label(_("Connecting..."))),
+ mLabel(new Label(this, _("Connecting..."))),
mCancelButton(new Button(this, _("Cancel"), "cancel", this)),
mPlayButton(new Button(this, _("Play"), "play", this)),
mProgressBar(new ProgressBar(0.0, 310, 0)),
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index fca9d9ff9..65c7eda77 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -53,11 +53,11 @@ Desktop::Desktop(const Widget2 *const widget) :
if (appName.empty())
{
- mVersionLabel = new Label(FULL_VERSION);
+ mVersionLabel = new Label(this, FULL_VERSION);
}
else
{
- mVersionLabel = new Label(strprintf("%s (%s)", FULL_VERSION,
+ mVersionLabel = new Label(this, strprintf("%s (%s)", FULL_VERSION,
appName.c_str()));
}
diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp
index 63a3f6b76..e7481e992 100644
--- a/src/gui/widgets/label.cpp
+++ b/src/gui/widgets/label.cpp
@@ -30,15 +30,17 @@
Skin *Label::mSkin = nullptr;
int Label::mInstances = 0;
-Label::Label() :
+Label::Label(const Widget2 *const widget) :
gcn::Label(),
+ Widget2(widget),
mPadding(0)
{
init();
}
-Label::Label(const std::string &caption) :
+Label::Label(const Widget2 *const widget, const std::string &caption) :
gcn::Label(caption),
+ Widget2(widget),
mPadding(0)
{
init();
diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h
index d249bdf54..4ea7ca3e3 100644
--- a/src/gui/widgets/label.h
+++ b/src/gui/widgets/label.h
@@ -42,13 +42,13 @@ class Label final : public gcn::Label, public Widget2
/**
* Constructor.
*/
- Label();
+ Label(const Widget2 *const widget);
/**
* Constructor. This version of the constructor sets the label with an
* inintialization string.
*/
- Label(const std::string &caption);
+ Label(const Widget2 *const widget, const std::string &caption);
A_DELETE_COPY(Label)
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index 75090fd0d..27ec95b7a 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -285,7 +285,7 @@ void SetupItemTextField::createControls()
load();
mHorizont = new HorizontContainer(this, 32, 2);
- mLabel = new Label(mText);
+ mLabel = new Label(this, mText);
mTextField = new TextField(this, mValue, true, mParent, mEventName);
mButton = new Button(this, _("Edit"), mEventName + "_EDIT", mParent);
mWidget = mTextField;
@@ -406,7 +406,7 @@ void SetupItemIntTextField::createControls()
load();
mHorizont = new HorizontContainer(this, 32, 2);
- mLabel = new Label(mText);
+ mLabel = new Label(this, mText);
mTextField = new IntTextField(this, atoi(mValue.c_str()),
mMin, mMax, true, 30);
mTextField->setActionEventId(mEventName);
@@ -500,11 +500,11 @@ void SetupItemLabel::createControls()
{
const std::string str = " \342\200\225\342\200\225\342\200\225"
"\342\200\225\342\200\225 ";
- mLabel = new Label(str + mText + str);
+ mLabel = new Label(this, str + mText + str);
}
else
{
- mLabel = new Label(mText);
+ mLabel = new Label(this, mText);
}
mWidget = mLabel;
@@ -580,7 +580,7 @@ void SetupItemDropDown::createControls()
load();
mHorizont = new HorizontContainer(this, 32, 2);
- mLabel = new Label(mText);
+ mLabel = new Label(this, mText);
mDropDown = new DropDown(this, mModel);
mDropDown->setActionEventId(mEventName);
mDropDown->addActionListener(mParent);
@@ -668,7 +668,7 @@ void SetupItemSlider::createControls()
load();
mHorizont = new HorizontContainer(this, 32, 2);
- mLabel = new Label(mText);
+ mLabel = new Label(this, mText);
mSlider = new Slider(mMin, mMax);
mSlider->setActionEventId(mEventName);
mSlider->addActionListener(mParent);
@@ -788,8 +788,8 @@ void SetupItemSlider2::createControls()
const int width = getMaxWidth();
- mLabel = new Label(mText);
- mLabel2 = new Label("");
+ mLabel = new Label(this, mText);
+ mLabel2 = new Label(this, "");
mLabel2->setWidth(width);
mSlider = new Slider(mMin, mMax);
mSlider->setActionEventId(mEventName);
@@ -947,7 +947,7 @@ void SetupItemSliderList::createControls()
load();
mHorizont = new HorizontContainer(this, 32, 2);
- mLabel = new Label(mText);
+ mLabel = new Label(this, mText);
mSlider = new SliderList(this, mModel, mParent, mEventName);
mSlider->setSelectedString(mValue);
mSlider->adjustSize();
diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp
index fb94155c1..0df055d7f 100644
--- a/src/gui/widgets/sliderlist.cpp
+++ b/src/gui/widgets/sliderlist.cpp
@@ -46,7 +46,7 @@ SliderList::SliderList(const Widget2 *const widget,
Container(widget),
gcn::ActionListener(),
gcn::MouseListener(),
- mLabel(new Label),
+ mLabel(new Label(this)),
mListModel(listModel),
mOldWidth(0),
mSelectedIndex(0)
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index c68223d08..18a4489bd 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -65,7 +65,7 @@ Tab::Tab(const Widget2 *const widget) :
Widget2(widget),
gcn::MouseListener(),
gcn::WidgetListener(),
- mLabel(new Label),
+ mLabel(new Label(this)),
mHasMouse(false),
mTabbedArea(nullptr),
mTabColor(&getThemeColor(Theme::TAB)),