From c25141f02a5b3dcddcc93ca5d2bd2fcdad5efb31 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 6 May 2015 18:37:06 +0300 Subject: Add strong typed bool type Enable. --- src/gui/widgets/inttextfield.cpp | 4 ++-- src/gui/widgets/inttextfield.h | 4 +++- src/gui/widgets/setupitem.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/gui') diff --git a/src/gui/widgets/inttextfield.cpp b/src/gui/widgets/inttextfield.cpp index d198fa9b8..094f2e50c 100644 --- a/src/gui/widgets/inttextfield.cpp +++ b/src/gui/widgets/inttextfield.cpp @@ -35,7 +35,7 @@ IntTextField::IntTextField(const Widget2 *const widget, const int def, const int min, const int max, - const bool enabled, + const Enable enabled, const int width) : TextField(widget, toString(def)), mMin(0), @@ -46,7 +46,7 @@ IntTextField::IntTextField(const Widget2 *const widget, if (min != 0 || max != 0) setRange(min, max); - setEnabled(enabled); + setEnabled(enabled == Enable_true); if (width != 0) setWidth(width); } diff --git a/src/gui/widgets/inttextfield.h b/src/gui/widgets/inttextfield.h index 979f3a886..04f34b393 100644 --- a/src/gui/widgets/inttextfield.h +++ b/src/gui/widgets/inttextfield.h @@ -23,6 +23,8 @@ #ifndef GUI_WIDGETS_INTTEXTFIELD_H #define GUI_WIDGETS_INTTEXTFIELD_H +#include "enums/simpletypes.h" + #include "gui/widgets/textfield.h" /** @@ -38,7 +40,7 @@ class IntTextField final : public TextField const int def = 0, const int min = 0, const int max = 0, - const bool enabled = true, + const Enable enabled = Enable_true, const int width = 0); A_DELETE_COPY(IntTextField) diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 6cb807ab5..b02f2b9ba 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -496,7 +496,7 @@ void SetupItemIntTextField::createControls() mLabel = new Label(this, mText); mLabel->setToolTip(mDescription); mTextField = new IntTextField(this, atoi(mValue.c_str()), - mMin, mMax, true, 30); + mMin, mMax, Enable_true, 30); mTextField->setActionEventId(mEventName); mTextField->addActionListener(mParent); -- cgit v1.2.3-70-g09d2