mo' better debugging of canvas "structure" via Item::dump and derivatives
[ardour.git] / libs / canvas / canvas / text.h
1 #ifndef __ardour_canvas_text_h__
2 #define __ardour_canvas_text_h__
3
4 #include <pangomm/fontdescription.h>
5 #include <pangomm/layout.h>
6
7 #include "canvas/item.h"
8
9 namespace ArdourCanvas {
10
11 class Text : public Item
12 {
13 public:
14         Text (Group *);
15        ~Text();
16
17         void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
18         void compute_bounding_box () const;
19         XMLNode* get_state () const;
20         void set_state (XMLNode const *);
21
22         void set (std::string const &);
23         void set_color (uint32_t);
24         void set_font_description (Pango::FontDescription);
25         void set_alignment (Pango::Alignment);
26
27         void set_size_chars (int nchars);
28         void dump (std::ostream&) const;
29
30 private:
31         std::string      _text;
32         uint32_t         _color;
33         Pango::FontDescription* _font_description;
34         Pango::Alignment _alignment;
35         mutable Cairo::RefPtr<Cairo::ImageSurface> _image;
36         mutable Duple _origin;
37         mutable int _width;
38         mutable int _height;
39         mutable bool _need_redraw;
40
41         void redraw (Cairo::RefPtr<Cairo::Context>) const;
42 };
43
44 }
45
46 #endif /* __ardour_canvas_text_h__ */