create class to hold drawing information
[mussa.git] / alg / drawable.hpp
1 #ifndef DRAWABLE_HPP_
2 #define DRAWABLE_HPP_
3
4 #include <boost/shared_ptr.hpp>
5
6 #include "color.hpp"
7
8 class Drawable;
9 typedef boost::shared_ptr<Drawable> DrawableRef;
10
11 /** 
12  * \brief Store the information needed to draw a sequence on some canvas 
13  */ 
14 class Drawable {
15 public:
16   Drawable() : 
17     draw_x(0), draw_y(0), draw_z(0), draw_height(0), draw_color(new Color) {}
18   Drawable(float x, float y, float z, float h, ColorRef c) :
19     draw_x(x), draw_y(y), draw_z(z), draw_height(h), draw_color(c) {}
20   Drawable(const DrawableRef d) :
21     draw_x(d->draw_x), draw_y(d->draw_y), draw_z(d->draw_z), 
22     draw_height(d->draw_height),
23     draw_color(new Color(d->draw_color))
24   {}
25     
26   //! set our starting x (horizontal) coordinate
27   void setX(float x) { draw_x = x; }
28   //! get our starting x (horizontal) coordinate
29   float x() const { return draw_x; }
30   //! set our current y (vertical) position
31   void setY(float y) { draw_y = y; }
32   //! get our current y (vertical) position
33   float y() const { return draw_y; }
34   //! set our current z (depth) position
35   void setZ(float z) { draw_z = z; }
36   //! get our current z (depth) position
37   float z() const { return draw_z; }
38   
39   //! set how tall our rectangle should be
40   float setHeight(float h) { draw_height = h; }
41   //! how thick (high) the track we're drawing is
42   float height() const { return draw_height; }
43
44   //! set our default draw color
45   void setColor(ColorRef c) { draw_color = c; }
46   //! return our draw color
47   ColorRef color() { return draw_color; }
48
49 protected:
50   float draw_x;
51   float draw_y;
52   float draw_z;
53   float draw_height;
54   ColorRef draw_color;
55 };
56 #endif /*DRAWABLE_HPP_*/