9#include <unordered_map>
11#include <IGUIElement.h>
12#include <IGUIEnvironment.h>
23 ParsedText(
const wchar_t *text, video::SColor default_color);
62 typedef std::unordered_map<std::string, std::string>
StyleList;
63 typedef std::unordered_map<std::string, std::string>
AttrsList;
78 core::dimension2d<u32>
dim;
79 core::position2d<s32>
pos;
137 bool closeTag(
const std::string &name);
142 u32
parseTag(
const wchar_t *text, u32 cursor);
143 void parse(
const wchar_t *text);
164 video::SColor default_background_color,
165 video::SColor default_color);
167 void place(
const core::rect<s32> &dest_rect);
169 void draw(
const core::rect<s32> &clip_rect,
170 const core::position2d<s32> &dest_offset);
197 GUIHyperText(
const wchar_t *text, gui::IGUIEnvironment *environment,
198 gui::IGUIElement *parent, s32
id,
201 video::SColor default_background_color,
202 video::SColor default_color,
203 bool is_hypertip =
false);
214 bool OnEvent(
const SEvent &event);
216 void setStyles(
const std::array<StyleSpec, StyleSpec::NUM_STATES> &styles);
ISimpleTextureSource * m_tsrc
Definition guiHyperText.h:220
core::position2d< s32 > m_text_scrollpos
Definition guiHyperText.h:227
virtual void draw()
draws the element and its children
Definition guiHyperText.cpp:1212
u32 m_scrollbar_width
Definition guiHyperText.h:225
void checkHover(s32 X, s32 Y)
Definition guiHyperText.cpp:1108
video::SColor m_default_background_color
Definition guiHyperText.h:236
ParsedText::Element * getElementAt(s32 X, s32 Y)
Definition guiHyperText.cpp:1100
bool OnEvent(const SEvent &event)
Definition guiHyperText.cpp:1140
GUIScrollBar * m_vscrollbar
Definition guiHyperText.h:221
video::SColor m_default_color
Definition guiHyperText.h:237
s32 getTextHeight()
Returns the height of the text in pixels when it is drawn.
Definition guiHyperText.h:212
core::rect< s32 > m_display_text_rect
Definition guiHyperText.h:226
GUIHyperText(const wchar_t *text, gui::IGUIEnvironment *environment, gui::IGUIElement *parent, s32 id, const core::rect< s32 > &rectangle, Client *client, ISimpleTextureSource *tsrc, video::SColor default_background_color, video::SColor default_color, bool is_hypertip=false)
constructor
Definition guiHyperText.cpp:1064
virtual ~GUIHyperText()
destructor
Definition guiHyperText.cpp:1094
void setStyles(const std::array< StyleSpec, StyleSpec::NUM_STATES > &styles)
Definition guiHyperText.cpp:1131
TextDrawer m_drawer
Definition guiHyperText.h:222
int m_draw_state
Definition guiHyperText.h:234
Definition texturesource.h:34
Definition guiHyperText.h:21
void enterParagraph()
Definition guiHyperText.cpp:251
ParsedText(const wchar_t *text, video::SColor default_color)
Definition guiHyperText.cpp:89
void enterElement(ElementType type)
Definition guiHyperText.cpp:261
video::ITexture * background_image
Definition guiHyperText.h:120
bool border
Definition guiHyperText.h:122
void endElement()
Definition guiHyperText.cpp:228
EndReason
Definition guiHyperText.h:127
@ ER_NONE
Definition guiHyperText.h:127
@ ER_TAG
Definition guiHyperText.h:127
@ ER_NEWLINE
Definition guiHyperText.h:127
std::unordered_map< std::string, std::string > AttrsList
Definition guiHyperText.h:63
video::SColor background_color
Definition guiHyperText.h:119
bool closeTag(const std::string &name)
Definition guiHyperText.cpp:306
ParsedText::Tag * openTag(const std::string &name, const AttrsList &attrs)
Definition guiHyperText.cpp:299
std::vector< Tag * > m_not_root_tags
Definition guiHyperText.h:148
void globalTag(const ParsedText::AttrsList &attrs)
Definition guiHyperText.cpp:346
BackgroundType
Definition guiHyperText.h:35
@ BACKGROUND_NONE
Definition guiHyperText.h:36
@ BACKGROUND_COLOR
Definition guiHyperText.h:37
void endParagraph(EndReason reason)
Definition guiHyperText.cpp:233
std::unordered_map< std::string, std::string > StyleList
Definition guiHyperText.h:62
ValignType
Definition guiHyperText.h:56
@ VALIGN_MIDDLE
Definition guiHyperText.h:57
@ VALIGN_BOTTOM
Definition guiHyperText.h:59
@ VALIGN_TOP
Definition guiHyperText.h:58
void parse(const wchar_t *text)
Definition guiHyperText.cpp:170
Paragraph * m_paragraph
Definition guiHyperText.h:154
u32 parseTag(const wchar_t *text, u32 cursor)
Definition guiHyperText.cpp:386
StyleList m_style
Definition guiHyperText.h:152
~ParsedText()
Definition guiHyperText.cpp:164
core::rect< s32 > background_middle
Definition guiHyperText.h:121
Tag m_root_tag
Definition guiHyperText.h:124
void parseGenericStyleAttr(const std::string &name, const std::string &value, StyleList &style)
Definition guiHyperText.cpp:318
void pushChar(wchar_t c)
Definition guiHyperText.cpp:274
FloatType
Definition guiHyperText.h:41
@ FLOAT_NONE
Definition guiHyperText.h:42
@ FLOAT_LEFT
Definition guiHyperText.h:44
@ FLOAT_RIGHT
Definition guiHyperText.h:43
std::list< Tag * > m_active_tags
Definition guiHyperText.h:149
EndReason m_end_paragraph_reason
Definition guiHyperText.h:156
HalignType
Definition guiHyperText.h:48
@ HALIGN_RIGHT
Definition guiHyperText.h:51
@ HALIGN_LEFT
Definition guiHyperText.h:50
@ HALIGN_JUSTIFY
Definition guiHyperText.h:52
@ HALIGN_CENTER
Definition guiHyperText.h:49
ValignType valign
Definition guiHyperText.h:117
std::unordered_map< std::string, StyleList > m_paragraphtags
Definition guiHyperText.h:146
void parseStyles(const AttrsList &attrs, StyleList &style)
Definition guiHyperText.cpp:340
std::unordered_map< std::string, StyleList > m_elementtags
Definition guiHyperText.h:145
s32 margin
Definition guiHyperText.h:116
ElementType
Definition guiHyperText.h:27
@ ELEMENT_SEPARATOR
Definition guiHyperText.h:29
@ ELEMENT_TEXT
Definition guiHyperText.h:28
@ ELEMENT_IMAGE
Definition guiHyperText.h:30
@ ELEMENT_ITEM
Definition guiHyperText.h:31
bool m_empty_paragraph
Definition guiHyperText.h:155
Element * m_element
Definition guiHyperText.h:153
std::vector< Paragraph > m_paragraphs
Definition guiHyperText.h:113
BackgroundType background_type
Definition guiHyperText.h:118
ParsedText::Tag * newTag(const std::string &name, const AttrsList &attrs)
Definition guiHyperText.cpp:289
Definition StyleSpec.h:18
Definition guiHyperText.h:160
s32 getHeight()
Definition guiHyperText.h:168
void drawBackgroundImage(video::IVideoDriver *driver, const core::rect< s32 > &clip_rect)
Definition guiHyperText.cpp:939
std::vector< RectWithMargin > m_floating
Definition guiHyperText.h:189
void draw(const core::rect< s32 > &clip_rect, const core::position2d< s32 > &dest_offset)
Definition guiHyperText.cpp:958
ParsedText::Element * getElementAt(core::position2d< s32 > pos)
Definition guiHyperText.cpp:680
ParsedText::Tag * m_hovertag
Definition guiHyperText.h:174
TextDrawer(const wchar_t *text, Client *client, gui::IGUIEnvironment *environment, ISimpleTextureSource *tsrc, video::SColor default_background_color, video::SColor default_color)
Definition guiHyperText.cpp:621
Client * m_client
null in the mainmenu
Definition guiHyperText.h:184
s32 m_voffset
Definition guiHyperText.h:188
void place(const core::rect< s32 > &dest_rect)
Definition guiHyperText.cpp:701
void applyStyleSpecToText(const StyleSpec &style)
Definition guiHyperText.cpp:1046
ISimpleTextureSource * m_tsrc
Definition guiHyperText.h:185
s32 m_height
Definition guiHyperText.h:187
video::SColor m_default_background_color
Definition guiHyperText.h:190
gui::IGUIEnvironment * m_guienv
Definition guiHyperText.h:186
ParsedText m_text
Definition guiHyperText.h:183
core::vector3d< s16 > v3s16
Definition irr_v3d.h:13
Definition activeobjectmgr.cpp:11
Definition guiHyperText.h:73
video::SColor hovercolor
Definition guiHyperText.h:89
s32 baseline
Definition guiHyperText.h:92
std::string name
Definition guiHyperText.h:95
s32 margin
Definition guiHyperText.h:99
video::SColor color
Definition guiHyperText.h:88
bool underline
Definition guiHyperText.h:90
v3s16 rotation
Definition guiHyperText.h:97
v3s16 angle
Definition guiHyperText.h:96
core::position2d< s32 > pos
Definition guiHyperText.h:79
void setStyle(StyleList &style)
Definition guiHyperText.cpp:42
std::list< Tag * > tags
Definition guiHyperText.h:74
s32 drawwidth
Definition guiHyperText.h:80
gui::IGUIFont * font
Definition guiHyperText.h:86
ElementType type
Definition guiHyperText.h:75
ValignType valign
Definition guiHyperText.h:84
FloatType floating
Definition guiHyperText.h:82
core::dimension2d< u32 > dim
Definition guiHyperText.h:78
core::stringw text
Definition guiHyperText.h:76
Definition guiHyperText.h:105
void setStyle(StyleList &style)
Definition guiHyperText.cpp:77
std::vector< Element > elements
Definition guiHyperText.h:106
HalignType halign
Definition guiHyperText.h:107
s32 margin
Definition guiHyperText.h:108
Definition guiHyperText.h:66
AttrsList attrs
Definition guiHyperText.h:68
std::string name
Definition guiHyperText.h:67
StyleList style
Definition guiHyperText.h:69
Definition guiHyperText.h:178
s32 margin
Definition guiHyperText.h:180
core::rect< s32 > rect
Definition guiHyperText.h:179