Merge branch 'master' into cairocanvas
[ardour.git] / libs / canvas / canvas / rectangle.h
1 #ifndef __CANVAS_RECTANGLE_H__
2 #define __CANVAS_RECTANGLE_H__
3
4 #include "canvas/item.h"
5 #include "canvas/types.h"
6 #include "canvas/outline.h"
7 #include "canvas/fill.h"
8
9 namespace ArdourCanvas
10 {
11
12 class Rectangle : virtual public Item, public Outline, public Fill
13 {
14 public:
15         Rectangle (Group *);
16         Rectangle (Group *, Rect const &);
17         
18         void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
19         void compute_bounding_box () const;
20         XMLNode* get_state () const;
21         void set_state (XMLNode const *);
22
23         Rect const & get () const {
24                 return _rect;
25         }
26
27         Coord x0 () const {
28                 return _rect.x0;
29         }
30
31         Coord y0 () const {
32                 return _rect.y0;
33         }
34
35         Coord x1 () const {
36                 return _rect.x1;
37         }
38
39         Coord y1 () const {
40                 return _rect.y1;
41         }
42
43         void set (Rect const &);
44         void set_x0 (Coord);
45         void set_y0 (Coord);
46         void set_x1 (Coord);
47         void set_y1 (Coord);
48
49         enum What {
50                 LEFT = 0x1,
51                 RIGHT = 0x2,
52                 TOP = 0x4,
53                 BOTTOM = 0x8
54         };
55
56         void set_outline_what (What);
57         void set_outline_what (int);
58
59 private:
60         /** Our rectangle; note that x0 may not always be less than x1
61          *  and likewise with y0 and y1.
62          */
63         Rect _rect;
64         What _outline_what;
65 };
66
67 }
68
69 #endif