diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-20 01:45:57 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-20 13:55:43 +0300 |
commit | f5f77f16d8c0dc23ffaf4c6a8590e4c026bfcfc8 (patch) | |
tree | 8ab383dce47ed689137addbac041ef1f9e300faf /src/gui | |
parent | 5d02ab43ff6d3e328a3b02479c033609023edec2 (diff) | |
download | mv-f5f77f16d8c0dc23ffaf4c6a8590e4c026bfcfc8.tar.gz mv-f5f77f16d8c0dc23ffaf4c6a8590e4c026bfcfc8.tar.bz2 mv-f5f77f16d8c0dc23ffaf4c6a8590e4c026bfcfc8.tar.xz mv-f5f77f16d8c0dc23ffaf4c6a8590e4c026bfcfc8.zip |
Add palette inheritance to textfield class.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/buydialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/changeemaildialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/changepassworddialog.cpp | 6 | ||||
-rw-r--r-- | src/gui/charcreatedialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/chatwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/editdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/editserverdialog.cpp | 8 | ||||
-rw-r--r-- | src/gui/inventorywindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/itemamountwindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/logindialog.cpp | 6 | ||||
-rw-r--r-- | src/gui/npcdialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/npcpostdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/registerdialog.cpp | 8 | ||||
-rw-r--r-- | src/gui/setup_colors.cpp | 8 | ||||
-rw-r--r-- | src/gui/textcommandeditor.cpp | 12 | ||||
-rw-r--r-- | src/gui/textdialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/tradewindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/unregisterdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/inttextfield.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/inttextfield.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/passwordfield.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/passwordfield.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/setupitem.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/textfield.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/textfield.h | 3 |
25 files changed, 59 insertions, 52 deletions
diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp index 515ffafd6..94305c9a0 100644 --- a/src/gui/buydialog.cpp +++ b/src/gui/buydialog.cpp @@ -90,7 +90,7 @@ void BuyDialog::init() mQuantityLabel->setAlignment(gcn::Graphics::CENTER); mMoneyLabel = new Label(strprintf(_("Price: %s / Total: %s"), "", "")); - mAmountField = new IntTextField(1, 1, 123); + mAmountField = new IntTextField(this, 1, 1, 123); mAmountField->setActionEventId("amount"); mAmountField->addActionListener(this); mAmountField->setSendAlwaysEvents(true); diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp index 51b108865..7026077e8 100644 --- a/src/gui/changeemaildialog.cpp +++ b/src/gui/changeemaildialog.cpp @@ -46,8 +46,8 @@ ChangeEmailDialog::ChangeEmailDialog(LoginData *const data): Window(_("Change Email Address"), true, nullptr, "changeemail.xml"), gcn::ActionListener(), - mFirstEmailField(new TextField), - mSecondEmailField(new TextField), + mFirstEmailField(new TextField(this)), + mSecondEmailField(new TextField(this)), mChangeEmailButton(new Button(this, _("Change Email Address"), "change_email", this)), mCancelButton(new Button(this, _("Cancel"), "cancel", this)), diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp index 33f0ff561..a7cb8a834 100644 --- a/src/gui/changepassworddialog.cpp +++ b/src/gui/changepassworddialog.cpp @@ -47,9 +47,9 @@ ChangePasswordDialog::ChangePasswordDialog(LoginData *const data): Window(_("Change Password"), true, nullptr, "changepassword.xml"), gcn::ActionListener(), - mOldPassField(new PasswordField), - mFirstPassField(new PasswordField), - mSecondPassField(new PasswordField), + mOldPassField(new PasswordField(this)), + mFirstPassField(new PasswordField(this)), + mSecondPassField(new PasswordField(this)), mChangePassButton(new Button(this, _("Change Password"), "change_password", this)), mCancelButton(new Button(this, _("Cancel"), "cancel", this)), diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 049eac714..885a58497 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -70,7 +70,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, gcn::ActionListener(), gcn::KeyListener(), mCharSelectDialog(parent), - mNameField(new TextField("")), + mNameField(new TextField(this, "")), mNameLabel(new Label(_("Name:"))), // TRANSLATORS: This is a narrow symbol used to denote 'next'. // You may change this symbol if your language uses another. diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 5da35efaf..2959b27fd 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -77,7 +77,7 @@ class ChatInput final : public TextField, public gcn::FocusListener { public: ChatInput(ChatWindow *const window, TabbedArea *const tabs): - TextField("", false), + TextField(window, "", false), gcn::FocusListener(), mWindow(window), mChatTabs(tabs) diff --git a/src/gui/editdialog.cpp b/src/gui/editdialog.cpp index a022988e5..94546becb 100644 --- a/src/gui/editdialog.cpp +++ b/src/gui/editdialog.cpp @@ -37,7 +37,7 @@ EditDialog::EditDialog(const std::string &title, const std::string &msg, Window *const parent, const bool modal): Window(title, modal, parent, "edit.xml"), gcn::ActionListener(), - mTextField(new TextField) + mTextField(new TextField(this)) { mTextField->setText(msg); mEventOk = eventOk; diff --git a/src/gui/editserverdialog.cpp b/src/gui/editserverdialog.cpp index 41d0bf546..907a706b8 100644 --- a/src/gui/editserverdialog.cpp +++ b/src/gui/editserverdialog.cpp @@ -66,10 +66,10 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, Window(_("Edit Server"), true, parent), gcn::ActionListener(), gcn::KeyListener(), - mServerAddressField(new TextField(std::string())), - mPortField(new TextField(std::string())), - mNameField(new TextField(std::string())), - mDescriptionField(new TextField(std::string())), + mServerAddressField(new TextField(this, std::string())), + mPortField(new TextField(this, std::string())), + mNameField(new TextField(this, std::string())), + mDescriptionField(new TextField(this, std::string())), mConnectButton(new Button(this, _("Connect"), "connect", this)), mOkButton(new Button(this, _("OK"), "addServer", this)), mCancelButton(new Button(this, _("Cancel"), "cancel", this)), diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index ba4180914..1844ab39c 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -110,7 +110,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory): mFilter(nullptr), mSortModel(new SortListModel()), mSortDropDown(new DropDown(this, mSortModel, this, "sort")), - mNameFilter(new TextField("", true, this, "namefilter", true)), + mNameFilter(new TextField(this, "", true, this, "namefilter", true)), mSortDropDownCell(nullptr), mNameFilterCell(nullptr), mFilterCell(nullptr), diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp index a11740f5b..5e29f130c 100644 --- a/src/gui/itemamountwindow.cpp +++ b/src/gui/itemamountwindow.cpp @@ -140,11 +140,11 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent, Window("", true, parent, "amount.xml"), gcn::ActionListener(), gcn::KeyListener(), - mItemAmountTextField(new IntTextField(1)), + mItemAmountTextField(new IntTextField(this, 1)), mItemPriceTextField(nullptr), mGPLabel(nullptr), mItem(item), - mItemIcon(new Icon(this, item ? item->getImage() : 0)), + mItemIcon(new Icon(this, item ? item->getImage() : nullptr)), mMax(maxRange), mUsage(usage), mItemPopup(new ItemPopup), @@ -181,7 +181,7 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent, if (mUsage == ShopBuyAdd || mUsage == ShopSellAdd) { // Integer field - mItemPriceTextField = new IntTextField(1); + mItemPriceTextField = new IntTextField(this, 1); mItemPriceTextField->setRange(1, 10000000); mItemPriceTextField->setWidth(35); mItemPriceTextField->addKeyListener(this); diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp index a1db2a953..b16082485 100644 --- a/src/gui/logindialog.cpp +++ b/src/gui/logindialog.cpp @@ -120,8 +120,8 @@ LoginDialog::LoginDialog(LoginData *const data, std::string serverName, gcn::ActionListener(), gcn::KeyListener(), mLoginData(data), - mUserField(new TextField(mLoginData->username)), - mPassField(new PasswordField(mLoginData->password)), + mUserField(new TextField(this, mLoginData->username)), + mPassField(new PasswordField(this, mLoginData->password)), mKeepCheck(new CheckBox(this, _("Remember username"), mLoginData->remember)), mUpdateTypeLabel(new Label(_("Update:"))), @@ -133,7 +133,7 @@ LoginDialog::LoginDialog(LoginData *const data, std::string serverName, mRegisterButton(new Button(this, _("Register"), "register", this)), mCustomUpdateHost(new CheckBox(this, _("Custom update host"), mLoginData->updateType & LoginData::Upd_Custom, this, "customhost")), - mUpdateHostText(new TextField(serverConfig.getValue( + mUpdateHostText(new TextField(this, serverConfig.getValue( "customUpdateHost", ""))), mUpdateListModel(nullptr), mUpdateHostDropDown(nullptr), diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 6970babfb..ab05a3b49 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -73,8 +73,8 @@ NpcDialog::NpcDialog(const int npcId) : mListScrollArea(new ScrollArea(mItemList, getOptionBool("showlistbackground"), "npc_listbackground.xml")), mItemLinkHandler(new ItemLinkHandler), - mTextField(new TextField("")), - mIntField(new IntTextField), + mTextField(new TextField(this, "")), + mIntField(new IntTextField(this)), mPlusButton(new Button(this, _("+"), "inc", this)), mMinusButton(new Button(this, _("-"), "dec", this)), mClearButton(new Button(this, _("Clear"), "clear", this)), diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp index a7c9abf0b..0a78ef61c 100644 --- a/src/gui/npcpostdialog.cpp +++ b/src/gui/npcpostdialog.cpp @@ -43,7 +43,7 @@ NpcPostDialog::NpcPostDialog(const int npcId): gcn::ActionListener(), mNpcId(npcId), mText(new TextBox), - mSender(new TextField) + mSender(new TextField(this)) { setContentSize(400, 180); diff --git a/src/gui/registerdialog.cpp b/src/gui/registerdialog.cpp index f83f37923..d48e2f2c0 100644 --- a/src/gui/registerdialog.cpp +++ b/src/gui/registerdialog.cpp @@ -66,9 +66,9 @@ RegisterDialog::RegisterDialog(LoginData *const data): gcn::ActionListener(), gcn::KeyListener(), mLoginData(data), - mUserField(new TextField(mLoginData->username)), - mPasswordField(new PasswordField(mLoginData->password)), - mConfirmField(new PasswordField), + mUserField(new TextField(this, mLoginData->username)), + mPasswordField(new PasswordField(this, mLoginData->password)), + mConfirmField(new PasswordField(this)), mEmailField(nullptr), mRegisterButton(new Button(this, _("Register"), "register", this)), mCancelButton(new Button(this, _("Cancel"), "cancel", this)), @@ -119,7 +119,7 @@ RegisterDialog::RegisterDialog(LoginData *const data): if (optionalActions & Net::LoginHandler::SetEmailOnRegister) { Label *const emailLabel = new Label(_("Email:")); - mEmailField = new TextField; + mEmailField = new TextField(this); placer(0, row, emailLabel); placer(1, row, mEmailField, 3).setPadding(2); diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp index abeb96252..4e93fbb0c 100644 --- a/src/gui/setup_colors.cpp +++ b/src/gui/setup_colors.cpp @@ -63,18 +63,18 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) : mGradTypeText(new Label), mGradDelayLabel(new Label(_("Delay:"))), mGradDelaySlider(new Slider(20, 100)), - mGradDelayText(new TextField()), + mGradDelayText(new TextField(this)), mRedLabel(new Label(_("Red:"))), mRedSlider(new Slider(0, 255)), - mRedText(new TextField), + mRedText(new TextField(this)), mRedValue(0), mGreenLabel(new Label(_("Green:"))), mGreenSlider(new Slider(0, 255)), - mGreenText(new TextField), + mGreenText(new TextField(this)), mGreenValue(0), mBlueLabel(new Label(_("Blue:"))), mBlueSlider(new Slider(0, 255)), - mBlueText(new TextField), + mBlueText(new TextField(this)), mBlueValue(0) { setName(_("Colors")); diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp index 2794a83b4..05ad61a5c 100644 --- a/src/gui/textcommandeditor.cpp +++ b/src/gui/textcommandeditor.cpp @@ -171,11 +171,11 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : mIsMagic(new RadioButton(_("magic"), "magic", mIsMagicCommand)), mIsOther(new RadioButton(_("other"), "magic", !mIsMagicCommand)), mSymbolLabel(new Label(_("Symbol:"))), - mSymbolTextField(new TextField()), + mSymbolTextField(new TextField(this)), mCommandLabel(new Label(_("Command:"))), - mCommandTextField(new TextField()), + mCommandTextField(new TextField(this)), mCommentLabel(new Label(_("Comment:"))), - mCommentTextField(new TextField), + mCommentTextField(new TextField(this)), mTargetTypeModel(new TargetTypeModel), mTypeLabel(new Label(_("Target Type:"))), mTypeDropDown(new DropDown(this, mTargetTypeModel)), @@ -183,14 +183,14 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : mIconLabel(new Label(_("Icon:"))), mIconDropDown(new DropDown(this, mIconsModal)), mManaLabel(new Label(_("Mana:"))), - mManaField(new IntTextField(0)), + mManaField(new IntTextField(this, 0)), mMagicLvlLabel(new Label(_("Magic level:"))), - mMagicLvlField(new IntTextField(0)), + mMagicLvlField(new IntTextField(this, 0)), mMagicSchoolModel(new MagicSchoolModel), mSchoolLabel(new Label(_("Magic School:"))), mSchoolDropDown(new DropDown(this, mMagicSchoolModel)), mSchoolLvlLabel(new Label(_("School level:"))), - mSchoolLvlField(new IntTextField(0)), + mSchoolLvlField(new IntTextField(this, 0)), mCancelButton(new Button(this, _("Cancel"), "cancel", this)), mSaveButton(new Button(this, _("Save"), "save", this)), mDeleteButton(new Button(this, _("Delete"), "delete", this)), diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp index e4784d602..88160e9aa 100644 --- a/src/gui/textdialog.cpp +++ b/src/gui/textdialog.cpp @@ -53,12 +53,12 @@ TextDialog::TextDialog(const std::string &title, const std::string &msg, place(0, 0, textLabel, 4); if (isPassword) { - mPasswordField = new PasswordField; + mPasswordField = new PasswordField(this); place(0, 1, mPasswordField, 4); } else { - mTextField = new TextField; + mTextField = new TextField(this); place(0, 1, mTextField, 4); } place(2, 2, mOkButton); diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp index a34936c0c..a9083abaf 100644 --- a/src/gui/tradewindow.cpp +++ b/src/gui/tradewindow.cpp @@ -71,7 +71,7 @@ TradeWindow::TradeWindow(): 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), + mMoneyField(new TextField(this)), mStatus(PROPOSING), mAutoAddItem(nullptr), mAutoAddToNick(""), diff --git a/src/gui/unregisterdialog.cpp b/src/gui/unregisterdialog.cpp index 10280316a..081b846c3 100644 --- a/src/gui/unregisterdialog.cpp +++ b/src/gui/unregisterdialog.cpp @@ -48,7 +48,7 @@ UnRegisterDialog::UnRegisterDialog(LoginData *const data): Window(_("Unregister"), true, nullptr, "unregister.xml"), gcn::ActionListener(), mLoginData(data), - mPasswordField(new PasswordField(mLoginData->password)), + mPasswordField(new PasswordField(this, mLoginData->password)), mUnRegisterButton(new Button(this, _("Unregister"), "unregister", this)), mCancelButton(new Button(this, _("Cancel"), "cancel", this)), mWrongDataNoticeListener(new WrongDataNoticeListener) diff --git a/src/gui/widgets/inttextfield.cpp b/src/gui/widgets/inttextfield.cpp index d8612cc96..eb04a65aa 100644 --- a/src/gui/widgets/inttextfield.cpp +++ b/src/gui/widgets/inttextfield.cpp @@ -31,9 +31,10 @@ #include "debug.h" -IntTextField::IntTextField(const int def, const int min, const int max, +IntTextField::IntTextField(const Widget2 *const widget, const int def, + const int min, const int max, const bool enabled, const int width) : - TextField(toString(def)), + TextField(widget, toString(def)), mMin(0), mMax(0), mDefault(def), diff --git a/src/gui/widgets/inttextfield.h b/src/gui/widgets/inttextfield.h index d2191433e..1435fcccd 100644 --- a/src/gui/widgets/inttextfield.h +++ b/src/gui/widgets/inttextfield.h @@ -34,7 +34,8 @@ class IntTextField final : public TextField /** * Constructor, sets default value. */ - IntTextField(const int def = 0, const int min = 0, const int max = 0, + IntTextField(const Widget2 *const widget, const int def = 0, + const int min = 0, const int max = 0, const bool enabled = true, const int width = 0); A_DELETE_COPY(IntTextField) diff --git a/src/gui/widgets/passwordfield.cpp b/src/gui/widgets/passwordfield.cpp index a976f440e..f0dd0f256 100644 --- a/src/gui/widgets/passwordfield.cpp +++ b/src/gui/widgets/passwordfield.cpp @@ -24,8 +24,9 @@ #include "debug.h" -PasswordField::PasswordField(const std::string &text): - TextField(text) +PasswordField::PasswordField(const Widget2 *const widget, + const std::string &text): + TextField(widget, text) { } diff --git a/src/gui/widgets/passwordfield.h b/src/gui/widgets/passwordfield.h index 55b884b4f..69aaa32fc 100644 --- a/src/gui/widgets/passwordfield.h +++ b/src/gui/widgets/passwordfield.h @@ -36,7 +36,8 @@ class PasswordField final : public TextField /** * Constructor, initializes the password field with the given string. */ - PasswordField(const std::string &text = ""); + PasswordField(const Widget2 *const widget, + const std::string &text = ""); A_DELETE_COPY(PasswordField) diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 937ce79d2..75090fd0d 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -286,7 +286,7 @@ void SetupItemTextField::createControls() mHorizont = new HorizontContainer(this, 32, 2); mLabel = new Label(mText); - mTextField = new TextField(mValue, true, mParent, mEventName); + mTextField = new TextField(this, mValue, true, mParent, mEventName); mButton = new Button(this, _("Edit"), mEventName + "_EDIT", mParent); mWidget = mTextField; mTextField->setWidth(200); @@ -407,7 +407,8 @@ void SetupItemIntTextField::createControls() mHorizont = new HorizontContainer(this, 32, 2); mLabel = new Label(mText); - mTextField = new IntTextField(atoi(mValue.c_str()), mMin, mMax, true, 30); + mTextField = new IntTextField(this, atoi(mValue.c_str()), + mMin, mMax, true, 30); mTextField->setActionEventId(mEventName); mTextField->addActionListener(mParent); diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 6c11d2e17..e8a57067b 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -47,11 +47,12 @@ int TextField::instances = 0; float TextField::mAlpha = 1.0; ImageRect TextField::skin; -TextField::TextField(const std::string &text, const bool loseFocusOnTab, +TextField::TextField(const Widget2 *const widget, + const std::string &text, const bool loseFocusOnTab, gcn::ActionListener *const listener, std::string eventId, const bool sendAlwaysEvents): gcn::TextField(text), - Widget2(), + Widget2(widget), mSendAlwaysEvents(sendAlwaysEvents), mNumeric(false), mMinimum(0), diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index 713895da4..f5f6a3eb9 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -44,7 +44,8 @@ class TextField : public gcn::TextField, /** * Constructor, initializes the text field with the given string. */ - TextField(const std::string &text = "", + TextField(const Widget2 *const widget, + const std::string &text = "", const bool loseFocusOnTab = true, gcn::ActionListener *const listener = nullptr, std::string eventId = "", |