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. --- data/themes/jewelry/CMakeLists.txt | 1 + data/themes/jewelry/Makefile.am | 1 + data/themes/jewelry/popuplist.xml | 18 ++++++++++++++++++ src/gui/widgets/dropdown.cpp | 3 +-- src/gui/widgets/popup.h | 4 +++- src/gui/widgets/popuplist.cpp | 12 ++++++++---- 6 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 data/themes/jewelry/popuplist.xml diff --git a/data/themes/jewelry/CMakeLists.txt b/data/themes/jewelry/CMakeLists.txt index 4e9e05c16..11f654b25 100644 --- a/data/themes/jewelry/CMakeLists.txt +++ b/data/themes/jewelry/CMakeLists.txt @@ -39,6 +39,7 @@ SET (FILES ok.xml playerbox.xml popup.xml + popuplist.xml progressbar.xml quests.xml radio.xml diff --git a/data/themes/jewelry/Makefile.am b/data/themes/jewelry/Makefile.am index 50892e5dc..50513df95 100644 --- a/data/themes/jewelry/Makefile.am +++ b/data/themes/jewelry/Makefile.am @@ -42,6 +42,7 @@ gui_DATA = \ ok.xml \ playerbox.xml \ popup.xml \ + popuplist.xml \ progressbar.xml \ quests.xml \ radio.xml \ diff --git a/data/themes/jewelry/popuplist.xml b/data/themes/jewelry/popuplist.xml new file mode 100644 index 000000000..f8cc88055 --- /dev/null +++ b/data/themes/jewelry/popuplist.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + 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) -- cgit v1.2.3-70-g09d2