2 #include "view_btree_data.h"
3 #define NODE_PTR_WIDTH 5
5 ViewBTreeData::ViewBTreeData (BTreeData *data, Canvas::Group *parent, double x1, double y1, double x2, double y2):
6 Canvas::Rect (*parent, x1, y1, x2, y2)
9 property_fill_color () = "red";
10 property_outline_color () = "black";
13 void ViewBTreeData::init (Canvas::Group *parent)
15 double w = property_x2() - property_x1();
16 double h = property_y2() - property_y1();
19 bool ViewBTreeData::on_event (GdkEvent *p1)
22 case GDK_BUTTON_PRESS:
25 case GDK_2BUTTON_PRESS:
26 m_signal_double_clicked (data, this);
29 return Canvas::Rect::on_event (p1);
33 ViewBTreeData::type_signal_clicked ViewBTreeData::signal_clicked ()
35 return m_signal_clicked;
38 ViewBTreeData::type_signal_double_clicked ViewBTreeData::signal_double_clicked ()
40 return m_signal_double_clicked;
45 ViewBTreeData::Create (BTreeData *data, Canvas::Group *parent, double x1, double y1, double x2, double y2)
48 if (dynamic_cast<BTreeChildData *>(data))
49 ret = new ViewBTreeChildData (data, parent, x1, y1, x2, y2);
51 ret = new ViewBTreeData (data, parent, x1, y1, x2, y2);
56 ViewBTreeChildData::ViewBTreeChildData (BTreeData *data, Canvas::Group *parent, double x1, double y1, double x2, double y2):
57 ViewBTreeData (data, parent, x1, y1, x2, y2)
61 void ViewBTreeChildData::init (Canvas::Group *parent)
63 property_outline_color () = "black";
66 void ViewBTreeData::SetSelected (bool b)
69 property_fill_color () = "yellow";
70 m_signal_clicked(data, this);
72 property_fill_color () = "red";
76 bool ViewBTreeData::operator == (Clave &k) const
78 if (!data->GetKey ()) return false;
80 return (*(data->GetKey ())) == k;