summaryrefslogtreecommitdiff
path: root/src/gui/npcdialog.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/npcdialog.h')
-rw-r--r--src/gui/npcdialog.h77
1 files changed, 37 insertions, 40 deletions
diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h
index 9c6839b0..5f2b61be 100644
--- a/src/gui/npcdialog.h
+++ b/src/gui/npcdialog.h
@@ -27,8 +27,10 @@
#include "gui/widgets/window.h"
#include <guichan/actionlistener.hpp>
+#include <guichan/keylistener.hpp>
#include <guichan/listmodel.hpp>
+
#include <list>
#include <string>
#include <vector>
@@ -47,7 +49,7 @@ class Button;
class NpcDialog : public Window,
public gcn::ActionListener,
public gcn::ListModel,
- public EventListener
+ public gcn::KeyListener
{
public:
NpcDialog(int npcId);
@@ -59,36 +61,46 @@ class NpcDialog : public Window,
*/
void action(const gcn::ActionEvent &event);
+ void keyPressed(gcn::KeyEvent &keyEvent);
+
/**
- * Sets the text shows in the dialog.
- *
- * @param string The new text.
- */
- void setText(const std::string &string);
+ * Moves the dialog forward
+ */
+ void proceed();
/**
- * Adds the text to the text shows in the dialog. Also adds a newline
- * to the end.
+ * Update the text being written to the screen
*
- * @param string The text to add.
+ * @overload Window::logic
*/
- void addText(const std::string &string, bool save = true);
+ void logic();
/**
- * When called, the widget will show a "Next" button.
+ * Has the dialog window animate playing the text
+ *
+ * @param string The text that will be played
*/
- void showNextButton();
+ void playText(const std::string &string);
+
+ /**
+ * Sets the text shows in the dialog.
+ *
+ * @param string The new text.
+ */
+ void setText(const std::string &string);
/**
- * When called, the widget will show a "Close" button and will close
- * the dialog when clicked.
+ * When called the window's next interaction
+ * with the player will be to request the next
+ * stage in the interaction.
*/
- void showCloseButton();
+ void setStateNext();
/**
- * Notifies the server that client has performed a next action.
+ * When called the window's next interaction
+ * with the player will be to close the window.
*/
- void nextDialog();
+ void setStateClose();
/**
* Notifies the server that the client has performed a close action.
@@ -139,18 +151,9 @@ class NpcDialog : public Window,
void move(int amount);
- /**
- * Called when resizing the window.
- *
- * @param event The calling event
- */
- void widgetResized(const gcn::Event &event);
-
void setVisible(bool visible);
- void event(Event::Channel channel, const Event &event);
-
- void mouseClicked(gcn::MouseEvent &mouseEvent);
+ void mousePressed(gcn::MouseEvent &mouseEvent);
/**
* Returns the first active instance. Useful for pushing user
@@ -175,16 +178,19 @@ class NpcDialog : public Window,
void buildLayout();
int mNpcId;
- bool mLogInteraction;
int mDefaultInt;
std::string mDefaultString;
// Used for the main input area
- gcn::ScrollArea *mScrollArea;
TextBox *mTextBox;
+ // Target string to be displayed into mTextBox
std::string mText;
- std::string mNewText;
+ // Timer for when to add a new character
+ int mTextPlayTime;
+ // When set, if playText() is called again
+ // It will clear the existing values
+ bool mClearTextOnNextPlay;
// Used for choice input
ListBox *mItemList;
@@ -194,16 +200,7 @@ class NpcDialog : public Window,
// Used for string and integer input
TextField *mTextField;
IntTextField *mIntField;
- Button *mPlusButton;
- Button *mMinusButton;
-
- Button *mClearButton;
-
- // Used for the button
- Button *mNextButton;
-
- // Will reset the text and integer input to the provided default
- Button *mResetButton;
+ Button *mSubmitButton;
enum NpcInputState
{