1 #ifndef MSP_GLTK_TEXT_H_
2 #define MSP_GLTK_TEXT_H_
15 Stores and renders text. Supports multiline text.
28 struct CoordsToGeomData;
32 std::vector<Line> lines;
36 Text(const Style &, const std::string &);
38 void set_style(const Style *);
40 unsigned get_width() const;
41 unsigned get_height() const;
43 void set(const std::string &);
44 void erase(unsigned, unsigned);
45 void insert(unsigned, const std::string &);
46 const std::string &get() const { return text; }
47 unsigned size() const { return text.size(); }
48 unsigned get_n_lines() const { return lines.size(); }
49 unsigned get_line_length(unsigned) const;
50 void offset_to_coords(unsigned, unsigned &, unsigned &) const;
51 unsigned coords_to_offset(unsigned, unsigned) const;
52 Geometry coords_to_geometry(const Part &, const Geometry &, unsigned, unsigned, unsigned) const;
54 void render(const Part &, const Geometry &, unsigned = 0) const;
56 Text &operator=(const std::string &);
60 template<typename T, void (Text::*)(unsigned, const Geometry &, T &) const>
61 void process_lines(const Part &, const Geometry &, unsigned, T &) const;
63 void render_line(unsigned, const Geometry &, RenderData &) const;
64 void coords_to_geom_line(unsigned, const Geometry &, CoordsToGeomData &) const;