diff options
author | Hans Baier <hansfbaier@googlemail.com> | 2008-12-24 01:24:49 +0000 |
---|---|---|
committer | Hans Baier <hansfbaier@googlemail.com> | 2008-12-24 01:24:49 +0000 |
commit | e2147fbc5bf0546fcafa32fe1d87f6e6d1b652c4 (patch) | |
tree | 8dbce0956cfa1bb33f75cc5cd5e1bfc58633fc63 /gtk2_ardour/interactive-item.h | |
parent | 2a2067388314ae1695f3be4d6ea9e3c3628f91ba (diff) |
* implemented three coloring modes for MIDI tracks (untested yet)
git-svn-id: svn://localhost/ardour2/branches/3.0@4344 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/interactive-item.h')
-rw-r--r-- | gtk2_ardour/interactive-item.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/gtk2_ardour/interactive-item.h b/gtk2_ardour/interactive-item.h index 1e8db12e4b..145a592511 100644 --- a/gtk2_ardour/interactive-item.h +++ b/gtk2_ardour/interactive-item.h @@ -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, double x, double y, const Glib::ustring& text) + : Text(parent, x, y, text) + { + _parent = dynamic_cast<InteractiveItem*>(&parent); + } + + InteractiveText(Group& parent) + : Text(parent) + { + _parent = dynamic_cast<InteractiveItem*>(&parent); + } + + bool on_event(GdkEvent* ev) { + if(_parent) { + return _parent->on_event(ev); + } else { + return false; + } + } + +protected: + InteractiveItem* _parent; +}; + +class InteractiveRect: public SimpleRect, public InteractiveItem +{ +public: + InteractiveRect(Group& parent, double x1, double y1, double x2, double y2) + : SimpleRect(parent, x1, y1, x2, y2) { + _parent = dynamic_cast<InteractiveItem*>(&parent); + } + + bool on_event(GdkEvent* ev) { + if(_parent) { + return _parent->on_event(ev); + } else { + return false; + } + } + +protected: + InteractiveItem* _parent; +}; } /* namespace Canvas */ } /* namespace Gnome */ |