From 1beebda470d6665df30c9f165f075067a47ad97d Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sun, 23 Jun 2024 22:18:46 +0200 Subject: 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. --- src/gui/npcdialog.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/gui/npcdialog.h') 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 #include +#include #include #include -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 &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 mNewText; + + std::unique_ptr mItemLinkHandler; // Used for choice input ListBox *mItemList; -- cgit v1.2.3-70-g09d2