diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-20 23:31:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-20 23:31:01 +0300 |
commit | 39f265e503e11f2e48e7a54129f216b55e288ac3 (patch) | |
tree | 2fe197330ea77bed9f59b633c3dd1bffd63a9a17 /src/gui/windows | |
parent | b43d3d71666161d9276440727082cc1508741280 (diff) | |
download | manaplus-39f265e503e11f2e48e7a54129f216b55e288ac3.tar.gz manaplus-39f265e503e11f2e48e7a54129f216b55e288ac3.tar.bz2 manaplus-39f265e503e11f2e48e7a54129f216b55e288ac3.tar.xz manaplus-39f265e503e11f2e48e7a54129f216b55e288ac3.zip |
Not allow close warp dialog until select warp target.
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/textselectdialog.cpp | 24 | ||||
-rw-r--r-- | src/gui/windows/textselectdialog.h | 6 |
2 files changed, 23 insertions, 7 deletions
diff --git a/src/gui/windows/textselectdialog.cpp b/src/gui/windows/textselectdialog.cpp index dbc34bfaf..ebbee9528 100644 --- a/src/gui/windows/textselectdialog.cpp +++ b/src/gui/windows/textselectdialog.cpp @@ -40,7 +40,8 @@ #include "debug.h" TextSelectDialog::TextSelectDialog(const std::string &name, - const std::string &selectButton) : + const std::string &selectButton, + const AllowQuit allowQuit) : // TRANSLATORS: sell dialog name Window(name, Modal_false, nullptr, "sell.xml"), ActionListener(), @@ -52,6 +53,7 @@ TextSelectDialog::TextSelectDialog(const std::string &name, mItemList(nullptr), mScrollArea(nullptr), mModel(nullptr), + mAllowQuit(allowQuit), mTag(0) { } @@ -60,7 +62,7 @@ void TextSelectDialog::postInit() { setWindowName("TextSelectDialog"); setResizable(true); - setCloseButton(true); + setCloseButton(mAllowQuit == AllowQuit_true); setStickyButtonLock(true); setMinWidth(260); setMinHeight(220); @@ -83,8 +85,11 @@ void TextSelectDialog::postInit() mSelectButtonName, "select", this); - // TRANSLATORS: sell dialog button - mQuitButton = new Button(this, _("Quit"), "quit", this); + if (mAllowQuit == AllowQuit_true) + { + // TRANSLATORS: sell dialog button + mQuitButton = new Button(this, _("Quit"), "quit", this); + } mSelectButton->setEnabled(false); @@ -97,8 +102,15 @@ void TextSelectDialog::postInit() placer = getPlacer(0, 0); placer(0, 0, mScrollArea, 8, 5).setPadding(3); - placer(6, 5, mSelectButton); - placer(7, 5, mQuitButton); + if (mQuitButton) + { + placer(6, 5, mSelectButton); + placer(7, 5, mQuitButton); + } + else + { + placer(7, 5, mSelectButton); + } Layout &layout = getLayout(); layout.setRowHeight(0, LayoutType::SET); diff --git a/src/gui/windows/textselectdialog.h b/src/gui/windows/textselectdialog.h index 800f7cee4..70da4ad5e 100644 --- a/src/gui/windows/textselectdialog.h +++ b/src/gui/windows/textselectdialog.h @@ -25,6 +25,8 @@ #include "gui/widgets/window.h" +#include "enums/simpletypes/allowquit.h" + #include "listeners/actionlistener.h" #include "listeners/selectionlistener.h" @@ -42,7 +44,8 @@ class TextSelectDialog notfinal : public Window, * Constructor. */ TextSelectDialog(const std::string &name, - const std::string &selectButton); + const std::string &selectButton, + const AllowQuit allowQuit); A_DELETE_COPY(TextSelectDialog) @@ -94,6 +97,7 @@ class TextSelectDialog notfinal : public Window, ListBox *mItemList A_NONNULLPOINTER; ScrollArea *mScrollArea A_NONNULLPOINTER; NamesModel *mModel A_NONNULLPOINTER; + AllowQuit mAllowQuit; int mTag; }; |