summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-02-16 14:41:24 +0000
committerIra Rice <irarice@gmail.com>2009-02-16 15:42:48 -0700
commitd2c175c2d5fba8b78a45d70fbaf24d7b7afe7a3c (patch)
treed02c3e0451df5d997e841a865943d411f1dc786e /src/gui
parent4924e4a50ae31c30f783285f6e10ac3651c1e6e8 (diff)
downloadMana-d2c175c2d5fba8b78a45d70fbaf24d7b7afe7a3c.tar.gz
Mana-d2c175c2d5fba8b78a45d70fbaf24d7b7afe7a3c.tar.bz2
Mana-d2c175c2d5fba8b78a45d70fbaf24d7b7afe7a3c.tar.xz
Mana-d2c175c2d5fba8b78a45d70fbaf24d7b7afe7a3c.zip
Fixed up NPC dialogs to behave more like eAthena expects.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/npc_text.cpp19
-rw-r--r--src/gui/npc_text.h3
-rw-r--r--src/gui/npcintegerdialog.cpp2
-rw-r--r--src/gui/npclistdialog.cpp2
-rw-r--r--src/gui/npcstringdialog.cpp6
5 files changed, 18 insertions, 14 deletions
diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp
index 88db46b3..ed75b76e 100644
--- a/src/gui/npc_text.cpp
+++ b/src/gui/npc_text.cpp
@@ -45,14 +45,15 @@ NpcTextDialog::NpcTextDialog():
mTextBox->setEditable(false);
mTextBox->setOpaque(false);
- scrollArea = new ScrollArea(mTextBox);
- okButton = new Button(_("OK"), "ok", this);
+ mScrollArea = new ScrollArea(mTextBox);
+ mButton = new Button(_("OK"), "", this);
+ mButton->setActionEventId("ok");
- scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- scrollArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS);
+ mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ mScrollArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS);
- place(0, 0, scrollArea, 5).setPadding(3);
- place(4, 1, okButton);
+ place(0, 0, mScrollArea, 5).setPadding(3);
+ place(4, 1, mButton);
Layout &layout = getLayout();
layout.setRowHeight(0, Layout::AUTO_SET);
@@ -64,7 +65,7 @@ NpcTextDialog::NpcTextDialog():
void NpcTextDialog::setText(const std::string &text)
{
mText = text;
- mTextBox->setTextWrapped(mText, scrollArea->getWidth() - 15);
+ mTextBox->setTextWrapped(mText, mScrollArea->getWidth() - 15);
}
void NpcTextDialog::addText(const std::string &text)
@@ -78,9 +79,11 @@ void NpcTextDialog::action(const gcn::ActionEvent &event)
{
setText("");
setVisible(false);
+
if (current_npc)
current_npc->nextDialog();
- current_npc = 0;
+
+ current_npc = NULL;
}
}
diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h
index 1f2abd42..5e2ff118 100644
--- a/src/gui/npc_text.h
+++ b/src/gui/npc_text.h
@@ -80,8 +80,9 @@ class NpcTextDialog : public Window, public gcn::ActionListener
private:
gcn::Button *okButton;
- gcn::ScrollArea *scrollArea;
+ gcn::ScrollArea *mScrollArea;
TextBox *mTextBox;
+ gcn::Button *mButton;
std::string mText;
};
diff --git a/src/gui/npcintegerdialog.cpp b/src/gui/npcintegerdialog.cpp
index 9db71d67..ea3398c9 100644
--- a/src/gui/npcintegerdialog.cpp
+++ b/src/gui/npcintegerdialog.cpp
@@ -100,7 +100,7 @@ void NpcIntegerDialog::action(const gcn::ActionEvent &event)
{
setVisible(false);
current_npc->integerInput(mValueField->getValue());
- current_npc = 0;
+ current_npc = NULL;
mValueField->reset();
}
}
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp
index 59bf0716..81c33049 100644
--- a/src/gui/npclistdialog.cpp
+++ b/src/gui/npclistdialog.cpp
@@ -110,6 +110,6 @@ void NpcListDialog::action(const gcn::ActionEvent &event)
setVisible(false);
reset();
current_npc->dialogChoice(choice);
- current_npc = 0;
+ current_npc = NULL;
}
}
diff --git a/src/gui/npcstringdialog.cpp b/src/gui/npcstringdialog.cpp
index 8d66d9bc..ef2de73a 100644
--- a/src/gui/npcstringdialog.cpp
+++ b/src/gui/npcstringdialog.cpp
@@ -24,12 +24,12 @@
#include "npcstringdialog.h"
#include "textfield.h"
+#include "widgets/layout.h"
+
#include "../npc.h"
#include "../utils/gettext.h"
-#include "widgets/layout.h"
-
NpcStringDialog::NpcStringDialog():
Window(_("NPC Text Request"))
{
@@ -65,7 +65,7 @@ void NpcStringDialog::action(const gcn::ActionEvent &event)
setVisible(false);
current_npc->stringInput(mValueField->getText());
- current_npc = 0;
+ current_npc = NULL;
mValueField->setText("");
}