]> git.llucax.com Git - z.facultad/75.52/treemulator.git/blob - viewer/view_btree.h
Fix.
[z.facultad/75.52/treemulator.git] / viewer / view_btree.h
1
2 #ifndef _VIEW_BTREE_H_
3 #define _VIEW_BTREE_H_
4
5 #include <libgnomecanvasmm.h>
6 #include <string>
7
8 #include "btree.h"
9 #include "view_node.h"
10
11 using namespace Gnome;
12
13 class ViewNode;
14
15 class ViewBTree : public Canvas::Group, public BTree {
16         public:
17                 ViewBTree (Canvas::Group *parent, std::string filename, uint block_size, int type);
18
19                 static double byte_to_pixels;
20                 static double node_width;
21                 static double node_height;
22
23                 typedef SigC::Signal2<void, BTreeData *, BTreeNodeHeader&> type_signal_selected;
24                 type_signal_selected signal_selected ();
25         protected:
26                 type_signal_selected m_signal_selected;
27                 int max_level; /* Lo saco de la raiz */
28                 /* Posicion X por nivel */
29                 std::map<uint,double> pos_x;
30                 /* Control para no poner 2 veces un nodo */
31                 /* Un nodo que quiera ser puesto 2 veces es un bug :) */
32                 std::map<uint,bool> node_placed;
33
34         public:
35                 void AddNode (uint num, uint padre = 0);
36                 void on_item_selected (BTreeData *, uint, ViewNode *);
37                 void on_item_activated (BTreeData *, uint, ViewNode *);
38
39                 ViewNode *last_selected;
40 };
41
42 #endif
43