summaryrefslogtreecommitdiff
path: root/src/gui/widgets/setupitem.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-24 12:53:50 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-24 12:53:50 +0300
commite04c285de305cc1da568cde431d31dc56009526c (patch)
tree1875c26d5951548f5c164be95e9d4b56408b53b8 /src/gui/widgets/setupitem.cpp
parent22eeb047442eecc9a41a12ef4e278616083e03df (diff)
downloadmanaverse-e04c285de305cc1da568cde431d31dc56009526c.tar.gz
manaverse-e04c285de305cc1da568cde431d31dc56009526c.tar.bz2
manaverse-e04c285de305cc1da568cde431d31dc56009526c.tar.xz
manaverse-e04c285de305cc1da568cde431d31dc56009526c.zip
Fix dropdown setupitem.
Diffstat (limited to 'src/gui/widgets/setupitem.cpp')
-rw-r--r--src/gui/widgets/setupitem.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index cb6dc378a..d3c46e0ec 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -536,12 +536,14 @@ SetupItemDropDown::SetupItemDropDown(std::string text,
SetupTabScroll *const parent,
std::string eventName,
gcn::ListModel *const model,
+ int width,
const bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, mainConfig),
mHorizont(nullptr),
mLabel(nullptr),
mModel(model),
- mDropDown(nullptr)
+ mDropDown(nullptr),
+ mWidth(width)
{
mValueType = VSTR;
createControls();
@@ -553,6 +555,7 @@ SetupItemDropDown::SetupItemDropDown(std::string text,
SetupTabScroll *const parent,
std::string eventName,
gcn::ListModel *const model,
+ int width,
std::string def,
const bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
@@ -583,6 +586,8 @@ void SetupItemDropDown::createControls()
mDropDown = new DropDown(this, mModel);
mDropDown->setActionEventId(mEventName);
mDropDown->addActionListener(mParent);
+ mDropDown->setWidth(mWidth);
+ mDropDown->setSelected(atoi(mValue.c_str()));
mWidget = mDropDown;
// mTextField->setWidth(50);
@@ -601,7 +606,7 @@ void SetupItemDropDown::fromWidget()
if (!mDropDown)
return;
- mValue = mDropDown->getSelectedString();
+ mValue = toString(mDropDown->getSelected());
}
void SetupItemDropDown::toWidget()
@@ -609,7 +614,7 @@ void SetupItemDropDown::toWidget()
if (!mDropDown)
return;
- mDropDown->setSelectedString(mValue);
+ mDropDown->setSelected(atoi(mValue.c_str()));
}