summaryrefslogtreecommitdiff
path: root/src/gui/interface/RichLabel.h
blob: d9682f23b248e401786fdba52e0fa7fc0d4a515e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once

#include <string>

#include "Component.h"
#include "Colour.h"

namespace ui
{
	class RichLabel : public Component
	{
	public:
		struct RichTextRegion
		{
			int start;
			int finish;
			int action;
			std::string actionData;
		};

		RichLabel(Point position, Point size, std::string richText);

		virtual ~RichLabel();

		virtual void SetText(std::string text);
		virtual std::string GetDisplayText();
		virtual std::string GetText();

		virtual void Draw(const Point& screenPos);
		virtual void OnMouseClick(int x, int y, unsigned button);
	protected:
		std::string textSource;
		std::string displayText;

		std::vector<RichTextRegion> regions;

		void updateRichText();
	};
}