summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-20 02:23:16 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-20 13:55:43 +0300
commit0153e8fa499b7bbdd712339bfb3921ead15a37a2 (patch)
tree0e12bc130aa40d3bc41f86e16754f060b450977e /src/gui/widgets
parent4c7a11b639ec94c8a32a9a52e99652c464745037 (diff)
downloadmanaverse-0153e8fa499b7bbdd712339bfb3921ead15a37a2.tar.gz
manaverse-0153e8fa499b7bbdd712339bfb3921ead15a37a2.tar.bz2
manaverse-0153e8fa499b7bbdd712339bfb3921ead15a37a2.tar.xz
manaverse-0153e8fa499b7bbdd712339bfb3921ead15a37a2.zip
Add palette inheritance to label class.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/desktop.cpp4
-rw-r--r--src/gui/widgets/label.cpp6
-rw-r--r--src/gui/widgets/label.h4
-rw-r--r--src/gui/widgets/setupitem.cpp18
-rw-r--r--src/gui/widgets/sliderlist.cpp2
-rw-r--r--src/gui/widgets/tab.cpp2
6 files changed, 19 insertions, 17 deletions
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index fca9d9ff9..65c7eda77 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -53,11 +53,11 @@ Desktop::Desktop(const Widget2 *const widget) :
if (appName.empty())
{
- mVersionLabel = new Label(FULL_VERSION);
+ mVersionLabel = new Label(this, FULL_VERSION);
}
else
{
- mVersionLabel = new Label(strprintf("%s (%s)", FULL_VERSION,
+ mVersionLabel = new Label(this, strprintf("%s (%s)", FULL_VERSION,
appName.c_str()));
}
diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp
index 63a3f6b76..e7481e992 100644
--- a/src/gui/widgets/label.cpp
+++ b/src/gui/widgets/label.cpp
@@ -30,15 +30,17 @@
Skin *Label::mSkin = nullptr;
int Label::mInstances = 0;
-Label::Label() :
+Label::Label(const Widget2 *const widget) :
gcn::Label(),
+ Widget2(widget),
mPadding(0)
{
init();
}
-Label::Label(const std::string &caption) :
+Label::Label(const Widget2 *const widget, const std::string &caption) :
gcn::Label(caption),
+ Widget2(widget),
mPadding(0)
{
init();
diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h
index d249bdf54..4ea7ca3e3 100644
--- a/src/gui/widgets/label.h
+++ b/src/gui/widgets/label.h
@@ -42,13 +42,13 @@ class Label final : public gcn::Label, public Widget2
/**
* Constructor.
*/
- Label();
+ Label(const Widget2 *const widget);
/**
* Constructor. This version of the constructor sets the label with an
* inintialization string.
*/
- Label(const std::string &caption);
+ Label(const Widget2 *const widget, const std::string &caption);
A_DELETE_COPY(Label)
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index 75090fd0d..27ec95b7a 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -285,7 +285,7 @@ void SetupItemTextField::createControls()
load();
mHorizont = new HorizontContainer(this, 32, 2);
- mLabel = new Label(mText);
+ mLabel = new Label(this, mText);
mTextField = new TextField(this, mValue, true, mParent, mEventName);
mButton = new Button(this, _("Edit"), mEventName + "_EDIT", mParent);
mWidget = mTextField;
@@ -406,7 +406,7 @@ void SetupItemIntTextField::createControls()
load();
mHorizont = new HorizontContainer(this, 32, 2);
- mLabel = new Label(mText);
+ mLabel = new Label(this, mText);
mTextField = new IntTextField(this, atoi(mValue.c_str()),
mMin, mMax, true, 30);
mTextField->setActionEventId(mEventName);
@@ -500,11 +500,11 @@ void SetupItemLabel::createControls()
{
const std::string str = " \342\200\225\342\200\225\342\200\225"
"\342\200\225\342\200\225 ";
- mLabel = new Label(str + mText + str);
+ mLabel = new Label(this, str + mText + str);
}
else
{
- mLabel = new Label(mText);
+ mLabel = new Label(this, mText);
}
mWidget = mLabel;
@@ -580,7 +580,7 @@ void SetupItemDropDown::createControls()
load();
mHorizont = new HorizontContainer(this, 32, 2);
- mLabel = new Label(mText);
+ mLabel = new Label(this, mText);
mDropDown = new DropDown(this, mModel);
mDropDown->setActionEventId(mEventName);
mDropDown->addActionListener(mParent);
@@ -668,7 +668,7 @@ void SetupItemSlider::createControls()
load();
mHorizont = new HorizontContainer(this, 32, 2);
- mLabel = new Label(mText);
+ mLabel = new Label(this, mText);
mSlider = new Slider(mMin, mMax);
mSlider->setActionEventId(mEventName);
mSlider->addActionListener(mParent);
@@ -788,8 +788,8 @@ void SetupItemSlider2::createControls()
const int width = getMaxWidth();
- mLabel = new Label(mText);
- mLabel2 = new Label("");
+ mLabel = new Label(this, mText);
+ mLabel2 = new Label(this, "");
mLabel2->setWidth(width);
mSlider = new Slider(mMin, mMax);
mSlider->setActionEventId(mEventName);
@@ -947,7 +947,7 @@ void SetupItemSliderList::createControls()
load();
mHorizont = new HorizontContainer(this, 32, 2);
- mLabel = new Label(mText);
+ mLabel = new Label(this, mText);
mSlider = new SliderList(this, mModel, mParent, mEventName);
mSlider->setSelectedString(mValue);
mSlider->adjustSize();
diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp
index fb94155c1..0df055d7f 100644
--- a/src/gui/widgets/sliderlist.cpp
+++ b/src/gui/widgets/sliderlist.cpp
@@ -46,7 +46,7 @@ SliderList::SliderList(const Widget2 *const widget,
Container(widget),
gcn::ActionListener(),
gcn::MouseListener(),
- mLabel(new Label),
+ mLabel(new Label(this)),
mListModel(listModel),
mOldWidth(0),
mSelectedIndex(0)
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index c68223d08..18a4489bd 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -65,7 +65,7 @@ Tab::Tab(const Widget2 *const widget) :
Widget2(widget),
gcn::MouseListener(),
gcn::WidgetListener(),
- mLabel(new Label),
+ mLabel(new Label(this)),
mHasMouse(false),
mTabbedArea(nullptr),
mTabColor(&getThemeColor(Theme::TAB)),