diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-06-12 22:20:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-06-12 22:20:53 +0300 |
commit | 77a5341118e27572c9b9db90d42120c84d204d77 (patch) | |
tree | 6547ae368b498044657126fc55a8f0234afefe9a /src/gui/widgets/popuplist.cpp | |
parent | 77e2fc7f22393fba02e650a196093e1af9a824ac (diff) | |
download | mv-77a5341118e27572c9b9db90d42120c84d204d77.tar.gz mv-77a5341118e27572c9b9db90d42120c84d204d77.tar.bz2 mv-77a5341118e27572c9b9db90d42120c84d204d77.tar.xz mv-77a5341118e27572c9b9db90d42120c84d204d77.zip |
improve popuplist.
Diffstat (limited to 'src/gui/widgets/popuplist.cpp')
-rw-r--r-- | src/gui/widgets/popuplist.cpp | 19 |
1 files changed, 10 insertions, 9 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) |