summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/popuplist.cpp19
-rw-r--r--src/gui/widgets/popuplist.h6
2 files changed, 13 insertions, 12 deletions
diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp
index a0d8b558a..8cea612ab 100644
--- a/src/gui/widgets/popuplist.cpp
+++ b/src/gui/widgets/popuplist.cpp
@@ -49,8 +49,6 @@ PopupList::PopupList(DropDown *const widget,
mScrollArea->setPosition(mPadding, mPadding);
add(mScrollArea);
-// if (getParent())
-// getParent()->addFocusListener(this);
if (gui)
gui->addGlobalFocusListener(this);
@@ -74,10 +72,12 @@ void PopupList::show(int x, int y)
if (len > 250)
len = 250;
setContentSize(mListBox->getWidth() + 8, len);
- if (mainGraphics->mWidth < (x + getWidth() + 5))
- x = mainGraphics->mWidth - getWidth();
- if (mainGraphics->mHeight < (y + getHeight() + 5))
- y = mainGraphics->mHeight - getHeight();
+ const int width = mDimension.width;
+ const int height = mDimension.height;
+ if (mainGraphics->mWidth < (x + width + 5))
+ x = mainGraphics->mWidth - width;
+ if (mainGraphics->mHeight < (y + height + 5))
+ y = mainGraphics->mHeight - height;
setPosition(x, y);
setVisible(true);
requestMoveToTop();
@@ -117,10 +117,11 @@ void PopupList::setListModel(gcn::ListModel *model)
void PopupList::adjustSize()
{
const int pad2 = 2 * mPadding;
- mScrollArea->setWidth(getWidth() - pad2);
- mScrollArea->setHeight(getHeight() - pad2);
+ const int width = mDimension.width - pad2;
+ mScrollArea->setWidth(width);
+ mScrollArea->setHeight(mDimension.height - pad2);
mListBox->adjustSize();
- mListBox->setWidth(getWidth() - pad2);
+ mListBox->setWidth(width);
}
void PopupList::mousePressed(gcn::MouseEvent& mouseEvent)
diff --git a/src/gui/widgets/popuplist.h b/src/gui/widgets/popuplist.h
index a9d2c7593..f3786c192 100644
--- a/src/gui/widgets/popuplist.h
+++ b/src/gui/widgets/popuplist.h
@@ -61,11 +61,11 @@ class PopupList final : public Popup,
void adjustSize();
- void focusGained(const gcn::Event& event A_UNUSED);
+ void focusGained(const gcn::Event& event A_UNUSED) override;
- void focusLost(const gcn::Event& event A_UNUSED);
+ void focusLost(const gcn::Event& event A_UNUSED) override;
- void mousePressed(gcn::MouseEvent& mouseEvent);
+ void mousePressed(gcn::MouseEvent& mouseEvent) override;
private:
gcn::ListModel *mListModel;