create class to hold drawing information
[mussa.git] / alg / drawable.hpp
diff --git a/alg/drawable.hpp b/alg/drawable.hpp
new file mode 100644 (file)
index 0000000..ca6610f
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef DRAWABLE_HPP_
+#define DRAWABLE_HPP_
+
+#include <boost/shared_ptr.hpp>
+
+#include "color.hpp"
+
+class Drawable;
+typedef boost::shared_ptr<Drawable> DrawableRef;
+
+/** 
+ * \brief Store the information needed to draw a sequence on some canvas 
+ */ 
+class Drawable {
+public:
+  Drawable() : 
+    draw_x(0), draw_y(0), draw_z(0), draw_height(0), draw_color(new Color) {}
+  Drawable(float x, float y, float z, float h, ColorRef c) :
+    draw_x(x), draw_y(y), draw_z(z), draw_height(h), draw_color(c) {}
+  Drawable(const DrawableRef d) :
+    draw_x(d->draw_x), draw_y(d->draw_y), draw_z(d->draw_z), 
+    draw_height(d->draw_height),
+    draw_color(new Color(d->draw_color))
+  {}
+    
+  //! set our starting x (horizontal) coordinate
+  void setX(float x) { draw_x = x; }
+  //! get our starting x (horizontal) coordinate
+  float x() const { return draw_x; }
+  //! set our current y (vertical) position
+  void setY(float y) { draw_y = y; }
+  //! get our current y (vertical) position
+  float y() const { return draw_y; }
+  //! set our current z (depth) position
+  void setZ(float z) { draw_z = z; }
+  //! get our current z (depth) position
+  float z() const { return draw_z; }
+  
+  //! set how tall our rectangle should be
+  float setHeight(float h) { draw_height = h; }
+  //! how thick (high) the track we're drawing is
+  float height() const { return draw_height; }
+
+  //! set our default draw color
+  void setColor(ColorRef c) { draw_color = c; }
+  //! return our draw color
+  ColorRef color() { return draw_color; }
+
+protected:
+  float draw_x;
+  float draw_y;
+  float draw_z;
+  float draw_height;
+  ColorRef draw_color;
+};
+#endif /*DRAWABLE_HPP_*/