diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/enums/simpletypes/losefocusontab.h | 33 | ||||
-rw-r--r-- | src/gui/widgets/chatinput.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/setupitem.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/textfield.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/textfield.h | 7 | ||||
-rw-r--r-- | src/gui/windows/buydialog.cpp | 12 | ||||
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 3 |
9 files changed, 58 insertions, 11 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8a7757c7f..64677c3b0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1254,6 +1254,7 @@ SET(SRCS enums/simpletypes/isstart.h enums/simpletypes/itemcolor.h enums/simpletypes/keep.h + enums/simpletypes/losefocusontab.h enums/simpletypes/mainconfig.h enums/simpletypes/modal.h enums/simpletypes/modifiable.h diff --git a/src/Makefile.am b/src/Makefile.am index 3a8b8172f..3c5a51275 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -695,6 +695,7 @@ SRC += events/actionevent.h \ enums/simpletypes/isstart.h \ enums/simpletypes/itemcolor.h \ enums/simpletypes/keep.h \ + enums/simpletypes/losefocusontab.h \ enums/simpletypes/mainconfig.h \ enums/simpletypes/modal.h \ enums/simpletypes/modifiable.h \ diff --git a/src/enums/simpletypes/losefocusontab.h b/src/enums/simpletypes/losefocusontab.h new file mode 100644 index 000000000..4a6126b10 --- /dev/null +++ b/src/enums/simpletypes/losefocusontab.h @@ -0,0 +1,33 @@ +/* + * The ManaPlus Client + * Copyright (C) 2015-2016 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef ENUMS_SIMPLETYPES_LOSEFOCUSONTAB_H +#define ENUMS_SIMPLETYPES_LOSEFOCUSONTAB_H + +#include "enums/simpletypes/booldefines.h" + +PRAGMA6(GCC diagnostic push) +PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") + +defBoolEnum(LoseFocusOnTab); + +PRAGMA6(GCC diagnostic pop) + +#endif // ENUMS_SIMPLETYPES_LOSEFOCUSONTAB_H diff --git a/src/gui/widgets/chatinput.h b/src/gui/widgets/chatinput.h index 0c6bb8586..1c5f36858 100644 --- a/src/gui/widgets/chatinput.h +++ b/src/gui/widgets/chatinput.h @@ -40,7 +40,7 @@ class ChatInput final : public TextField { public: explicit ChatInput(ChatWindow *const window) : - TextField(window, "", false), + TextField(window, "", LoseFocusOnTab_false), mWindow(window), mFocusGaining(false) { diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 511ab90ab..2926121af 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -365,7 +365,11 @@ void SetupItemTextField::createControls() mLabel = new Label(this, mText); mLabel->setToolTip(mDescription); - mTextField = new TextField(this, mValue, true, mParent, mEventName); + mTextField = new TextField(this, + mValue, + LoseFocusOnTab_true, + mParent, + mEventName); // TRANSLATORS: setup item button mButton = new Button(this, _("Edit"), mEventName + "_EDIT", mParent); mWidget = mTextField; diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index f4c6f11b6..b80e21eeb 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -107,7 +107,7 @@ ImageRect TextField::skin; TextField::TextField(const Widget2 *restrict const widget, const std::string &restrict text, - const bool loseFocusOnTab, + const LoseFocusOnTab loseFocusOnTab, ActionListener *restrict const listener, const std::string &restrict eventId, const bool sendAlwaysEvents) : @@ -475,7 +475,7 @@ bool TextField::handleNormalKeys(const InputActionT action, bool &consumed) break; case InputAction::GUI_TAB: - if (mLoseFocusOnTab) + if (mLoseFocusOnTab == LoseFocusOnTab_true) return false; consumed = true; break; diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index aa016ef04..e5173b3f1 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -71,6 +71,8 @@ #include "listeners/mouselistener.h" #include "listeners/widgetlistener.h" +#include "enums/simpletypes/losefocusontab.h" + #include "gui/fonts/textchunk.h" #include "gui/widgets/widget.h" @@ -94,7 +96,8 @@ class TextField notfinal : public Widget, */ explicit TextField(const Widget2 *restrict const widget, const std::string &restrict text = "", - const bool loseFocusOnTab = true, + const LoseFocusOnTab loseFocusOnTab = + LoseFocusOnTab_true, ActionListener *restrict const listener = nullptr, const std::string &restrict eventId = "", @@ -280,7 +283,7 @@ class TextField notfinal : public Widget, time_t mLastEventPaste; int mPadding; bool mNumeric; - bool mLoseFocusOnTab; + LoseFocusOnTab mLoseFocusOnTab; bool mAllowSpecialActions; bool mSendAlwaysEvents; bool mTextChanged; diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index a85db2af4..ec321a15f 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -176,7 +176,8 @@ BuyDialog::BuyDialog() : SelectionListener(), mSortModel(nullptr), mSortDropDown(nullptr), - mFilterTextField(new TextField(this, "", true, this, "namefilter", true)), + mFilterTextField(new TextField(this, "", LoseFocusOnTab_true, + this, "namefilter", true)), mFilterLabel(nullptr), mNick(), mNpcId(fromInt(Items, BeingId)), @@ -195,7 +196,8 @@ BuyDialog::BuyDialog(const BeingId npcId) : SelectionListener(), mSortModel(nullptr), mSortDropDown(nullptr), - mFilterTextField(new TextField(this, "", true, this, "namefilter", true)), + mFilterTextField(new TextField(this, "", LoseFocusOnTab_true, + this, "namefilter", true)), mFilterLabel(nullptr), mNick(), mNpcId(npcId), @@ -216,7 +218,8 @@ BuyDialog::BuyDialog(std::string nick) : mSortModel(new SortListModelBuy), mSortDropDown(new DropDown(this, mSortModel, false, Modal_false, this, "sort")), - mFilterTextField(new TextField(this, "", true, this, "namefilter", true)), + mFilterTextField(new TextField(this, "", LoseFocusOnTab_true, + this, "namefilter", true)), mFilterLabel(nullptr), mNick(nick), mNpcId(fromInt(Nick, BeingId)), @@ -237,7 +240,8 @@ BuyDialog::BuyDialog(const Being *const being) : mSortModel(new SortListModelBuy), mSortDropDown(new DropDown(this, mSortModel, false, Modal_false, this, "sort")), - mFilterTextField(new TextField(this, "", true, this, "namefilter", true)), + mFilterTextField(new TextField(this, "", LoseFocusOnTab_true, + this, "namefilter", true)), mFilterLabel(nullptr), mNick(being ? being->getName() : std::string()), mNpcId(fromInt(Vending, BeingId)), diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index fe096971d..4f855e442 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -102,7 +102,8 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : mSortModel(new SortListModelInv), mSortDropDown(new DropDown(this, mSortModel, false, Modal_false, this, "sort")), - mNameFilter(new TextField(this, "", true, this, "namefilter", true)), + mNameFilter(new TextField(this, "", LoseFocusOnTab_true, + this, "namefilter", true)), mSortDropDownCell(nullptr), mNameFilterCell(nullptr), mFilterCell(nullptr), |