1 #include "canvas-flag.h"
5 using namespace Gnome::Canvas;
8 CanvasFlag::CanvasFlag (MidiRegionView& region,
11 guint outline_color_rgba,
12 guint fill_color_rgba,
18 , _outline_color_rgba(outline_color_rgba)
19 , _fill_color_rgba(fill_color_rgba)
24 /* XXX this connection is needed if ::on_event() is changed to actually do anything */
25 signal_event().connect (sigc::mem_fun (*this, &CanvasFlag::on_event));
29 CanvasFlag::delete_allocated_objects()
42 CanvasFlag::set_text(const string& a_text)
44 delete_allocated_objects();
46 _text = new Text (*this, 0.0, 0.0, Glib::ustring(a_text));
47 _text->property_justification() = Gtk::JUSTIFY_CENTER;
48 _text->property_fill_color_rgba() = _outline_color_rgba;
49 double flagwidth = _text->property_text_width() + 10.0;
50 double flagheight = _text->property_text_height() + 3.0;
51 _text->property_x() = flagwidth / 2.0;
52 _text->property_y() = flagheight / 2.0;
54 _line = new SimpleLine(*this, 0.0, 0.0, 0.0, _height);
55 _line->property_color_rgba() = _outline_color_rgba;
56 _rect = new SimpleRect(*this, 0.0, 0.0, flagwidth, flagheight);
57 _rect->property_outline_color_rgba() = _outline_color_rgba;
58 _rect->property_fill_color_rgba() = _fill_color_rgba;
59 _text->raise_to_top();
61 /* XXX these two connections are needed if ::on_event() is changed to actually do anything */
62 //_rect->signal_event().connect (sigc::mem_fun (*this, &CanvasFlag::on_event));
63 //_text->signal_event().connect (sigc::mem_fun (*this, &CanvasFlag::on_event));
66 CanvasFlag::~CanvasFlag()
68 delete_allocated_objects();
72 CanvasFlag::on_event(GdkEvent* /*ev*/)
74 /* XXX if you change this function to actually do anything, be sure
75 to fix the connections commented out elsewhere in this file.