diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-05 19:09:02 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-05 19:09:02 +0300 |
commit | 92c019dad798f1a84c5d3e8e8331a885f6458133 (patch) | |
tree | 078d58c3b78ed37d23e7292460f4443f5ef799dd | |
parent | e6d251345a48108495d39d82b0ec79deac63d86d (diff) | |
download | plus-92c019dad798f1a84c5d3e8e8331a885f6458133.tar.gz plus-92c019dad798f1a84c5d3e8e8331a885f6458133.tar.bz2 plus-92c019dad798f1a84c5d3e8e8331a885f6458133.tar.xz plus-92c019dad798f1a84c5d3e8e8331a885f6458133.zip |
Add to left classes stong typed Modal enum.
-rw-r--r-- | src/gui/widgets/dropdown.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/dropdown.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/popuplist.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/popuplist.h | 9 | ||||
-rw-r--r-- | src/gui/windows/buydialog.cpp | 3 | ||||
-rw-r--r-- | src/gui/windows/editserverdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/windows/logindialog.cpp | 2 |
8 files changed, 21 insertions, 13 deletions
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 3977931b6..a4afdb6d1 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -54,7 +54,7 @@ static std::string const dropdownFiles[2] = DropDown::DropDown(const Widget2 *const widget, ListModel *const listModel, const bool extended, - const bool modal, + const Modal modal, ActionListener *const listener, const std::string &eventId) : ActionListener(), diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index ee1fc2789..391a49873 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -23,6 +23,8 @@ #ifndef GUI_WIDGETS_DROPDOWN_H #define GUI_WIDGETS_DROPDOWN_H +#include "enums/simpletypes.h" + #include "gui/widgets/basiccontainer.h" #include "listeners/actionlistener.h" @@ -64,7 +66,7 @@ class DropDown final : public ActionListener, DropDown(const Widget2 *const widget, ListModel *const listModel, const bool extended = false, - const bool modal = false, + const Modal modal = Modal_false, ActionListener *const listener = nullptr, const std::string &eventId = ""); diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp index e695c734b..c459fe351 100644 --- a/src/gui/widgets/popuplist.cpp +++ b/src/gui/widgets/popuplist.cpp @@ -30,7 +30,8 @@ PopupList::PopupList(DropDown *const widget, ListModel *const listModel, - bool extended, bool modal) : + const bool extended, + const Modal modal) : Popup("PopupList", "popuplist.xml"), FocusListener(), mListModel(listModel), @@ -88,7 +89,7 @@ void PopupList::show(int x, int y) setPosition(x, y); setVisible(true); requestMoveToTop(); - if (mModal) + if (mModal == Modal_true) requestModalFocus(); } @@ -153,7 +154,7 @@ void PopupList::mouseReleased(MouseEvent& event) if (mDropDown) mDropDown->updateSelection(); setVisible(false); - if (mModal) + if (mModal == Modal_true) releaseModalFocus(); } @@ -169,7 +170,7 @@ void PopupList::focusGained(const Event& event) if (mDropDown) mDropDown->updateSelection(); setVisible(false); - if (mModal) + if (mModal == Modal_true) releaseModalFocus(); } diff --git a/src/gui/widgets/popuplist.h b/src/gui/widgets/popuplist.h index db38585d9..a15701d57 100644 --- a/src/gui/widgets/popuplist.h +++ b/src/gui/widgets/popuplist.h @@ -21,6 +21,8 @@ #ifndef GUI_WIDGETS_POPUPLIST_H #define GUI_WIDGETS_POPUPLIST_H +#include "enums/simpletypes.h" + #include "gui/widgets/popup.h" #include "listeners/focuslistener.h" @@ -37,8 +39,9 @@ class PopupList final : public Popup, { public: PopupList(DropDown *const widget, - ListModel *const listModel, bool extended, - bool modal = false); + ListModel *const listModel, + const bool extended, + const Modal modal = Modal_false); ~PopupList(); @@ -75,7 +78,7 @@ class PopupList final : public Popup, ScrollArea *mScrollArea; DropDown *mDropDown; int mPressedIndex; - bool mModal; + Modal mModal; }; #endif // GUI_WIDGETS_POPUPLIST_H diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index cb10adaf6..db8bed23e 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -212,7 +212,8 @@ BuyDialog::BuyDialog(std::string nick) : ActionListener(), SelectionListener(), mSortModel(new SortListModelBuy), - mSortDropDown(new DropDown(this, mSortModel, false, false, this, "sort")), + mSortDropDown(new DropDown(this, mSortModel, false, + Modal_false, this, "sort")), mFilterTextField(new TextField(this, "", true, this, "namefilter", true)), mFilterLabel(nullptr), mNpcId(Nick), diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp index a9be34595..b7101e1fe 100644 --- a/src/gui/windows/editserverdialog.cpp +++ b/src/gui/windows/editserverdialog.cpp @@ -63,7 +63,7 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, mPersistentIp(new CheckBox(this, _("Use same ip"), true, this, "persistentIp")), mTypeListModel(new TypeListModel), - mTypeField(new DropDown(this, mTypeListModel, false, true)), + mTypeField(new DropDown(this, mTypeListModel, false, Modal_true)), mServerDialog(parent), mServer(server), mIndex(index) diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index da8f99c62..65e89bbb3 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -97,7 +97,8 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : "slotsprogressbar.xml", "slotsprogressbar_fill.xml")), mFilter(nullptr), mSortModel(new SortListModelInv), - mSortDropDown(new DropDown(this, mSortModel, false, false, this, "sort")), + mSortDropDown(new DropDown(this, mSortModel, false, + Modal_false, this, "sort")), mNameFilter(new TextField(this, "", true, this, "namefilter", true)), mSortDropDownCell(nullptr), mNameFilterCell(nullptr), diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp index a97a2284e..b0aa2d335 100644 --- a/src/gui/windows/logindialog.cpp +++ b/src/gui/windows/logindialog.cpp @@ -111,7 +111,7 @@ LoginDialog::LoginDialog(LoginData *const data, mLoginData->updateHost.c_str())); mUpdateListModel = new UpdateListModel(mLoginData); mUpdateHostDropDown = new DropDown(this, mUpdateListModel, - false, false, this, "updateselect"); + false, Modal_false, this, "updateselect"); const std::string str = serverConfig.getValue("updateHost2", ""); if (!str.empty()) mUpdateHostDropDown->setSelectedString(str); |