diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-05-02 22:05:37 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-05-02 22:05:37 -0600 |
commit | d592883f61eef2abb7829a6b624d2c85fe54dd5e (patch) | |
tree | f5ee4e94f8d57f251e5389a17538573f441aae98 /src/gui | |
parent | 8a3a417e3a3c083414d35de0f0dad91edde09276 (diff) | |
download | mana-d592883f61eef2abb7829a6b624d2c85fe54dd5e.tar.gz mana-d592883f61eef2abb7829a6b624d2c85fe54dd5e.tar.bz2 mana-d592883f61eef2abb7829a6b624d2c85fe54dd5e.tar.xz mana-d592883f61eef2abb7829a6b624d2c85fe54dd5e.zip |
Fix up some things in the NPC dialog
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/npcdialog.cpp | 21 | ||||
-rw-r--r-- | src/gui/npcdialog.h | 10 |
2 files changed, 26 insertions, 5 deletions
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index a595467d..1fe231df 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -39,7 +39,7 @@ NpcDialog::NpcDialog() : Window(_("NPC")), - mActionState(NPC_ACTION_NEXT), + mActionState(NPC_ACTION_WAIT), mInputState(NPC_INPUT_NONE), mNpcId(0), mText("") @@ -101,6 +101,12 @@ void NpcDialog::addText(const std::string &text) { setText(mText + text + "\n"); mScrollArea->setVerticalScrollAmount(mScrollArea->getVerticalMaxScroll()); + mActionState = NPC_ACTION_WAIT; + buildLayout(); +} + +void NpcDialog::showNextButton() +{ mActionState = NPC_ACTION_NEXT; buildLayout(); } @@ -237,7 +243,11 @@ void NpcDialog::buildLayout() if (mActionState != NPC_ACTION_INPUT) { - if (mActionState == NPC_ACTION_NEXT) + if (mActionState == NPC_ACTION_WAIT) + { + mButton->setCaption(_("Waiting for server")); + } + else if (mActionState == NPC_ACTION_NEXT) { mButton->setCaption(_("Next")); } @@ -269,9 +279,14 @@ void NpcDialog::buildLayout() place(0, 3, mIntField, 3); place(3, 4, mButton, 2); } - } + } Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); + + mButton->setEnabled(mActionState != NPC_ACTION_WAIT); + redraw(); + + mScrollArea->setVerticalScrollAmount(mScrollArea->getVerticalMaxScroll()); } diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h index 93ab5e54..f49976dc 100644 --- a/src/gui/npcdialog.h +++ b/src/gui/npcdialog.h @@ -80,8 +80,13 @@ class NpcDialog : public Window, public gcn::ActionListener, void addText(const std::string &string); /** - * When called, the widget will show a "Close" button instead of the "Next" - * And when clicked it will close the window + * When called, the widget will show a "Next" button. + */ + void showNextButton(); + + /** + * When called, the widget will show a "Close" button and will close + * the dialog when clicked. */ void showCloseButton(); @@ -172,6 +177,7 @@ class NpcDialog : public Window, public gcn::ActionListener, NPCInputState mInputState; enum NPCActionState { + NPC_ACTION_WAIT, NPC_ACTION_NEXT, NPC_ACTION_INPUT, NPC_ACTION_CLOSE |