8 #ifndef Guit_TextImpl_hpp
9 #define Guit_TextImpl_hpp
11 #include <ggraphics.hpp>
20 Row(
float y,
float h,
size_t start) : y_(y), h_(h), start_(start) {}
22 size_t start_{}, length_{};
24 ~GTextCache() {
delete rows_;}
25 std::vector<Row> *rows_{};
31 GTextRender(GFontValue
const&,
bool richtext, GRgba
const* color,
32 size_t selbegin,
size_t selend, GTextAttributes
const*);
34 GDim getSize(GString
const& text);
35 void draw(GGraphics&,
float x,
float y, GString
const& text,
size_t offset);
38 static GDim layoutText(GFontValue
const&,
bool richtext, GString
const& text,
39 float maxwidth, GTextAttributes
const*,
42 int attrFound(GString
const& text,
size_t offset);
43 void drawPart(GGraphics&,
float x,
float y, GString
const& text,
44 bool drawlast,
bool insel);
45 bool findCurrentAttr(
size_t offset);
46 bool processAttr(GGraphics*,
float x,
float y,
int delim,
47 GString
const& attr,
size_t offset);
48 void processAttrBegin(GGraphics*,
float x,
float y, GPropList
const&) ;
49 void processAttrBegin(GGraphics*,
float x,
float y, GString
const& attr);
50 void processAttrEnd();
51 void processImage(GGraphics*,
float x,
float y,
size_t from, GString
const& attr);
55 size_t pos_, begpart_, selbegin_, selend_;
56 GTextAttributes
const* attrlist_{};
57 GTextAttr
const* curattr_{};
61 StackNode(GFontValue
const& font, GRgba
const& color, GRgba
const& bg)
62 : font_(font), color_(color), bgcolor_(bg) {}
64 GRgba color_, bgcolor_;
66 std::vector<StackNode> stack_;