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;
44 void set(const std::string &);
45 void erase(unsigned, unsigned);
46 void insert(unsigned, const std::string &);
47 const std::string &get() const { return text; }
48 unsigned size() const { return text.size(); }
49 unsigned get_n_lines() const { return lines.size(); }
50 unsigned get_line_length(unsigned) const;
51 void offset_to_coords(unsigned, unsigned &, unsigned &) const;
52 unsigned coords_to_offset(unsigned, unsigned) const;
53 Geometry coords_to_geometry(const Part &, const Geometry &, unsigned, unsigned, unsigned) const;
55 void build(const Part &, const Geometry &, CachedPart &) const;
56 void build(const Part &, const Geometry &, unsigned, CachedPart &) const;
58 Text &operator=(const std::string &);
62 template<typename T, void (Text::*)(unsigned, const Geometry &, T &) const>
63 void process_lines(const Part &, const Geometry &, unsigned, T &) const;
65 void build_line(unsigned, const Geometry &, RenderData &) const;
66 void coords_to_geom_line(unsigned, const Geometry &, CoordsToGeomData &) const;