summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-20 01:45:57 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-20 13:55:43 +0300
commitf5f77f16d8c0dc23ffaf4c6a8590e4c026bfcfc8 (patch)
tree8ab383dce47ed689137addbac041ef1f9e300faf /src/gui/widgets
parent5d02ab43ff6d3e328a3b02479c033609023edec2 (diff)
downloadmanaplus-f5f77f16d8c0dc23ffaf4c6a8590e4c026bfcfc8.tar.gz
manaplus-f5f77f16d8c0dc23ffaf4c6a8590e4c026bfcfc8.tar.bz2
manaplus-f5f77f16d8c0dc23ffaf4c6a8590e4c026bfcfc8.tar.xz
manaplus-f5f77f16d8c0dc23ffaf4c6a8590e4c026bfcfc8.zip
Add palette inheritance to textfield class.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/inttextfield.cpp5
-rw-r--r--src/gui/widgets/inttextfield.h3
-rw-r--r--src/gui/widgets/passwordfield.cpp5
-rw-r--r--src/gui/widgets/passwordfield.h3
-rw-r--r--src/gui/widgets/setupitem.cpp5
-rw-r--r--src/gui/widgets/textfield.cpp5
-rw-r--r--src/gui/widgets/textfield.h3
7 files changed, 18 insertions, 11 deletions
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 = "",