1 #ifndef MSP_GLTK_TEXT_H_
2 #define MSP_GLTK_TEXT_H_
16 Stores and renders text. Supports multiline text.
29 struct CoordsToGeomData;
33 std::vector<Line> lines;
37 Text(const Style &, const std::string &);
39 void set_style(const Style *);
41 unsigned get_width() const;
42 unsigned get_height() const;
43 void autosize(const Part &, Geometry &) const;
45 void set(const std::string &);
46 void erase(unsigned, unsigned);
47 void insert(unsigned, const std::string &);
48 const std::string &get() const { return text; }
49 unsigned size() const { return text.size(); }
50 unsigned get_n_lines() const { return lines.size(); }
51 unsigned get_line_length(unsigned) const;
52 void offset_to_coords(unsigned, unsigned &, unsigned &) const;
53 unsigned coords_to_offset(unsigned, unsigned) const;
54 Geometry coords_to_geometry(const Part &, const Geometry &, unsigned, unsigned, unsigned) const;
56 void build(const Part &, const Geometry &, PartCache &) const;
57 void build(const Part &, const Geometry &, unsigned, PartCache &) const;
59 Text &operator=(const std::string &);
63 template<typename T, void (Text::*)(unsigned, const Geometry &, T &) const>
64 void process_lines(const Part &, const Geometry &, unsigned, T &) const;
66 void build_line(unsigned, const Geometry &, RenderData &) const;
67 void coords_to_geom_line(unsigned, const Geometry &, CoordsToGeomData &) const;