1 #ifndef MSP_GLTK_TEXT_H_
2 #define MSP_GLTK_TEXT_H_
17 Stores and renders text. Supports multiline text.
31 struct CoordsToGeomData;
35 std::vector<Line> lines;
39 Text(const Style &, const std::string &);
41 void set_style(const Style *);
43 unsigned get_width() const;
44 unsigned get_height() const;
45 void autosize(const Part &, Geometry &) const;
47 void set(const std::string &);
48 void erase(unsigned, unsigned);
49 void insert(unsigned, const std::string &);
50 const std::string &get() const { return text; }
51 unsigned size() const { return text.size(); }
52 unsigned get_n_lines() const { return lines.size(); }
53 unsigned get_visible_lines(const Part &, const Geometry &, unsigned *) const;
54 unsigned get_line_length(unsigned) const;
55 unsigned move_offset(unsigned, int) const;
56 void offset_to_coords(unsigned, unsigned &, unsigned &) const;
57 unsigned coords_to_offset(unsigned, unsigned) const;
58 Geometry coords_to_geometry(const Part &, const Geometry &, unsigned, unsigned, unsigned) const;
60 void build(const Part &, State, const Geometry &, PartCache &) const;
61 void build(const Part &, State, const Geometry &, unsigned, PartCache &) const;
63 Text &operator=(const std::string &);
66 unsigned count_characters(unsigned, unsigned) const;
67 void check_alignment(unsigned) const;
70 void process_lines(const Part &, const Geometry &, unsigned, void (Text::*)(unsigned, const Geometry &, T &) const, T &) const;
72 void build_line(unsigned, const Geometry &, RenderData &) const;
73 void coords_to_geom_line(unsigned, const Geometry &, CoordsToGeomData &) const;