1 #ifndef MSP_GLTK_TEXT_H_
2 #define MSP_GLTK_TEXT_H_
17 Stores and renders text. Supports multiline text.
30 struct CoordsToGeomData;
34 std::vector<Line> lines;
38 Text(const Style &, const std::string &);
40 void set_style(const Style *);
42 unsigned get_width() const;
43 unsigned get_height() const;
44 void autosize(const Part &, Geometry &) const;
46 void set(const std::string &);
47 void erase(unsigned, unsigned);
48 void insert(unsigned, const std::string &);
49 const std::string &get() const { return text; }
50 unsigned size() const { return text.size(); }
51 unsigned get_n_lines() const { return lines.size(); }
52 unsigned get_line_length(unsigned) const;
53 void offset_to_coords(unsigned, unsigned &, unsigned &) const;
54 unsigned coords_to_offset(unsigned, unsigned) const;
55 Geometry coords_to_geometry(const Part &, const Geometry &, unsigned, unsigned, unsigned) const;
57 void build(const Part &, State, const Geometry &, PartCache &) const;
58 void build(const Part &, State, const Geometry &, unsigned, PartCache &) const;
60 Text &operator=(const std::string &);
64 template<typename T, void (Text::*)(unsigned, const Geometry &, T &) const>
65 void process_lines(const Part &, const Geometry &, unsigned, T &) const;
67 void build_line(unsigned, const Geometry &, RenderData &) const;
68 void coords_to_geom_line(unsigned, const Geometry &, CoordsToGeomData &) const;