]> git.llucax.com Git - z.facultad/75.52/treemulator.git/blob - viewer/view_debug.cpp
Agrego vista de debugging.
[z.facultad/75.52/treemulator.git] / viewer / view_debug.cpp
1
2 #include "view_debug.h"
3
4 ViewDebug::ViewDebug (BTree *t):Gtk::VBox (),
5         testkeys ("Comprobar")
6 {
7         btree = t;
8         list_store = Gtk::ListStore::create (columns);
9   list.set_model (list_store);
10
11         list.append_column ("Clave", columns.col_key_string);
12         list.append_column ("Encontrada", columns.col_key_verified);
13
14         pack_start (list, true, true, 8);
15         pack_end (testkeys, false, true, 8);
16
17         testkeys.signal_clicked().connect( sigc::mem_fun(*this, &ViewDebug::on_test_clicked) );
18 }
19
20 void ViewDebug::AddKey (const Clave &k)
21 {
22         Gtk::TreeModel::Row row = *(list_store->append());
23         row[columns.col_key_string] = k;
24         row[columns.col_key_verified] = false;
25         row[columns.col_key] = k.Clone ();
26 }
27
28 void ViewDebug::on_test_clicked ()
29 {
30         Gtk::TreeModel::Children rows = list_store->children ();
31         for(Gtk::TreeModel::Children::iterator iter = rows.begin(); iter != rows.end(); ++iter)
32         {
33                   Gtk::TreeModel::Row row = *iter;
34                         if (btree->FindKey (*row[columns.col_key]))
35                                 row[columns.col_key_verified] = true;
36         }
37 }
38