From 661a14c66685de67ec560005c285267fe7098c62 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 15 Dec 2012 23:52:30 +0300 Subject: Fix a bit jewelry theme for drop down list. Fix drop down position. --- src/gui/widgets/popuplist.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/gui/widgets/popuplist.cpp') 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) -- cgit v1.2.3-60-g2f50