diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-20 00:52:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-20 13:55:43 +0300 |
commit | 41adf71a823f475b7f12b00e06056b778311da84 (patch) | |
tree | 55925f737e884f756d05a71238f207c03070a7ad /src/gui | |
parent | 504219f9df4b9dda139dd832e263a136e51c4851 (diff) | |
download | manaverse-41adf71a823f475b7f12b00e06056b778311da84.tar.gz manaverse-41adf71a823f475b7f12b00e06056b778311da84.tar.bz2 manaverse-41adf71a823f475b7f12b00e06056b778311da84.tar.xz manaverse-41adf71a823f475b7f12b00e06056b778311da84.zip |
Add palette inheritance to button class.
Diffstat (limited to 'src/gui')
51 files changed, 161 insertions, 151 deletions
diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp index 91245eb5d..272a172b2 100644 --- a/src/gui/botcheckerwindow.cpp +++ b/src/gui/botcheckerwindow.cpp @@ -273,7 +273,7 @@ BotCheckerWindow::BotCheckerWindow(): "bochecker_background.xml")), mPlayerTableTitleModel(new StaticTableModel(1, COLUMNS_NR)), mPlayerTitleTable(new GuiTable(mPlayerTableTitleModel)), - mIncButton(new Button(_("Reset"), "reset", this)), + mIncButton(new Button(this, _("Reset"), "reset", this)), mLastUpdateTime(0), mNeedUpdate(false), mEnabled(false) diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp index 702a4b171..515ffafd6 100644 --- a/src/gui/buydialog.cpp +++ b/src/gui/buydialog.cpp @@ -101,13 +101,13 @@ void BuyDialog::init() // TRANSLATORS: This is a narrow symbol used to denote 'increasing'. // You may change this symbol if your language uses another. - mIncreaseButton = new Button(_("+"), "inc", this); + mIncreaseButton = new Button(this, _("+"), "inc", this); // TRANSLATORS: This is a narrow symbol used to denote 'decreasing'. // You may change this symbol if your language uses another. - mDecreaseButton = new Button(_("-"), "dec", this); - mBuyButton = new Button(_("Buy"), "buy", this); - mQuitButton = new Button(_("Quit"), "quit", this); - mAddMaxButton = new Button(_("Max"), "max", this); + mDecreaseButton = new Button(this, _("-"), "dec", this); + mBuyButton = new Button(this, _("Buy"), "buy", this); + mQuitButton = new Button(this, _("Quit"), "quit", this); + mAddMaxButton = new Button(this, _("Max"), "max", this); mDecreaseButton->adjustSize(); mDecreaseButton->setWidth(mIncreaseButton->getWidth()); diff --git a/src/gui/buyselldialog.cpp b/src/gui/buyselldialog.cpp index f0f65fb94..121f3d3c8 100644 --- a/src/gui/buyselldialog.cpp +++ b/src/gui/buyselldialog.cpp @@ -70,7 +70,7 @@ void BuySellDialog::init() for (const char **curBtn = buttonNames; *curBtn; curBtn++) { - Button *const btn = new Button(gettext(*curBtn), *curBtn, this); + Button *const btn = new Button(this, gettext(*curBtn), *curBtn, this); if (!mBuyButton) mBuyButton = btn; // For focus request btn->setPosition(x, y); diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp index a61840e06..51b108865 100644 --- a/src/gui/changeemaildialog.cpp +++ b/src/gui/changeemaildialog.cpp @@ -48,9 +48,9 @@ ChangeEmailDialog::ChangeEmailDialog(LoginData *const data): gcn::ActionListener(), mFirstEmailField(new TextField), mSecondEmailField(new TextField), - mChangeEmailButton(new Button(_("Change Email Address"), + mChangeEmailButton(new Button(this, _("Change Email Address"), "change_email", this)), - mCancelButton(new Button(_("Cancel"), "cancel", this)), + mCancelButton(new Button(this, _("Cancel"), "cancel", this)), mWrongDataNoticeListener(new WrongDataNoticeListener), mLoginData(data) { diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp index 30c2a5447..33f0ff561 100644 --- a/src/gui/changepassworddialog.cpp +++ b/src/gui/changepassworddialog.cpp @@ -50,9 +50,9 @@ ChangePasswordDialog::ChangePasswordDialog(LoginData *const data): mOldPassField(new PasswordField), mFirstPassField(new PasswordField), mSecondPassField(new PasswordField), - mChangePassButton(new Button(_("Change Password"), + mChangePassButton(new Button(this, _("Change Password"), "change_password", this)), - mCancelButton(new Button(_("Cancel"), "cancel", this)), + mCancelButton(new Button(this, _("Cancel"), "cancel", this)), mWrongDataNoticeListener(new WrongDataNoticeListener), mLoginData(data) { diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index d3923f025..049eac714 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -74,18 +74,18 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, mNameLabel(new Label(_("Name:"))), // TRANSLATORS: This is a narrow symbol used to denote 'next'. // You may change this symbol if your language uses another. - mNextHairColorButton(new Button(_(">"), "nextcolor", this)), + 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(_("<"), "prevcolor", this)), + mPrevHairColorButton(new Button(this, _("<"), "prevcolor", this)), mHairColorLabel(new Label(_("Hair color:"))), mHairColorNameLabel(new Label("")), - mNextHairStyleButton(new Button(_(">"), "nextstyle", this)), - mPrevHairStyleButton(new Button(_("<"), "prevstyle", this)), + mNextHairStyleButton(new Button(this, _(">"), "nextstyle", this)), + mPrevHairStyleButton(new Button(this, _("<"), "prevstyle", this)), mHairStyleLabel(new Label(_("Hair style:"))), mHairStyleNameLabel(new Label("")), - mActionButton(new Button(_("^"), "action", this)), - mRotateButton(new Button(_(">"), "rotate", 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")), @@ -93,8 +93,8 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, strprintf(_("Please distribute %d points"), 99))), mMaxPoints(0), mUsedPoints(0), - mCreateButton(new Button(_("Create"), "create", this)), - mCancelButton(new Button(_("Cancel"), "cancel", this)), + mCreateButton(new Button(this, _("Create"), "create", this)), + mCancelButton(new Button(this, _("Cancel"), "cancel", this)), mRace(0), mPlayer(new Being(0, ActorSprite::PLAYER, static_cast<uint16_t>(mRace), nullptr)), @@ -134,8 +134,8 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, if (serverVersion >= 2) { - mNextRaceButton = new Button(_(">"), "nextrace", this); - mPrevRaceButton = new Button(_("<"), "prevrace", this); + mNextRaceButton = new Button(this, _(">"), "nextrace", this); + mPrevRaceButton = new Button(this, _("<"), "prevrace", this); mRaceLabel = new Label(_("Race:")); mRaceNameLabel = new Label(""); } diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 06997bc34..8e0ced99d 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -143,8 +143,8 @@ CharSelectDialog::CharSelectDialog(LoginData *const data): mLoginData(data), mAccountNameLabel(new Label(mLoginData->username)), mLastLoginLabel(new Label(mLoginData->lastLogin)), - mSwitchLoginButton(new Button(_("Switch Login"), "switch", this)), - mChangePasswordButton(new Button(_("Change Password"), + mSwitchLoginButton(new Button(this, _("Switch Login"), "switch", this)), + mChangePasswordButton(new Button(this, _("Change Password"), "change_password", this)), mUnregisterButton(nullptr), mChangeEmailButton(nullptr), @@ -167,7 +167,7 @@ CharSelectDialog::CharSelectDialog(LoginData *const data): if (optionalActions & Net::LoginHandler::Unregister) { - mUnregisterButton = new Button(_("Unregister"), + mUnregisterButton = new Button(this, _("Unregister"), "unregister", this); placer(3, 1, mUnregisterButton); } @@ -176,7 +176,7 @@ CharSelectDialog::CharSelectDialog(LoginData *const data): if (optionalActions & Net::LoginHandler::ChangeEmail) { - mChangeEmailButton = new Button(_("Change Email"), + mChangeEmailButton = new Button(this, _("Change Email"), "change_email", this); placer(3, 2, mChangeEmailButton); } @@ -564,8 +564,8 @@ CharacterDisplay::CharacterDisplay(const Widget2 *const widget, mName(new Label("wwwwwwwwwwwwwwwwwwwwwwww")), mLevel(new Label("(888)")), mMoney(new Label("wwwwwwwww")), - mButton(new Button("wwwwwwwww", "go", charSelectDialog)), - mDelete(new Button(_("Delete"), "delete", charSelectDialog)) + mButton(new Button(this, "wwwwwwwww", "go", charSelectDialog)), + mDelete(new Button(this, _("Delete"), "delete", charSelectDialog)) { LayoutHelper h(this); ContainerPlacer placer = h.getPlacer(0, 0); diff --git a/src/gui/confirmdialog.cpp b/src/gui/confirmdialog.cpp index b75a519fd..f66d44132 100644 --- a/src/gui/confirmdialog.cpp +++ b/src/gui/confirmdialog.cpp @@ -46,12 +46,12 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg, mTextBox->setOpaque(false); mTextBox->setTextWrapped(msg, 260); - Button *const yesButton = new Button(_("Yes"), "yes", this); - Button *const noButton = new Button(_("No"), "no", this); + Button *const yesButton = new Button(this, _("Yes"), "yes", this); + Button *const noButton = new Button(this, _("No"), "no", this); Button *ignoreButton = nullptr; if (ignore) - ignoreButton = new Button(_("Ignore"), "ignore", this); + ignoreButton = new Button(this, _("Ignore"), "ignore", this); const int numRows = mTextBox->getNumberOfRows(); int inWidth = yesButton->getWidth() + noButton->getWidth() + diff --git a/src/gui/connectiondialog.cpp b/src/gui/connectiondialog.cpp index ed8b0222d..3206fefc6 100644 --- a/src/gui/connectiondialog.cpp +++ b/src/gui/connectiondialog.cpp @@ -45,7 +45,8 @@ ConnectionDialog::ConnectionDialog(const std::string &text, ProgressIndicator *const progressIndicator = new ProgressIndicator; Label *const label = new Label(text); - Button *const cancelButton = new Button(_("Cancel"), "cancelButton", this); + Button *const cancelButton = new Button( + this, _("Cancel"), "cancelButton", this); place(0, 0, progressIndicator); place(0, 1, label); diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp index c6880b420..3e47a3952 100644 --- a/src/gui/didyouknowwindow.cpp +++ b/src/gui/didyouknowwindow.cpp @@ -53,8 +53,8 @@ DidYouKnowWindow::DidYouKnowWindow(): mBrowserBox(new BrowserBox(this)), mScrollArea(new ScrollArea(mBrowserBox, true, "didyouknow_background.xml")), - mButtonPrev(new Button(_("< Previous"), "prev", this)), - mButtonNext(new Button(_("Next >"), "next", this)), + mButtonPrev(new Button(this, _("< Previous"), "prev", this)), + mButtonNext(new Button(this, _("Next >"), "next", this)), mOpenAgainCheckBox(new CheckBox(_("Auto open this window"), config.getBoolValue("showDidYouKnow"), this, "openagain")) { @@ -69,7 +69,7 @@ DidYouKnowWindow::DidYouKnowWindow(): setDefaultSize(500, 400, ImageRect::CENTER); mBrowserBox->setOpaque(false); - Button *const okButton = new Button(_("Close"), "close", this); + Button *const okButton = new Button(this, _("Close"), "close", this); mBrowserBox->setLinkHandler(this); mBrowserBox->setFont(gui->getHelpFont()); diff --git a/src/gui/editdialog.cpp b/src/gui/editdialog.cpp index 19f7011bb..a022988e5 100644 --- a/src/gui/editdialog.cpp +++ b/src/gui/editdialog.cpp @@ -42,7 +42,7 @@ EditDialog::EditDialog(const std::string &title, const std::string &msg, mTextField->setText(msg); mEventOk = eventOk; - Button *const okButton = new Button(_("OK"), mEventOk, this); + Button *const okButton = new Button(this, _("OK"), mEventOk, this); const int numRows = 1; const int fontHeight = getFont()->getHeight(); diff --git a/src/gui/editserverdialog.cpp b/src/gui/editserverdialog.cpp index 0e9e976f4..41d0bf546 100644 --- a/src/gui/editserverdialog.cpp +++ b/src/gui/editserverdialog.cpp @@ -70,9 +70,9 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, mPortField(new TextField(std::string())), mNameField(new TextField(std::string())), mDescriptionField(new TextField(std::string())), - mConnectButton(new Button(_("Connect"), "connect", this)), - mOkButton(new Button(_("OK"), "addServer", this)), - mCancelButton(new Button(_("Cancel"), "cancel", this)), + mConnectButton(new Button(this, _("Connect"), "connect", this)), + mOkButton(new Button(this, _("OK"), "addServer", this)), + mCancelButton(new Button(this, _("Cancel"), "cancel", this)), mTypeListModel(new TypeListModel()), mTypeField(new DropDown(this, mTypeListModel)), mServerDialog(parent), diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index a824c21c7..415117b23 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -57,7 +57,7 @@ EquipmentWindow::EquipmentWindow(Equipment *const equipment, mEquipment(equipment), mItemPopup(new ItemPopup), mPlayerBox(new PlayerBox("equipment_playerbox.xml")), - mUnequip(new Button(_("Unequip"), "unequip", this)), + mUnequip(new Button(this, _("Unequip"), "unequip", this)), mSelected(-1), mForing(foring), mImageSet(nullptr), diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp index ef6511ac5..9e9958220 100644 --- a/src/gui/helpwindow.cpp +++ b/src/gui/helpwindow.cpp @@ -62,7 +62,7 @@ HelpWindow::HelpWindow(): setDefaultSize(500, 400, ImageRect::CENTER); mBrowserBox->setOpaque(false); - Button *const okButton = new Button(_("Close"), "close", this); + Button *const okButton = new Button(this, _("Close"), "close", this); mBrowserBox->setLinkHandler(this); mBrowserBox->setFont(gui->getHelpFont()); diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 4446d2958..ba4180914 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -177,12 +177,12 @@ InventoryWindow::InventoryWindow(Inventory *const inventory): longestUseString = unequip; } - mUseButton = new Button(longestUseString, "use", this); - mDropButton = new Button(_("Drop..."), "drop", this); - mSplitButton = new Button(_("Split"), "split", this); - mOutfitButton = new Button(_("Outfits"), "outfit", this); - mShopButton = new Button(_("Shop"), "shop", this); - mEquipmentButton = new Button(_("Equipment"), "equipment", this); + mUseButton = new Button(this, longestUseString, "use", this); + mDropButton = new Button(this, _("Drop..."), "drop", this); + mSplitButton = new Button(this, _("Split"), "split", this); + mOutfitButton = new Button(this, _("Outfits"), "outfit", this); + mShopButton = new Button(this, _("Shop"), "shop", this); + mEquipmentButton = new Button(this, _("Equipment"), "equipment", this); mWeightBar = new ProgressBar(0.0f, 100, 0, Theme::PROG_WEIGHT); place(0, 0, mWeightBar, 4); @@ -204,9 +204,9 @@ InventoryWindow::InventoryWindow(Inventory *const inventory): } else { - mStoreButton = new Button(_("Store"), "store", this); - mRetrieveButton = new Button(_("Retrieve"), "retrieve", this); - mCloseButton = new Button(_("Close"), "close", this); + mStoreButton = new Button(this, _("Store"), "store", this); + mRetrieveButton = new Button(this, _("Retrieve"), "retrieve", this); + mCloseButton = new Button(this, _("Close"), "close", this); mSlotsBarCell = &place(0, 0, mSlotsBar, 6); mSortDropDownCell = &place(6, 0, mSortDropDown, 1); diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp index 4e6e80f88..dbbe2d50f 100644 --- a/src/gui/itemamountwindow.cpp +++ b/src/gui/itemamountwindow.cpp @@ -205,11 +205,11 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent, // Buttons - Button *const minusAmountButton = new Button(_("-"), "dec", this); - Button *const plusAmountButton = new Button(_("+"), "inc", this); - Button *const okButton = new Button(_("OK"), "ok", this); - Button *const cancelButton = new Button(_("Cancel"), "cancel", this); - Button *const addAllButton = new Button(_("All"), "all", this); + Button *const minusAmountButton = new Button(this, _("-"), "dec", this); + Button *const plusAmountButton = new Button(this, _("+"), "inc", this); + Button *const okButton = new Button(this, _("OK"), "ok", this); + Button *const cancelButton = new Button(this, _("Cancel"), "cancel", this); + Button *const addAllButton = new Button(this, _("All"), "all", this); minusAmountButton->adjustSize(); minusAmountButton->setWidth(plusAmountButton->getWidth()); @@ -233,8 +233,10 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent, if (mUsage == ShopBuyAdd || mUsage == ShopSellAdd) { - Button *const minusPriceButton = new Button(_("-"), "decPrice", this); - Button *const plusPriceButton = new Button(_("+"), "incPrice", this); + Button *const minusPriceButton = new Button( + this, _("-"), "decPrice", this); + Button *const plusPriceButton = new Button( + this, _("+"), "incPrice", this); minusPriceButton->adjustSize(); minusPriceButton->setWidth(plusPriceButton->getWidth()); diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index 15112b2b4..9763742ea 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -46,8 +46,8 @@ KillStats::KillStats(): mKillTCounter(0), mExpTCounter(0), mKillTimer(0), - mResetButton(new Button(_("Reset stats"), "reset", this)), - mTimerButton(new Button(_("Reset timer"), "timer", this)), + 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"), "?"))), diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp index 8ccb5ba04..d4affa6c7 100644 --- a/src/gui/logindialog.cpp +++ b/src/gui/logindialog.cpp @@ -127,9 +127,9 @@ LoginDialog::LoginDialog(LoginData *const data, std::string serverName, mUpdateHostLabel(nullptr), mUpdateTypeModel(new UpdateTypeModel()), mUpdateTypeDropDown(new DropDown(this, mUpdateTypeModel)), - mServerButton(new Button(_("Change Server"), "server", this)), - mLoginButton(new Button(_("Login"), "login", this)), - mRegisterButton(new Button(_("Register"), "register", this)), + mServerButton(new Button(this, _("Change Server"), "server", this)), + mLoginButton(new Button(this, _("Login"), "login", this)), + mRegisterButton(new Button(this, _("Register"), "register", this)), mCustomUpdateHost(new CheckBox(_("Custom update host"), mLoginData->updateType & LoginData::Upd_Custom, this, "customhost")), mUpdateHostText(new TextField(serverConfig.getValue( diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 3e2e860f1..6970babfb 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -75,12 +75,12 @@ NpcDialog::NpcDialog(const int npcId) : mItemLinkHandler(new ItemLinkHandler), mTextField(new TextField("")), mIntField(new IntTextField), - mPlusButton(new Button(_("+"), "inc", this)), - mMinusButton(new Button(_("-"), "dec", this)), - mClearButton(new Button(_("Clear"), "clear", this)), - mButton(new Button("", "ok", this)), - mButton2(new Button(_("Close"), "close", this)), - mResetButton(new Button(_("Reset"), "reset", this)), + mPlusButton(new Button(this, _("+"), "inc", this)), + mMinusButton(new Button(this, _("-"), "dec", this)), + mClearButton(new Button(this, _("Clear"), "clear", this)), + mButton(new Button(this, "", "ok", this)), + mButton2(new Button(this, _("Close"), "close", this)), + mResetButton(new Button(this, _("Reset"), "reset", this)), mInputState(NPC_INPUT_NONE), mActionState(NPC_ACTION_WAIT), mLastNextTime(0), diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp index cc3d5494b..a7c9abf0b 100644 --- a/src/gui/npcpostdialog.cpp +++ b/src/gui/npcpostdialog.cpp @@ -54,10 +54,10 @@ NpcPostDialog::NpcPostDialog(const int npcId): mSender->setWidth(65); // create button for sending - Button *const sendButton = new Button(_("Send"), "send", this); + Button *const sendButton = new Button(this, _("Send"), "send", this); sendButton->setPosition(400 - sendButton->getWidth(), 170 - sendButton->getHeight()); - Button *const cancelButton = new Button(_("Cancel"), "cancel", this); + Button *const cancelButton = new Button(this, _("Cancel"), "cancel", this); cancelButton->setPosition(sendButton->getX() - (cancelButton->getWidth() + 2), sendButton->getY()); diff --git a/src/gui/okdialog.cpp b/src/gui/okdialog.cpp index cd7fd915d..680cdfbad 100644 --- a/src/gui/okdialog.cpp +++ b/src/gui/okdialog.cpp @@ -47,7 +47,7 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg, mTextBox->setOpaque(false); mTextBox->setTextWrapped(msg, minWidth); - Button *const okButton = new Button(_("OK"), "ok", this); + Button *const okButton = new Button(this, _("OK"), "ok", this); const int numRows = mTextBox->getNumberOfRows(); const int fontHeight = getFont()->getHeight(); diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp index 2984b9139..dfc7dbd94 100644 --- a/src/gui/outfitwindow.cpp +++ b/src/gui/outfitwindow.cpp @@ -58,9 +58,9 @@ float OutfitWindow::mAlpha = 1.0; OutfitWindow::OutfitWindow(): Window(_("Outfits"), false, nullptr, "outfits.xml"), gcn::ActionListener(), - mPreviousButton(new Button(_("<"), "previous", this)), - mNextButton(new Button(_(">"), "next", this)), - mEquipButtom(new Button(_("Equip"), "equip", this)), + 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))), mUnequipCheck(new CheckBox(_("Unequip first"), serverConfig.getValueBool("OutfitUnequip0", true))), diff --git a/src/gui/questswindow.cpp b/src/gui/questswindow.cpp index fe6fdb2b3..3844001a3 100644 --- a/src/gui/questswindow.cpp +++ b/src/gui/questswindow.cpp @@ -97,7 +97,7 @@ QuestsWindow::QuestsWindow() : mText(new BrowserBox(this, BrowserBox::AUTO_WRAP)), mTextScrollArea(new ScrollArea(mText, getOptionBool("showtextbackground"), "quests_text_background.xml")), - mCloseButton(new Button(_("Close"), "close", this)), + mCloseButton(new Button(this, _("Close"), "close", this)), mCompleteIcon(Theme::getImageFromThemeXml("complete_icon.xml", "")), mIncompleteIcon(Theme::getImageFromThemeXml("incomplete_icon.xml", "")) { diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp index 48159657b..184479e57 100644 --- a/src/gui/quitdialog.cpp +++ b/src/gui/quitdialog.cpp @@ -55,8 +55,8 @@ QuitDialog::QuitDialog(QuitDialog **const pointerToMe): mForceQuit(new RadioButton(_("Quit"), "quitdialog")), mSwitchAccountServer(new RadioButton(_("Switch server"), "quitdialog")), mSwitchCharacter(new RadioButton(_("Switch character"), "quitdialog")), - mOkButton(new Button(_("OK"), "ok", this)), - mCancelButton(new Button(_("Cancel"), "cancel", this)), + mOkButton(new Button(this, _("OK"), "ok", this)), + mCancelButton(new Button(this, _("Cancel"), "cancel", this)), mMyPointer(pointerToMe) { addKeyListener(this); diff --git a/src/gui/registerdialog.cpp b/src/gui/registerdialog.cpp index cfbb44a5c..f83f37923 100644 --- a/src/gui/registerdialog.cpp +++ b/src/gui/registerdialog.cpp @@ -70,8 +70,8 @@ RegisterDialog::RegisterDialog(LoginData *const data): mPasswordField(new PasswordField(mLoginData->password)), mConfirmField(new PasswordField), mEmailField(nullptr), - mRegisterButton(new Button(_("Register"), "register", this)), - mCancelButton(new Button(_("Cancel"), "cancel", this)), + mRegisterButton(new Button(this, _("Register"), "register", this)), + mCancelButton(new Button(this, _("Cancel"), "cancel", this)), mMaleButton(nullptr), mFemaleButton(nullptr), mOtherButton(nullptr), diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp index df488e0a0..e9889de91 100644 --- a/src/gui/selldialog.cpp +++ b/src/gui/selldialog.cpp @@ -91,11 +91,11 @@ void SellDialog::init() mMoneyLabel = new Label(strprintf(_("Price: %s / Total: %s"), "", "")); - mIncreaseButton = new Button(_("+"), "inc", this); - mDecreaseButton = new Button(_("-"), "dec", this); - mSellButton = new Button(_("Sell"), "sell", this); - mQuitButton = new Button(_("Quit"), "quit", this); - mAddMaxButton = new Button(_("Max"), "max", this); + mIncreaseButton = new Button(this, _("+"), "inc", this); + mDecreaseButton = new Button(this, _("-"), "dec", this); + mSellButton = new Button(this, _("Sell"), "sell", this); + mQuitButton = new Button(this, _("Quit"), "quit", this); + mAddMaxButton = new Button(this, _("Max"), "max", this); mDecreaseButton->adjustSize(); mDecreaseButton->setWidth(mIncreaseButton->getWidth()); diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 223eb464c..63c03b0a2 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -248,12 +248,12 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo, gcn::KeyListener(), gcn::SelectionListener(), mDescription(new Label(std::string())), - mQuitButton(new Button(_("Quit"), "quit", this)), - mConnectButton(new Button(_("Connect"), "connect", this)), - mAddEntryButton(new Button(_("Add"), "addEntry", this)), - mEditEntryButton(new Button(_("Edit"), "editEntry", this)), - mDeleteButton(new Button(_("Delete"), "remove", this)), - mLoadButton(new Button(_("Load"), "load", this)), + mQuitButton(new Button(this, _("Quit"), "quit", this)), + mConnectButton(new Button(this, _("Connect"), "connect", this)), + mAddEntryButton(new Button(this, _("Add"), "addEntry", this)), + mEditEntryButton(new Button(this, _("Edit"), "editEntry", this)), + mDeleteButton(new Button(this, _("Delete"), "remove", this)), + mLoadButton(new Button(this, _("Load"), "load", this)), mServers(ServerInfos()), mServersListModel(new ServersListModel(&mServers, this)), mServersList(new ServersListBox(this, mServersListModel)), diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index b45fd99b3..91d2bd33f 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -80,7 +80,7 @@ Setup::Setup(): const int buttonPadding = getOption("buttonPadding", 5); for (const char ** curBtn = buttonNames; *curBtn; ++ curBtn) { - Button *const btn = new Button(gettext(*curBtn), *curBtn, this); + Button *const btn = new Button(this, gettext(*curBtn), *curBtn, this); x -= btn->getWidth() + buttonPadding; btn->setPosition(x, height - btn->getHeight() - buttonPadding); add(btn); diff --git a/src/gui/setup_input.cpp b/src/gui/setup_input.cpp index 2ee478ac2..26ff60c1a 100644 --- a/src/gui/setup_input.cpp +++ b/src/gui/setup_input.cpp @@ -94,10 +94,10 @@ Setup_Input::Setup_Input(const Widget2 *const widget) : SetupTab(widget), mKeyListModel(new KeyListModel), mKeyList(new ListBox(this, mKeyListModel)), - mAssignKeyButton(new Button(_("Assign"), "assign", this)), - mUnassignKeyButton(new Button(_("Unassign"), "unassign", this)), - mDefaultButton(new Button(_("Default"), "default", this)), - mResetKeysButton(new Button(_("Reset all keys"), "resetkeys", this)), + mAssignKeyButton(new Button(this, _("Assign"), "assign", this)), + mUnassignKeyButton(new Button(this, _("Unassign"), "unassign", this)), + mDefaultButton(new Button(this, _("Default"), "default", this)), + mResetKeysButton(new Button(this, _("Reset all keys"), "resetkeys", this)), mTabs(new TabStrip(this, config.getIntValue("fontSize") + 10)), mKeySetting(false), mActionDataSize(new int [9]) diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp index d556c20e3..f910ca0af 100644 --- a/src/gui/setup_joystick.cpp +++ b/src/gui/setup_joystick.cpp @@ -44,7 +44,7 @@ extern Joystick *joystick; Setup_Joystick::Setup_Joystick(const Widget2 *const widget) : SetupTab(widget), mCalibrateLabel(new Label(_("Press the button to start calibration"))), - mCalibrateButton(new Button(_("Calibrate"), "calibrate", this)), + mCalibrateButton(new Button(this, _("Calibrate"), "calibrate", this)), mJoystickEnabled(new CheckBox(_("Enable joystick"))), mNamesModel(new NamesModel()), mNamesDropDown(new DropDown(this, mNamesModel)), diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp index 5d5b8beac..a73621933 100644 --- a/src/gui/setup_relations.cpp +++ b/src/gui/setup_relations.cpp @@ -247,7 +247,7 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) : player_relations.getDefault() & PlayerRelation::TRADE)), mDefaultWhisper(new CheckBox(_("Allow whispers"), player_relations.getDefault() & PlayerRelation::WHISPER)), - mDeleteButton(new Button(_("Delete"), ACTION_DELETE, this)) + mDeleteButton(new Button(this, _("Delete"), ACTION_DELETE, this)) { setName(_("Relations")); diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp index d13d12589..13422348d 100644 --- a/src/gui/setup_theme.cpp +++ b/src/gui/setup_theme.cpp @@ -197,7 +197,7 @@ Setup_Theme::Setup_Theme(const Widget2 *const widget) : mNpcFontSize(config.getIntValue("npcfontSize")), mNpcFontSizeDropDown(new DropDown(this, mNpcFontSizeListModel)), // TRANSLATORS: button name with information about selected theme - mInfoButton(new Button(_("i"), ACTION_INFO, this)) + mInfoButton(new Button(this, _("i"), ACTION_INFO, this)) { setName(_("Theme")); diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 736c3daa9..6c28c6e1e 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -241,7 +241,7 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : mFpsLabel(new Label), mAltFpsSlider(new Slider(2, 160)), mAltFpsLabel(new Label(_("Alt FPS limit: "))), - mDetectButton(new Button(_("Detect best mode"), "detect", this)), + mDetectButton(new Button(this, _("Detect best mode"), "detect", this)), mDialog(nullptr) { setName(_("Video")); diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index e61437716..3aab00ea8 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -75,7 +75,7 @@ ShopWindow::ShopWindow(): Window(_("Personal Shop"), false, nullptr, "shop.xml"), gcn::ActionListener(), gcn::SelectionListener(), - mCloseButton(new Button(_("Close"), "close", this)), + mCloseButton(new Button(this, _("Close"), "close", this)), mBuyShopItems(new ShopItems), mSellShopItems(new ShopItems), mBuyShopItemList(new ShopListBox(this, mBuyShopItems, mBuyShopItems)), @@ -86,13 +86,13 @@ ShopWindow::ShopWindow(): getOptionBool("showsellbackground"), "shop_sell_background.xml")), mBuyLabel(new Label(_("Buy items"))), mSellLabel(new Label(_("Sell items"))), - mBuyAddButton(new Button(_("Add"), "add buy", this)), - mBuyDeleteButton(new Button(_("Delete"), "delete buy", this)), - mBuyAnnounceButton(new Button(_("Announce"), "announce buy", this)), + mBuyAddButton(new Button(this, _("Add"), "add buy", this)), + mBuyDeleteButton(new Button(this, _("Delete"), "delete buy", this)), + mBuyAnnounceButton(new Button(this, _("Announce"), "announce buy", this)), mBuyAuctionButton(nullptr), - mSellAddButton(new Button(_("Add"), "add sell", this)), - mSellDeleteButton(new Button(_("Delete"), "delete sell", this)), - mSellAnnounceButton(new Button(_("Announce"), "announce sell", this)), + mSellAddButton(new Button(this, _("Add"), "add sell", this)), + mSellDeleteButton(new Button(this, _("Delete"), "delete sell", this)), + mSellAnnounceButton(new Button(this, _("Announce"), "announce sell", this)), mSellAuctionButton(nullptr), mAnnounceLinks(new CheckBox(_("Show links in announce"), false, this, "link announce")), @@ -146,8 +146,10 @@ ShopWindow::ShopWindow(): if (auctionManager && auctionManager->getEnableAuctionBot()) { - mBuyAuctionButton = new Button(_("Auction"), "auction buy", this); - mSellAuctionButton = new Button(_("Auction"), "auction sell", this); + mBuyAuctionButton = new Button(this, + _("Auction"), "auction buy", this); + mSellAuctionButton = new Button(this, + _("Auction"), "auction sell", this); placer(4, 6, mBuyAuctionButton); placer(12, 6, mSellAuctionButton); } diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index da608b56a..c50ed8761 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -234,8 +234,8 @@ SkillDialog::SkillDialog() : gcn::ActionListener(), mTabs(new TabbedArea(this)), mPointsLabel(new Label("0")), - mUseButton(new Button(_("Use"), "use", this)), - mIncreaseButton(new Button(_("Up"), "inc", this)), + mUseButton(new Button(this, _("Use"), "use", this)), + mIncreaseButton(new Button(this, _("Up"), "inc", this)), mDefaultModel(nullptr) { setWindowName("Skills"); diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index fef935314..29520b5f7 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -1243,9 +1243,9 @@ SocialWindow::SocialWindow() : mFriends(new SocialFriendsTab(this, _("F"), getOptionBool("showtabbackground"))), mCreatePopup(new CreatePopup), - mCreateButton(new Button(_("Create"), "create", this)), - mInviteButton(new Button(_("Invite"), "invite", this)), - mLeaveButton(new Button(_("Leave"), "leave", this)), + mCreateButton(new Button(this, _("Create"), "create", this)), + mInviteButton(new Button(this, _("Invite"), "invite", this)), + mLeaveButton(new Button(this, _("Leave"), "leave", this)), mTabs(new TabbedArea(this)), mMap(nullptr), mLastUpdateTime(0), diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 6dd4c29a2..0b7bd63f4 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -148,7 +148,7 @@ StatusWindow::StatusWindow() : mDAttrScroll(new ScrollArea(mDAttrCont, false)), mCharacterPointsLabel(new Label("C")), mCorrectionPointsLabel(nullptr), - mCopyButton(new Button(_("Copy to chat"), "copy", this)) + mCopyButton(new Button(this, _("Copy to chat"), "copy", this)) { listen(CHANNEL_ATTRIBUTES); @@ -805,7 +805,7 @@ ChangeDisplay::ChangeDisplay(const Widget2 *const widget, mNeeded(1), mPoints(new Label(_("Max"))), mDec(nullptr), - mInc(new Button(_("+"), "inc", this)) + mInc(new Button(this, _("+"), "inc", this)) { // Do the layout ContainerPlacer place = mLayout->getPlacer(0, 0); @@ -817,7 +817,7 @@ ChangeDisplay::ChangeDisplay(const Widget2 *const widget, if (Net::getPlayerHandler()->canCorrectAttributes()) { - mDec = new Button(_("-"), "dec", this); + mDec = new Button(this, _("-"), "dec", this); mDec->setWidth(mInc->getWidth()); place(3, 0, mDec); diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp index 53c638e45..2794a83b4 100644 --- a/src/gui/textcommandeditor.cpp +++ b/src/gui/textcommandeditor.cpp @@ -191,9 +191,9 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : mSchoolDropDown(new DropDown(this, mMagicSchoolModel)), mSchoolLvlLabel(new Label(_("School level:"))), mSchoolLvlField(new IntTextField(0)), - mCancelButton(new Button(_("Cancel"), "cancel", this)), - mSaveButton(new Button(_("Save"), "save", this)), - mDeleteButton(new Button(_("Delete"), "delete", this)), + mCancelButton(new Button(this, _("Cancel"), "cancel", this)), + mSaveButton(new Button(this, _("Save"), "save", this)), + mDeleteButton(new Button(this, _("Delete"), "delete", this)), mEnabledKeyboard(keyboard.isEnabled()) { const int w = 350; diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp index 5a19637e5..e4784d602 100644 --- a/src/gui/textdialog.cpp +++ b/src/gui/textdialog.cpp @@ -42,13 +42,13 @@ TextDialog::TextDialog(const std::string &title, const std::string &msg, gcn::ActionListener(), mTextField(nullptr), mPasswordField(nullptr), - mOkButton(new Button(_("OK"), "OK", this)), + mOkButton(new Button(this, _("OK"), "OK", this)), mEnabledKeyboard(keyboard.isEnabled()) { keyboard.setEnabled(false); Label *const textLabel = new Label(msg); - Button *const cancelButton = new Button(_("Cancel"), "CANCEL", this); + Button *const cancelButton = new Button(this, _("Cancel"), "CANCEL", this); place(0, 0, textLabel, 4); if (isPassword) diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp index fb361d8c0..a34936c0c 100644 --- a/src/gui/tradewindow.cpp +++ b/src/gui/tradewindow.cpp @@ -68,9 +68,9 @@ TradeWindow::TradeWindow(): mMyItemContainer(new ItemContainer(mMyInventory.get())), mPartnerItemContainer(new ItemContainer(mPartnerInventory.get())), mMoneyLabel(new Label(strprintf(_("You get %s"), ""))), - mAddButton(new Button(_("Add"), "add", this)), - mOkButton(new Button("", "", this)), // Will be filled in later - mMoneyChangeButton(new Button(_("Change"), "money", this)), + mAddButton(new Button(this, _("Add"), "add", this)), + mOkButton(new Button(this, "", "", this)), // Will be filled in later + mMoneyChangeButton(new Button(this, _("Change"), "money", this)), mMoneyField(new TextField), mStatus(PROPOSING), mAutoAddItem(nullptr), diff --git a/src/gui/unregisterdialog.cpp b/src/gui/unregisterdialog.cpp index c9f3d9351..10280316a 100644 --- a/src/gui/unregisterdialog.cpp +++ b/src/gui/unregisterdialog.cpp @@ -49,8 +49,8 @@ UnRegisterDialog::UnRegisterDialog(LoginData *const data): gcn::ActionListener(), mLoginData(data), mPasswordField(new PasswordField(mLoginData->password)), - mUnRegisterButton(new Button(_("Unregister"), "unregister", this)), - mCancelButton(new Button(_("Cancel"), "cancel", this)), + mUnRegisterButton(new Button(this, _("Unregister"), "unregister", this)), + mCancelButton(new Button(this, _("Cancel"), "cancel", this)), mWrongDataNoticeListener(new WrongDataNoticeListener) { Label *const userLabel = new Label(strprintf(_("Name: %s"), diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index f53a84cd7..c746bc1ea 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -157,8 +157,8 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost, mLoadUpdates(applyUpdates), mUpdateType(updateType), mLabel(new Label(_("Connecting..."))), - mCancelButton(new Button(_("Cancel"), "cancel", this)), - mPlayButton(new Button(_("Play"), "play", this)), + mCancelButton(new Button(this, _("Cancel"), "cancel", this)), + mPlayButton(new Button(this, _("Play"), "play", this)), mProgressBar(new ProgressBar(0.0, 310, 0)), mBrowserBox(new BrowserBox(this)), mScrollArea(new ScrollArea(mBrowserBox, true, "update_background.xml")), diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index 6a14edd6e..425d5fbd8 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -98,7 +98,7 @@ WhoIsOnline::WhoIsOnline(): setStickyButtonLock(true); setSaveVisible(true); - mUpdateButton = new Button(_("Update"), "update", this); + mUpdateButton = new Button(this, _("Update"), "update", this); mUpdateButton->setEnabled(false); mUpdateButton->setDimension(gcn::Rectangle(5, 5, w - 10, 20 + 5)); diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 9b0f0578f..f157f1096 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -64,9 +64,9 @@ static std::string const data[BUTTON_COUNT] = Skin *Button::button[BUTTON_COUNT]; -Button::Button() : +Button::Button(const Widget2 *const widget) : gcn::Button(), - Widget2(), + Widget2(widget), gcn::WidgetListener(), mDescription(""), mClickCount(0), mTag(0), @@ -86,10 +86,11 @@ Button::Button() : adjustSize(); } -Button::Button(const std::string &caption, const std::string &actionEventId, +Button::Button(const Widget2 *const widget, + const std::string &caption, const std::string &actionEventId, gcn::ActionListener *const listener) : gcn::Button(caption), - Widget2(), + Widget2(widget), gcn::WidgetListener(), mDescription(""), mClickCount(0), @@ -114,12 +115,13 @@ Button::Button(const std::string &caption, const std::string &actionEventId, addActionListener(listener); } -Button::Button(const std::string &caption, const std::string &imageName, +Button::Button(const Widget2 *const widget, + const std::string &caption, const std::string &imageName, const int imageWidth, const int imageHeight, const std::string &actionEventId, gcn::ActionListener *const listener) : gcn::Button(caption), - Widget2(), + Widget2(widget), gcn::WidgetListener(), mDescription(""), mClickCount(0), @@ -145,12 +147,12 @@ Button::Button(const std::string &caption, const std::string &imageName, addActionListener(listener); } -Button::Button(const std::string &imageName, +Button::Button(const Widget2 *const widget, const std::string &imageName, const int imageWidth, const int imageHeight, const std::string &actionEventId, gcn::ActionListener *const listener) : gcn::Button(""), - Widget2(), + Widget2(widget), gcn::WidgetListener(), mDescription(""), mClickCount(0), diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index 3519a5fc7..59fda30e6 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -52,20 +52,22 @@ class Button final : public gcn::Button, /** * Default constructor. */ - Button(); + Button(const Widget2 *const widget); /** * Constructor, sets the caption of the button to the given string and * adds the given action listener. */ - Button(const std::string &caption, const std::string &actionEventId, + Button(const Widget2 *const widget, + const std::string &caption, const std::string &actionEventId, gcn::ActionListener *const listener); /** * Constructor, sets the caption of the button to the given string and * adds the given action listener. */ - Button(const std::string &caption, const std::string &imageName, + Button(const Widget2 *const widget, + const std::string &caption, const std::string &imageName, const int imageWidth, const int imageHeight, const std::string &actionEventId, gcn::ActionListener *const listener); @@ -74,7 +76,7 @@ class Button final : public gcn::Button, * Constructor, sets the caption of the button to the given string and * adds the given action listener. */ - Button(const std::string &imageName, + Button(const Widget2 *const widget, const std::string &imageName, const int imageWidth, const int imageHeight, const std::string &actionEventId, gcn::ActionListener *const listener); diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 3a01e1436..92cc93d6e 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -287,7 +287,7 @@ void SetupItemTextField::createControls() mLabel = new Label(mText); mTextField = new TextField(mValue, true, mParent, mEventName); - mButton = new Button(_("Edit"), mEventName + "_EDIT", mParent); + mButton = new Button(this, _("Edit"), mEventName + "_EDIT", mParent); mWidget = mTextField; mTextField->setWidth(200); fixFirstItemSize(mLabel); @@ -411,7 +411,7 @@ void SetupItemIntTextField::createControls() mTextField->setActionEventId(mEventName); mTextField->addActionListener(mParent); - mButton = new Button(_("Edit"), mEventName + "_EDIT", mParent); + mButton = new Button(this, _("Edit"), mEventName + "_EDIT", mParent); mWidget = mTextField; mTextField->setWidth(50); fixFirstItemSize(mLabel); @@ -1012,7 +1012,8 @@ SetupItemSound::SetupItemSound(std::string text, std::string description, void SetupItemSound::addMoreControls() { - mButton = new Button(BUTTON_PLAY, 16, 16, mEventName + "_PLAY", this); + mButton = new Button(this, BUTTON_PLAY, 16, 16, + mEventName + "_PLAY", this); mHorizont->add(mButton); } diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp index 1a6d97de3..fb94155c1 100644 --- a/src/gui/widgets/sliderlist.cpp +++ b/src/gui/widgets/sliderlist.cpp @@ -56,8 +56,8 @@ SliderList::SliderList(const Widget2 *const widget, setHeight(sliderHeight); - mButtons[0] = new Button("<", mPrevEventId, this); - mButtons[1] = new Button(">", mNextEventId, this); + mButtons[0] = new Button(this, "<", mPrevEventId, this); + mButtons[1] = new Button(this, ">", mNextEventId, this); add(mButtons[0]); add(mLabel); add(mButtons[1]); diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index a25a4e422..d6c73b642 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -64,8 +64,8 @@ TabbedArea::TabbedArea(const Widget2 *const widget) : mWidgetContainer->setOpaque(false); addWidgetListener(this); - mArrowButton[0] = new Button("<", "shift_left", this); - mArrowButton[1] = new Button(">", "shift_right", this); + mArrowButton[0] = new Button(this, "<", "shift_left", this); + mArrowButton[1] = new Button(this, ">", "shift_right", this); widgetResized(nullptr); } diff --git a/src/gui/widgets/tabstrip.cpp b/src/gui/widgets/tabstrip.cpp index 13a4a4ad0..aa8f3d91f 100644 --- a/src/gui/widgets/tabstrip.cpp +++ b/src/gui/widgets/tabstrip.cpp @@ -42,7 +42,7 @@ TabStrip::TabStrip(const Widget2 *const widget, gcn::Widget *TabStrip::createWidget(const std::string &text) { - Button *const widget = new Button(); + Button *const widget = new Button(this); widget->setStick(true); widget->setCaption(text); widget->adjustSize(); diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 70b05bcbc..e4cbbd75b 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -233,7 +233,7 @@ void WindowMenu::addButton(const char *const text, const std::string &description, int &x, int &h, const int key, const bool visible) { - Button *const btn = new Button(gettext(text), text, this); + Button *const btn = new Button(this, gettext(text), text, this); btn->setPosition(x, 0); btn->setDescription(description); btn->setTag(key); diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp index babb06fa1..3623fb3cc 100644 --- a/src/gui/worldselectdialog.cpp +++ b/src/gui/worldselectdialog.cpp @@ -82,8 +82,8 @@ WorldSelectDialog::WorldSelectDialog(Worlds worlds): gcn::KeyListener(), mWorldListModel(new WorldListModel(worlds)), mWorldList(new ListBox(this, mWorldListModel)), - mChangeLoginButton(new Button(_("Change Login"), "login", this)), - mChooseWorld(new Button(_("Choose World"), "world", this)) + mChangeLoginButton(new Button(this, _("Change Login"), "login", this)), + mChooseWorld(new Button(this, _("Choose World"), "world", this)) { ScrollArea *const worldsScroll = new ScrollArea(mWorldList, getOptionBool("showbackground"), "world_background.xml"); |