summaryrefslogtreecommitdiff
path: root/src/gui/widgets/popuplist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/popuplist.cpp')
-rw-r--r--src/gui/widgets/popuplist.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp
index eb711ddeb..586dd5172 100644
--- a/src/gui/widgets/popuplist.cpp
+++ b/src/gui/widgets/popuplist.cpp
@@ -36,20 +36,22 @@ PopupList::PopupList(DropDown *const widget,
gcn::FocusListener(),
mListModel(listModel),
mListBox(new ListBox(widget, listModel)),
- mScrollArea(new ScrollArea),
+ mScrollArea(new ScrollArea(mListBox, false)),
mDropDown(widget)
{
setFocusable(true);
mListBox->setDistributeMousePressed(true);
mListBox->addSelectionListener(this);
- mScrollArea->setContent(mListBox);
+ mScrollArea->setPosition(mPadding, mPadding);
add(mScrollArea);
if (getParent())
getParent()->addFocusListener(this);
if (gui)
gui->addGlobalFocusListener(this);
+
+ adjustSize();
}
PopupList::~PopupList()
@@ -104,9 +106,11 @@ void PopupList::setListModel(gcn::ListModel *model)
void PopupList::adjustSize()
{
- mScrollArea->setWidth(getWidth() - 8);
- mScrollArea->setHeight(getHeight() - 8);
+ const int pad2 = 2 * mPadding;
+ mScrollArea->setWidth(getWidth() - pad2);
+ mScrollArea->setHeight(getHeight() - pad2);
mListBox->adjustSize();
+ mListBox->setWidth(getWidth() - pad2);
}
void PopupList::valueChanged(const gcn::SelectionEvent& event A_UNUSED)