diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-02-09 23:47:02 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-02-09 23:47:02 +0100 |
commit | fa2f3ac593a792c32095c2e885665ec91bb4019d (patch) | |
tree | f44aee845f0229dfcc6b2ad3c74613e0352f36c2 /src/gui/npc_text.cpp | |
parent | 07f7d52f661a74e6d0c780ca53e724651e3dcc48 (diff) | |
parent | 40edf4e91558cffd83d9015a2cf4a16360e27855 (diff) | |
download | mana-client-fa2f3ac593a792c32095c2e885665ec91bb4019d.tar.gz mana-client-fa2f3ac593a792c32095c2e885665ec91bb4019d.tar.bz2 mana-client-fa2f3ac593a792c32095c2e885665ec91bb4019d.tar.xz mana-client-fa2f3ac593a792c32095c2e885665ec91bb4019d.zip |
Merged with Aethyra master as of 2009-02-09
Conflicts:
A lot of files...
Diffstat (limited to 'src/gui/npc_text.cpp')
-rw-r--r-- | src/gui/npc_text.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp index a2e043d1..b4313b70 100644 --- a/src/gui/npc_text.cpp +++ b/src/gui/npc_text.cpp @@ -19,12 +19,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <string> - -#include "npc_text.h" -#include "browserbox.h" #include "button.h" +#include "npc_text.h" #include "scrollarea.h" +#include "textbox.h" #include "widgets/layout.h" @@ -42,10 +40,11 @@ NpcTextDialog::NpcTextDialog(): setDefaultSize(0, 0, 260, 200); - mBrowserBox = new BrowserBox(BrowserBox::AUTO_WRAP); - mBrowserBox->setOpaque(false); + mTextBox = new TextBox; + mTextBox->setEditable(false); + mTextBox->setOpaque(false); - scrollArea = new ScrollArea(mBrowserBox); + scrollArea = new ScrollArea(mTextBox); okButton = new Button(_("OK"), "ok", this); scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); @@ -61,30 +60,33 @@ NpcTextDialog::NpcTextDialog(): setLocationRelativeTo(getParent()); } -void NpcTextDialog::clearText() -{ - mBrowserBox->clearRows(); -} - void NpcTextDialog::setText(const std::string &text) { - mBrowserBox->clearRows(); - mBrowserBox->addRow(text); + mText = text; + mTextBox->setTextWrapped(mText, scrollArea->getWidth() - 15); } void NpcTextDialog::addText(const std::string &text) { - mBrowserBox->addRow(text); + setText(mText + text + "\n"); } void NpcTextDialog::action(const gcn::ActionEvent &event) { if (event.getId() == "ok") { - clearText(); + setText(""); setVisible(false); if (current_npc) current_npc->nextDialog(); current_npc = 0; } } + +void NpcTextDialog::widgetResized(const gcn::Event &event) +{ + Window::widgetResized(event); + + setText(mText); +} + |