2 #include "view_properties.h"
4 ViewProperties::ViewProperties ():Frame ()
6 lnode_num.set_use_markup (true);
7 lnode_level.set_use_markup (true);
8 lnode_items.set_use_markup (true);
9 lnode_freespace.set_use_markup (true);
10 ldata_type.set_use_markup (true);
11 ldata_key.set_use_markup (true);
12 ldata_child.set_use_markup (true);
14 lnode_num.set_label ("<b>Nodo</b> :");
15 lnode_level.set_label ("<b>Nivel</b> : ");
16 lnode_items.set_label ("<b>Items</b> :");
17 lnode_freespace.set_label ("<b>Libre</b> :");
18 ldata_type.set_label ("<b>Tipo</b> :");
19 ldata_key.set_label ("<b>Clave</b> : ");
20 ldata_child.set_label ("<b>Hijo</b> : ");
22 lnode_num.set_alignment(Gtk::JUSTIFY_LEFT);
23 lnode_level.set_alignment(Gtk::JUSTIFY_LEFT);
24 lnode_items.set_alignment(Gtk::JUSTIFY_LEFT);
25 lnode_freespace.set_alignment(Gtk::JUSTIFY_LEFT);
26 ldata_type.set_alignment(Gtk::JUSTIFY_LEFT);
27 ldata_key.set_alignment(Gtk::JUSTIFY_LEFT);
28 ldata_child.set_alignment(Gtk::JUSTIFY_LEFT);
30 table.attach (lnode_num, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
31 table.attach (lnode_level, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
32 table.attach (lnode_items, 0, 1, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
33 table.attach (lnode_freespace, 0, 1, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
34 table.attach (ldata_type, 0, 1, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
35 table.attach (ldata_key, 0, 1, 5, 6, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
36 table.attach (ldata_child, 0, 1, 6, 7, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
38 table.attach (node_num, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
39 table.attach (node_level, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
40 table.attach (node_items, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
41 table.attach (node_freespace, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
42 table.attach (data_type, 1, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
43 table.attach (data_key, 1, 2, 5, 6, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
44 table.attach (data_child, 1, 2, 6, 7, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
46 table.property_column_spacing () = 8;
47 table.property_row_spacing () = 8;
50 property_label_xalign () = 0;
51 set_label ("Propiedades");
52 set_shadow_type(Gtk::SHADOW_NONE);
53 set_size_request (200, 0);
56 void ViewProperties::ShowItem (BTreeData *data, BTreeNodeHeader &header)
58 std::string s1, s2, s3;
59 std::stringstream ss1, ss2, ss3;
61 node_num.set_label ("TODO");
65 node_level.set_label (s1);
67 ss2 << header.item_count;
69 node_items.set_label (s2);
71 ss3 << header.free_space;
73 node_freespace.set_label (s3);
75 if (dynamic_cast<BTreeChildData *>(data)) {
76 data_type.set_label ("BTreeChildData");
77 data_key.set_label ("N/C");
80 std::stringstream ss4;
81 ss4 << data->getChild ();
83 data_child.set_label (s4);
84 } else if (dynamic_cast<BTreeLeafData *>(data)) {
85 data_type.set_label ("BTreeLeafData");
86 data_child.set_label ("N/C");
88 std::string s4 = *(data->getClave ());
89 data_key.set_label (s4);
91 data_type.set_label ("BTreeData");
94 std::stringstream ss4;
95 ss4 << data->getChild ();
97 data_child.set_label (s4);
99 std::string s5 = *(data->getClave ());
100 data_key.set_label (s5);