Don't add auditioner and click to MIDI connection port matrices.
[ardour.git] / gtk2_ardour / interactive-item.h
index 1e8db12e4b78cb8d7e5dffdda5894d1d6585f004..25406bd7660c2d3e32d2641c588a18176594db61 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef __ardour_interactive_item_h__
 #define __ardour_interactive_item_h__
 
+#include <libgnomecanvasmm/text.h>
+#include "simplerect.h"
+
 namespace Gnome {
 namespace Canvas {
 
@@ -34,6 +37,53 @@ public:
        virtual bool on_event(GdkEvent* ev) = 0;
 };
 
+/** A canvas text that forwards events to its parent.
+ */
+class InteractiveText : public Text, public InteractiveItem {
+public:
+       InteractiveText(Group& parent, InteractiveItem* parent_item, double x, double y, const Glib::ustring& text) 
+               : Text(parent, x, y, text) 
+               , _parent_item(parent_item)
+       {}
+       
+       InteractiveText(Group& parent, InteractiveItem* parent_item)
+               : Text(parent)
+               , _parent_item(parent_item)
+       {}
+       
+       bool on_event(GdkEvent* ev) {
+               if(_parent_item) {
+                       return _parent_item->on_event(ev);
+               } else {
+                       return false;
+               }
+       }
+       
+protected:
+       InteractiveItem* _parent_item;
+};
+
+class InteractiveRect: public SimpleRect, public InteractiveItem
+{
+public:
+       InteractiveRect(Group& parent, InteractiveItem* parent_item,
+                       double x1, double y1, double x2, double y2) 
+               : SimpleRect(parent, x1, y1, x2, y2) 
+               , _parent_item(parent_item)
+       {}
+       
+       bool on_event(GdkEvent* ev) {
+               if (_parent_item) {
+                       return _parent_item->on_event(ev);
+               } else {
+                       return false;
+               }
+       }
+
+
+protected:
+       InteractiveItem* _parent_item;
+};
 
 } /* namespace Canvas */
 } /* namespace Gnome */