summaryrefslogtreecommitdiff
path: root/src/gui/widgets/setupitem.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-02-05 12:50:59 +0300
committerAndrei Karas <akaras@inbox.ru>2014-02-05 12:50:59 +0300
commitf677e2a536d84c1db5145db80b9e9a7540cfbb6d (patch)
tree878763f6bd9d39b7c1242f55bcd2126744888b1b /src/gui/widgets/setupitem.cpp
parent0b67538b1d403a14f4754aaa7fe3aabc098abe41 (diff)
downloadmanaverse-f677e2a536d84c1db5145db80b9e9a7540cfbb6d.tar.gz
manaverse-f677e2a536d84c1db5145db80b9e9a7540cfbb6d.tar.bz2
manaverse-f677e2a536d84c1db5145db80b9e9a7540cfbb6d.tar.xz
manaverse-f677e2a536d84c1db5145db80b9e9a7540cfbb6d.zip
add slider list setup control for int value.
Diffstat (limited to 'src/gui/widgets/setupitem.cpp')
-rw-r--r--src/gui/widgets/setupitem.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index b9ea91f76..a34447516 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -1139,3 +1139,40 @@ void SetupItemSound::action(const gcn::ActionEvent &event)
SetupItemSliderList::action(event);
}
}
+
+SetupItemSliderInt::SetupItemSliderInt(const std::string &restrict text,
+ const std::string &restrict description,
+ const std::string &restrict keyName,
+ SetupTabScroll *restrict const parent,
+ const std::string &restrict eventName,
+ gcn::ListModel *restrict const model,
+ const int min,
+ const int width,
+ const bool onTheFly,
+ const bool mainConfig) :
+ SetupItemSliderList(text, description, keyName, parent, eventName,
+ model, width, onTheFly, mainConfig),
+ mMin(min)
+{
+ createControls();
+}
+
+void SetupItemSliderInt::addMoreControls()
+{
+}
+
+void SetupItemSliderInt::fromWidget()
+{
+ if (!mSlider)
+ return;
+
+ mValue = toString(mSlider->getSelected() + mMin);
+}
+
+void SetupItemSliderInt::toWidget()
+{
+ if (!mSlider)
+ return;
+
+ mSlider->setSelected(atoi(mValue.c_str()) - mMin);
+}