From: Ricardo Markiewicz Date: Sun, 25 Sep 2005 02:03:31 +0000 (+0000) Subject: Agrego ViewProperties para ver propiedades de nodos. X-Git-Tag: 1_0-pre1~106 X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/commitdiff_plain/70084b679b2a4a3be3f7cc6ef80cef7c7ccf8bed Agrego ViewProperties para ver propiedades de nodos. --- diff --git a/viewer/Makefile b/viewer/Makefile index b085b15..4f9fa9d 100644 --- a/viewer/Makefile +++ b/viewer/Makefile @@ -1,6 +1,6 @@ TARGET=viewer CXXFLAGS=-Wall -g `pkg-config gtkmm-2.4 libgnomecanvasmm-2.6 --cflags` -I../src -OBJECTS=main.o view_btree.o view_btree_data.o +OBJECTS=main.o view_btree.o view_btree_data.o view_properties.o all: $(TARGET) diff --git a/viewer/view_properties.cpp b/viewer/view_properties.cpp new file mode 100644 index 0000000..cd48676 --- /dev/null +++ b/viewer/view_properties.cpp @@ -0,0 +1,38 @@ + +#include "view_properties.h" + +ViewProperties::ViewProperties ():Frame () +{ + vbox.pack_start (node_num, false, false, 5); + vbox.pack_start (node_level, false, false, 5); + vbox.pack_start (node_items, false, false, 5); + vbox.pack_start (node_freespace, false, false, 5); + + vbox.pack_start (data_type, false, false, 5); + vbox.pack_start (data_key, false, false, 5); + vbox.pack_start (data_child, false, false, 5); + + add (vbox); + + set_label ("Propiedades"); + set_shadow_type(Gtk::SHADOW_NONE); +} + +void ViewProperties::ShowItem (BTreeData *, BTreeNodeHeader &header) +{ + std::string s1, s2, s3; + std::stringstream ss1, ss2, ss3; + + ss1 << header.level; + ss1 >> s1; + node_level.set_label ("Nivel : " + s1); + + ss2 << header.item_count; + ss2 >> s2; + node_items.set_label ("Items : " + s2); + + ss3 << header.free_space; + ss3 >> s3; + node_freespace.set_label ("Libre : " + s3); +} + diff --git a/viewer/view_properties.h b/viewer/view_properties.h new file mode 100644 index 0000000..d86ea72 --- /dev/null +++ b/viewer/view_properties.h @@ -0,0 +1,30 @@ + +#ifndef _VIEW_PROPERTIES_H_ +#define _VIEW_PROPERTIES_H_ + +#include +#include "btree.h" +#include "btree_data.h" + +class ViewProperties:public Gtk::Frame { + public: + ViewProperties (); + + void ShowItem (BTreeData *, BTreeNodeHeader &header); + private: + Gtk::VBox vbox; + + /* Node Info */ + Gtk::Label node_num; + Gtk::Label node_level; + Gtk::Label node_items; + Gtk::Label node_freespace; + + /* BTreeData Into */ + Gtk::Label data_type; + Gtk::Label data_key; + Gtk::Label data_child; +}; + +#endif +