4 #include "canvas-flag.h"
5 #include "time_axis_view_item.h"
7 using namespace Gnome::Canvas;
10 CanvasFlag::CanvasFlag (MidiRegionView& region,
13 guint outline_color_rgba,
14 guint fill_color_rgba,
20 , _outline_color_rgba(outline_color_rgba)
21 , _fill_color_rgba(fill_color_rgba)
26 /* XXX this connection is needed if ::on_event() is changed to actually do anything */
27 signal_event().connect (sigc::mem_fun (*this, &CanvasFlag::on_event));
31 CanvasFlag::delete_allocated_objects()
44 CanvasFlag::set_text(const string& a_text)
46 delete_allocated_objects();
48 _text = new NoEventText (*this, 0.0, 0.0, a_text);
49 _text->property_justification() = Gtk::JUSTIFY_CENTER;
50 _text->property_fill_color_rgba() = _outline_color_rgba;
51 _text->property_font_desc() = TimeAxisViewItem::NAME_FONT;
52 double flagwidth = _text->property_text_width() + 10.0;
53 double flagheight = _text->property_text_height() + 3.0;
54 _text->property_x() = flagwidth / 2.0;
55 _text->property_y() = flagheight / 2.0;
57 _line = new SimpleLine(*this, 0.0, 0.0, 0.0, _height);
58 _line->property_color_rgba() = _outline_color_rgba;
59 _rect = new SimpleRect(*this, 0.0, 0.0, flagwidth, flagheight);
60 _rect->property_outline_color_rgba() = _outline_color_rgba;
61 _rect->property_fill_color_rgba() = _fill_color_rgba;
62 _text->raise_to_top();
64 /* XXX these two connections are needed if ::on_event() is changed to actually do anything */
65 //_rect->signal_event().connect (sigc::mem_fun (*this, &CanvasFlag::on_event));
66 //_text->signal_event().connect (sigc::mem_fun (*this, &CanvasFlag::on_event));
69 CanvasFlag::~CanvasFlag()
71 delete_allocated_objects();
75 CanvasFlag::on_event(GdkEvent* /*ev*/)
77 /* XXX if you change this function to actually do anything, be sure
78 to fix the connections commented out elsewhere in this file.
84 CanvasFlag::set_height (double h)
89 _line->property_y2() = _height;