summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-01-17 18:45:21 +0300
committerAndrei Karas <akaras@inbox.ru>2013-01-17 18:45:21 +0300
commitbc9712cfb34a891a64bd28b76df0f9f4e5d01513 (patch)
treef8687ee78d213e5a90572fc06b642d24f9ad28de /src/gui/widgets
parent37c0c88a7b96919470a0abed8e17b3a0352ca49d (diff)
downloadmanaplus-bc9712cfb34a891a64bd28b76df0f9f4e5d01513.tar.gz
manaplus-bc9712cfb34a891a64bd28b76df0f9f4e5d01513.tar.bz2
manaplus-bc9712cfb34a891a64bd28b76df0f9f4e5d01513.tar.xz
manaplus-bc9712cfb34a891a64bd28b76df0f9f4e5d01513.zip
Fix server type dropdown in new server dialog.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/dropdown.cpp3
-rw-r--r--src/gui/widgets/dropdown.h1
-rw-r--r--src/gui/widgets/popuplist.cpp11
-rw-r--r--src/gui/widgets/popuplist.h4
4 files changed, 15 insertions, 4 deletions
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index a7eb819d7..d4fde01dc 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -60,6 +60,7 @@ static std::string const dropdownFiles[2] =
DropDown::DropDown(const Widget2 *const widget,
gcn::ListModel *const listModel,
bool extended,
+ bool modal,
gcn::ActionListener *const listener,
const std::string &eventId):
gcn::ActionListener(),
@@ -70,7 +71,7 @@ DropDown::DropDown(const Widget2 *const widget,
gcn::SelectionListener(),
Widget2(widget),
mExtended(extended),
- mPopup(new PopupList(this, listModel, extended)),
+ mPopup(new PopupList(this, listModel, extended, modal)),
mShadowColor(getThemeColor(Theme::DROPDOWN_SHADOW)),
mHighlightColor(getThemeColor(Theme::HIGHLIGHT)),
mPadding(1),
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h
index ca8b77822..30ce6692b 100644
--- a/src/gui/widgets/dropdown.h
+++ b/src/gui/widgets/dropdown.h
@@ -71,6 +71,7 @@ class DropDown final : public gcn::ActionListener,
DropDown(const Widget2 *const widget,
gcn::ListModel *const listModel = nullptr,
bool extended = false,
+ bool modal = false,
gcn::ActionListener *const listener = nullptr,
const std::string &eventId = "");
diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp
index 22b479a20..ca9ef2c7d 100644
--- a/src/gui/widgets/popuplist.cpp
+++ b/src/gui/widgets/popuplist.cpp
@@ -32,14 +32,15 @@
PopupList::PopupList(DropDown *const widget,
gcn::ListModel *const listModel,
- bool extended):
+ bool extended, bool modal):
Popup("PopupList", "popuplist.xml"),
gcn::FocusListener(),
mListModel(listModel),
mListBox(extended ? new ExtendedListBox(widget, listModel, 0) :
new ListBox(widget, listModel)),
mScrollArea(new ScrollArea(mListBox, false)),
- mDropDown(widget)
+ mDropDown(widget),
+ mModal(modal)
{
setFocusable(true);
@@ -79,6 +80,8 @@ void PopupList::show(int x, int y)
setPosition(x, y);
setVisible(true);
requestMoveToTop();
+ if (mModal)
+ requestModalFocus();
}
void PopupList::widgetResized(const gcn::Event &event)
@@ -124,6 +127,8 @@ void PopupList::mousePressed(gcn::MouseEvent& mouseEvent A_UNUSED)
if (mDropDown)
mDropDown->updateSelection();
setVisible(false);
+ if (mModal)
+ releaseModalFocus();
}
void PopupList::focusGained(const gcn::Event& event A_UNUSED)
@@ -138,6 +143,8 @@ void PopupList::focusGained(const gcn::Event& event A_UNUSED)
if (mDropDown)
mDropDown->updateSelection();
setVisible(false);
+ if (mModal)
+ releaseModalFocus();
}
void PopupList::focusLost(const gcn::Event& event A_UNUSED)
diff --git a/src/gui/widgets/popuplist.h b/src/gui/widgets/popuplist.h
index d1f49bf5c..3e3c44449 100644
--- a/src/gui/widgets/popuplist.h
+++ b/src/gui/widgets/popuplist.h
@@ -39,7 +39,8 @@ class PopupList final : public Popup,
{
public:
PopupList(DropDown *const widget,
- gcn::ListModel *const listModel, bool extended);
+ gcn::ListModel *const listModel, bool extended,
+ bool modal = false);
~PopupList();
@@ -71,6 +72,7 @@ class PopupList final : public Popup,
ListBox *mListBox;
ScrollArea *mScrollArea;
DropDown *mDropDown;
+ bool mModal;
};
#endif