summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/dropdown.cpp3
-rw-r--r--src/gui/widgets/popup.h4
-rw-r--r--src/gui/widgets/popuplist.cpp12
3 files changed, 12 insertions, 7 deletions
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 6c3e3e9cc..8c8f6843f 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -436,7 +436,7 @@ void DropDown::dropDown()
const int pad2 = pad * 2;
// here width should be adjusted on some other parameters
- mPopup->setWidth(getWidth() - pad2 + 10);
+ mPopup->setWidth(getWidth() - pad2 + 8);
mPopup->show(x - mPadding - frame - 1, y + getHeight());
mPopup->requestMoveToTop();
mPopup->requestFocus();
@@ -449,7 +449,6 @@ void DropDown::foldUp()
{
mDroppedDown = false;
adjustHeight();
-// mInternalFocusHandler.focusNone();
}
}
diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h
index ac4cc6e94..410e14059 100644
--- a/src/gui/widgets/popup.h
+++ b/src/gui/widgets/popup.h
@@ -168,13 +168,15 @@ class Popup : public Container, public gcn::MouseListener,
void widgetMoved(const gcn::Event &event) override;
+ protected:
+ int mPadding; /**< Holds the padding of the popup. */
+
private:
std::string mPopupName; /**< Name of the popup */
int mMinWidth; /**< Minimum popup width */
int mMinHeight; /**< Minimum popup height */
int mMaxWidth; /**< Maximum popup width */
int mMaxHeight; /**< Maximum popup height */
- int mPadding; /**< Holds the padding of the popup. */
Skin *mSkin; /**< Skin in use by this popup */
ImageCollection *mVertexes;
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)