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 Canvas::Text *text = new Canvas::Text (*parent, property_x1()+w/2, h/2, s);
25 ViewBTreeData::Create (BTreeData *data, Canvas::Group *parent, double x1, double y1, double x2, double y2)
27 if (dynamic_cast<BTreeChildData *>(data))
28 return new ViewBTreeChildData (data, parent, x1, y1, x2, y2);
30 return new ViewBTreeData (data, parent, x1, y1, x2, y2);
33 ViewBTreeChildData::ViewBTreeChildData (BTreeData *data, Canvas::Group *parent, double x1, double y1, double x2, double y2):
34 ViewBTreeData (data, parent, x1, y1, x2, y2)
38 void ViewBTreeChildData::init (Canvas::Group *parent)
40 property_fill_color () = "yellow";
41 property_outline_color () = "black";
43 double w = property_x2() - property_x1();
44 double h = property_y2() - property_y1();
46 std::string s = *data;
47 Canvas::Text *text = new Canvas::Text (*parent, property_x1()+w/2, h/2, s);