Several changes. \n If new map is added to mapstorage it emits signal with the name of the new map. This was important, because from now on not only tha mapwin should be updated. \n Furthermore algobox gets a pointer to mapstorage instead of only the mapnames from it. This is important because without it it would be complicated to pass all of the required maps to algobox.
2 #include <kruskalbox.h>
4 sigc::signal<void, AlgoWin *> AlgoWin::signal_closing()
9 sigc::signal<void, AlgoWin *, std::string> AlgoWin::signal_maplist_needed()
11 return signal_maplist_need;
14 bool AlgoWin::closeIfEscapeIsPressed(GdkEventKey* e)
16 if(e->keyval==GDK_Escape)
23 AlgoWin::AlgoWin(int algoid, std::vector<std::string> tabnames)
25 signal_key_press_event().connect(sigc::mem_fun(*this, &AlgoWin::closeIfEscapeIsPressed));
27 Gtk::VBox * vbox=new Gtk::VBox();
30 Gtk::Label * label=new Gtk::Label("Select graph:");
35 ab=new AlgoBox(tabnames);
36 set_title("Algo Win Demo");
39 ab=new KruskalBox(tabnames);
40 set_title("Kruskal Algorithm");
45 ab->signal_maplist_needed().connect(sigc::mem_fun(*this, &AlgoWin::emit_tab_change));
47 runbutton=new Gtk::Button("Run");
48 runbutton->signal_released().connect(sigc::mem_fun(*ab,&AlgoBox::run));
49 runbutton->signal_activate().connect(sigc::mem_fun(*ab,&AlgoBox::run));
51 closebutton=new Gtk::Button("Close");
52 closebutton->signal_released().connect(sigc::mem_fun(*this,&AlgoWin::on_hide));
53 closebutton->signal_activate().connect(sigc::mem_fun(*this,&AlgoWin::on_hide));
55 Gtk::HBox * hbox=new Gtk::HBox();
57 hbox->pack_start(*runbutton);
58 hbox->pack_start(*closebutton);
60 vbox->pack_start(*label);
61 vbox->pack_start(*ab);
62 vbox->pack_start(*hbox);
69 void AlgoWin::update_tablist(std::vector<std::string> tabnames)
71 ab->update_tablist(tabnames);
74 void AlgoWin::update_maplist(void * mapstorage)
76 ab->update_maplist(mapstorage);
79 void AlgoWin::on_hide()
81 signal_closed.emit(this);
82 Gtk::Window::on_hide();
85 void AlgoWin::emit_tab_change(std::string newtab)
87 signal_maplist_need.emit(this, newtab);