8 #ifndef SSG_TEXTLABEL_HPP_ 9 #define SSG_TEXTLABEL_HPP_ 15 #include "Element.hpp" 16 #include "HaveFont.hpp" 17 #include "HaveMargin.hpp" 18 #include "HaveWordWrap.hpp" 19 #include "HaveHover.hpp" 21 #include "TextUpdater.hpp" 33 TextLabel(
const sf::String& name = sf::String(),
const sf::String& text = sf::String());
34 TextLabel(
const sf::String& name,
const sf::String& text,
bool autoResize);
35 TextLabel(
const sf::String& name,
bool autoResize);
38 virtual void draw(sf::RenderTarget& target, sf::RenderStates states)
override;
39 virtual bool update(sf::Vector2f mp,
bool pressLeft,
bool pressRight,
bool aboveHover)
override;
40 virtual void updateArea()
override;
41 virtual bool setColor(ColorId::Type colorId, StateId::Type stateId, sf::Color color)
override;
42 virtual bool setColorEnabled(ColorId::Type colorId, StateId::Type stateId,
bool enabled)
override;
43 virtual void setText(
const sf::String& text)
override;
44 virtual void fontChangeEvent()
override;
46 void setAlign(Align align);
47 void setVAlign(VAlign valign);
48 void setAutoResize(
bool autoResize);
49 void setAutoResizeParentLimit(
bool value);
50 bool autoResizeUpdate();
52 void setMinimumVisibleLines(
size_t value);
53 void revalidateTextAlign();
54 void setLinePrefix(
const sf::String& value);
55 sf::String getLinePrefix()
const;
58 std::vector<TextLine> parseLines(
const sf::String& lines);
61 void lazyRevalidateTextAlign();
64 Align align = Align::Left;
65 VAlign valign = VAlign::Top;
66 sf::String linePrefix;
67 std::vector<TextLine> lines;
68 std::vector<TextLine> wrapped;
69 float lastAreaHeight = 0.f;
70 float lastAreaWidth = 0.f;
71 bool dirtyFlag =
false;
73 static std::map<std::wstring, std::function<void(TextLine&, const std::wstring& value)> > parseFunctions;
74 static void updateAllLines();
75 static std::set<TextLabel*> textLabelSet;
78 static void initParseFunctions();
79 static bool parseColor(
const std::wstring& value, sf::Color& color);
83 typedef std::shared_ptr<TextLabel> TextLabelPtr;
Definition: TextLabel.hpp:26
Definition: FontManager.hpp:17
Definition: TextUpdater.hpp:14
Definition: HaveMargin.hpp:14
Definition: TextLine.hpp:16