]> git.llucax.com Git - z.facultad/75.52/treemulator.git/blobdiff - viewer/view_btree.h
Abrir Arbol en la vista.
[z.facultad/75.52/treemulator.git] / viewer / view_btree.h
index a03af2bb070e43fca995b1d05c1fcb3d4ec6dd50..f4e3c4781293431a8f45672eab4d67e241dc5857 100644 (file)
@@ -4,24 +4,49 @@
 
 #include <libgnomecanvasmm.h>
 #include <string>
+#include <stack>
 
 #include "btree.h"
-
-#define NODE_WIDTH 500
-#define NODE_HEIGHT 50
+#include "view_node.h"
 
 using namespace Gnome;
 
+class ViewNode;
+
 class ViewBTree : public Canvas::Group, public BTree {
        public:
-               ViewBTree (Canvas::Group *parent, std::string filename);
+               ViewBTree (Canvas::Group *parent, std::string filename, uint block_size, int tree_type, int type);
+               ViewBTree (Canvas::Group *parent, const std::string filename);
+
+               static ViewBTree* Open (const std::string &filename);
 
+               void Clear ();
+               void HighliteKey (Clave &k);
+               void GoBack ();
+
+               static double byte_to_pixels;
+               static double node_width;
+               static double node_height;
+
+               typedef SigC::Signal2<void, BTreeData *, BTreeNodeHeader&> type_signal_selected;
+               type_signal_selected signal_selected ();
        protected:
-               int byte_to_pixels;
+               type_signal_selected m_signal_selected;
                int max_level; /* Lo saco de la raiz */
+               /* Posicion X por nivel */
+               std::map<uint,double> pos_x;
+               /* Control para no poner 2 veces un nodo */
+               /* Un nodo que quiera ser puesto 2 veces es un bug :) */
+               std::map<uint,bool> node_placed;
+               std::stack<uint> back;
+               uint last_visited;
 
-               void AddNode (uint num);
+       public:
+               void AddNode (uint num, uint padre = 0);
+               void on_item_selected (BTreeData *, uint, ViewNode *);
+               void on_item_activated (BTreeData *, uint, ViewNode *);
 
+               ViewNode *last_selected;
 };
 
 #endif