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();
18 Canvas::Rect *ptr = new Canvas::Rect (*parent, property_x1()+w-NODE_PTR_WIDTH, h-NODE_PTR_WIDTH, property_x1()+w-1, h-1);
19 ptr->property_fill_color () = "green";
20 ptr->property_outline_color () = "black";
23 bool ViewBTreeData::on_event (GdkEvent *p1)
26 case GDK_BUTTON_PRESS:
29 case GDK_2BUTTON_PRESS:
30 m_signal_double_clicked (data, this);
33 return Canvas::Rect::on_event (p1);
37 ViewBTreeData::type_signal_clicked ViewBTreeData::signal_clicked ()
39 return m_signal_clicked;
42 ViewBTreeData::type_signal_double_clicked ViewBTreeData::signal_double_clicked ()
44 return m_signal_double_clicked;
49 ViewBTreeData::Create (BTreeData *data, Canvas::Group *parent, double x1, double y1, double x2, double y2)
52 if (dynamic_cast<BTreeChildData *>(data))
53 ret = new ViewBTreeChildData (data, parent, x1, y1, x2, y2);
55 ret = new ViewBTreeData (data, parent, x1, y1, x2, y2);
60 ViewBTreeChildData::ViewBTreeChildData (BTreeData *data, Canvas::Group *parent, double x1, double y1, double x2, double y2):
61 ViewBTreeData (data, parent, x1, y1, x2, y2)
65 void ViewBTreeChildData::init (Canvas::Group *parent)
67 property_outline_color () = "black";
70 void ViewBTreeData::SetSelected (bool b)
73 property_fill_color () = "yellow";
74 m_signal_clicked(data, this);
76 property_fill_color () = "red";
80 bool ViewBTreeData::operator == (Clave &k) const
82 if (!data->GetKey ()) return false;
84 return (*(data->GetKey ())) == k;