summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game.cpp4
-rw-r--r--src/gui/textdialog.cpp9
-rw-r--r--src/gui/textdialog.h7
3 files changed, 19 insertions, 1 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 3ef07dca..c9686232 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -64,6 +64,7 @@
#include "gui/setup.h"
#include "gui/skilldialog.h"
#include "gui/statuswindow.h"
+#include "gui/textdialog.h"
#include "gui/trade.h"
#include "gui/viewport.h"
#include "gui/windowmenu.h"
@@ -523,7 +524,8 @@ void Game::handleInput()
}
// send straight to gui for certain windows
- if (quitDialog || npcPostDialog->isVisible())
+ if (quitDialog || TextDialog::isActive() ||
+ npcPostDialog->isVisible())
{
try
{
diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp
index 326954e2..6cd066cc 100644
--- a/src/gui/textdialog.cpp
+++ b/src/gui/textdialog.cpp
@@ -27,6 +27,8 @@
#include "utils/gettext.h"
+int TextDialog::instances = 0;
+
TextDialog::TextDialog(const std::string &title, const std::string &msg,
Window *parent):
Window(title, true, parent),
@@ -64,6 +66,13 @@ TextDialog::TextDialog(const std::string &title, const std::string &msg,
}
setVisible(true);
mTextField->requestFocus();
+
+ instances++;
+}
+
+TextDialog::~TextDialog()
+{
+ instances--;
}
void TextDialog::action(const gcn::ActionEvent &event)
diff --git a/src/gui/textdialog.h b/src/gui/textdialog.h
index edfe85b6..b04851ac 100644
--- a/src/gui/textdialog.h
+++ b/src/gui/textdialog.h
@@ -43,6 +43,9 @@ public:
*/
TextDialog(const std::string &title, const std::string &msg,
Window *parent = NULL);
+
+
+ ~TextDialog();
/**
* Called when receiving actions from the widgets.
@@ -58,8 +61,12 @@ public:
* Set the OK button action id
*/
void setOKButtonActionId(const std::string &name);
+
+ static const bool isActive() { return instances > 0; }
private:
+ static int instances;
+
TextField *mTextField;
gcn::Button *mOkButton;
};