summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-17 19:34:34 +0300
committerAndrei Karas <akaras@inbox.ru>2016-09-17 19:34:34 +0300
commit40ddc72b737a1040f5adab239f68e1fbc32c6a70 (patch)
treea9fa49c7eda5227b5dbb170f7be2586ff35f9943 /src/gui/widgets
parente9fb9da5bf17d3402781eb5205be7d2f794887ee (diff)
downloadManaVerse-40ddc72b737a1040f5adab239f68e1fbc32c6a70.tar.gz
ManaVerse-40ddc72b737a1040f5adab239f68e1fbc32c6a70.tar.bz2
ManaVerse-40ddc72b737a1040f5adab239f68e1fbc32c6a70.tar.xz
ManaVerse-40ddc72b737a1040f5adab239f68e1fbc32c6a70.zip
Add strong typed bool LoseFocusOnTab.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/chatinput.h2
-rw-r--r--src/gui/widgets/setupitem.cpp6
-rw-r--r--src/gui/widgets/textfield.cpp4
-rw-r--r--src/gui/widgets/textfield.h7
4 files changed, 13 insertions, 6 deletions
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;