2 #include "view_btree_data.h"
4 ViewBTreeData::ViewBTreeData (BTreeData *data, Canvas::Group *parent, double x1, double y1, double x2, double y2):
5 Canvas::Rect (*parent, x1, y1, x2, y2)
8 property_fill_color () = "red";
9 property_outline_color () = "black";
14 void ViewBTreeData::init (Canvas::Group *parent)
16 double w = property_x2() - property_x1();
17 double h = property_y2() - property_y1();
19 std::string s = *data;
20 new Canvas::Text (*parent, property_x1()+w/2, h/2, s);
23 bool ViewBTreeData::on_event (GdkEvent *p1)
26 case GDK_BUTTON_PRESS:
27 m_signal_clicked(data);
30 return Canvas::Rect::on_event (p1);
34 ViewBTreeData::type_signal_clicked ViewBTreeData::signal_clicked ()
36 return m_signal_clicked;
40 ViewBTreeData::Create (BTreeData *data, Canvas::Group *parent, double x1, double y1, double x2, double y2)
42 if (dynamic_cast<BTreeChildData *>(data))
43 return new ViewBTreeChildData (data, parent, x1, y1, x2, y2);
45 return new ViewBTreeData (data, parent, x1, y1, x2, y2);
48 ViewBTreeChildData::ViewBTreeChildData (BTreeData *data, Canvas::Group *parent, double x1, double y1, double x2, double y2):
49 ViewBTreeData (data, parent, x1, y1, x2, y2)
53 void ViewBTreeChildData::init (Canvas::Group *parent)
55 property_fill_color () = "yellow";
56 property_outline_color () = "black";
58 double w = property_x2() - property_x1();
59 double h = property_y2() - property_y1();
61 std::string s = *data;
62 Canvas::Text *text = new Canvas::Text (*parent, property_x1()+w/2, h/2, s);