diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-06-23 22:18:46 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-06-23 22:19:06 +0200 |
commit | 1beebda470d6665df30c9f165f075067a47ad97d (patch) | |
tree | 5e9f912a46648db2f426aa9aad79c6b7b23055cc /src/gui/npcdialog.h | |
parent | 4e134f35cab90f28408cb834a77604a5f942b457 (diff) | |
download | mana-1beebda470d6665df30c9f165f075067a47ad97d.tar.gz mana-1beebda470d6665df30c9f165f075067a47ad97d.tar.bz2 mana-1beebda470d6665df30c9f165f075067a47ad97d.tar.xz mana-1beebda470d6665df30c9f165f075067a47ad97d.zip |
Added support for text formatting and links to NPC dialog
Use BrowserBox in NpcDialog to enable the use of text formatting and
links in NPC texts.
This change is roughly based on ManaPlus commit
94f11a223e03c6845e7ce6e9fe67c0e9fa7061f4.
Diffstat (limited to 'src/gui/npcdialog.h')
-rw-r--r-- | src/gui/npcdialog.h | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h index 36fda2b1..b902f044 100644 --- a/src/gui/npcdialog.h +++ b/src/gui/npcdialog.h @@ -30,13 +30,15 @@ #include <guichan/listmodel.hpp> #include <list> +#include <memory> #include <string> #include <vector> -class TextBox; +class BrowserBox; class ListBox; class TextField; class IntTextField; +class ItemLinkHandler; class Button; /** @@ -64,7 +66,7 @@ class NpcDialog : public Window, * * @param string The new text. */ - void setText(const std::string &string); + void setText(const std::vector<std::string> &string); /** * Adds the text to the text shows in the dialog. Also adds a newline @@ -139,13 +141,6 @@ class NpcDialog : public Window, void move(int amount); - /** - * Called when resizing the window. - * - * @param event The calling event - */ - void widgetResized(const gcn::Event &event) override; - void setVisible(bool visible) override; void event(Event::Channel channel, const Event &event) override; @@ -182,9 +177,10 @@ class NpcDialog : public Window, // Used for the main input area gcn::ScrollArea *mScrollArea; - TextBox *mTextBox; - std::string mText; - std::string mNewText; + BrowserBox *mTextBox; + std::vector<std::string> mNewText; + + std::unique_ptr<ItemLinkHandler> mItemLinkHandler; // Used for choice input ListBox *mItemList; |