First cut at mouseovers for the port matrix.
[ardour.git] / gtk2_ardour / port_matrix_component.h
index cc0f0826954188f38e86ba69d6d083adc39269a8..7531e44bddd81cf06ed8ea488bdd00139a669a48 100644 (file)
@@ -23,6 +23,7 @@
 #include <gtkmm/eventbox.h>
 
 class PortMatrixBody;
+class PortMatrixNode;
 
 /** One component of the PortMatrix.  This is a cairo-rendered
  *  Pixmap.
@@ -33,6 +34,13 @@ public:
        PortMatrixComponent (PortMatrixBody *);
        virtual ~PortMatrixComponent ();
 
+       virtual double component_to_parent_x (double x) const = 0;
+       virtual double parent_to_component_x (double x) const = 0;
+       virtual double component_to_parent_y (double y) const = 0;
+       virtual double parent_to_component_y (double y) const = 0;
+       virtual void mouseover_changed (PortMatrixNode const &) = 0;
+       virtual void draw_extra (cairo_t *) = 0;
+
        void setup ();
        GdkPixmap* get_pixmap (GdkDrawable *);
        std::pair<uint32_t, uint32_t> dimensions ();
@@ -46,6 +54,14 @@ public:
                _render_required = true;
        }
 
+       void set_parent_rectangle (Gdk::Rectangle const & r) {
+               _parent_rectangle = r;
+       }
+
+       Gdk::Rectangle parent_rectangle () const {
+               return _parent_rectangle;
+       }
+
        /** @return width of columns in the grid */
        static uint32_t column_width () {
                return 32;
@@ -83,6 +99,10 @@ protected:
                return 8;
        }
 
+       static uint32_t mouseover_line_width () {
+               return 4;
+       }
+
        /** @return angle of column labels, in radians */
        static double angle () {
                return M_PI / 4;
@@ -115,6 +135,16 @@ protected:
                return Gdk::Color ("#cccccc");
        }
 
+       /** @return colour to paint mouseover lines */
+       static Gdk::Color mouseover_line_colour () {
+               return Gdk::Color ("#ff0000");
+       }
+
+       /** @return colour to paint mouseover lines */
+       static Gdk::Color mouseover_port_colour () {
+               return Gdk::Color ("#777777");
+       }
+
        /* XXX */
        static Gdk::Color get_a_bundle_colour (int x) {
                if ((x % 2) == 0) {
@@ -147,6 +177,7 @@ protected:
        PortMatrixBody* _body; ///< the PortMatrixBody that we're in
        uint32_t _width; ///< full width of the contents
        uint32_t _height; ///< full height of the contents
+       Gdk::Rectangle _parent_rectangle;
 
 private:       
        GdkPixmap* _pixmap; ///< pixmap