diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-15 23:52:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-16 00:28:38 +0300 |
commit | 661a14c66685de67ec560005c285267fe7098c62 (patch) | |
tree | 66a0cf5a2f07f9b1bf4f932577e2d47663b49a41 /src | |
parent | 54ff2f6fec70e66d7a8b4a96b28fa7d46f2304a3 (diff) | |
download | plus-661a14c66685de67ec560005c285267fe7098c62.tar.gz plus-661a14c66685de67ec560005c285267fe7098c62.tar.bz2 plus-661a14c66685de67ec560005c285267fe7098c62.tar.xz plus-661a14c66685de67ec560005c285267fe7098c62.zip |
Fix a bit jewelry theme for drop down list.
Fix drop down position.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/dropdown.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/popup.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/popuplist.cpp | 12 |
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) |