Added two new classes.
2 #include <kruskalbox.h>
3 #include <dijkstrabox.h>
5 sigc::signal<void, AlgoWin *> AlgoWin::signal_closing()
10 sigc::signal<void, AlgoWin *, std::string> AlgoWin::signal_maplist_needed()
12 return signal_maplist_need;
15 bool AlgoWin::closeIfEscapeIsPressed(GdkEventKey* e)
17 if(e->keyval==GDK_Escape)
24 AlgoWin::AlgoWin(int algoid, std::vector<std::string> tabnames)
26 signal_key_press_event().connect(sigc::mem_fun(*this, &AlgoWin::closeIfEscapeIsPressed));
28 Gtk::VBox * vbox=new Gtk::VBox();
31 Gtk::Label * label=new Gtk::Label("Select graph:");
36 ab=new AlgoBox(tabnames);
37 set_title("Algo Win Demo");
40 ab=new KruskalBox(tabnames);
41 set_title("Kruskal Algorithm");
44 ab=new DijkstraBox(tabnames);
45 set_title("Dijkstra Algorithm");
48 ab=new SuurballeBox(tabnames);
49 set_title("Suurballe Algorithm");
54 ab->signal_maplist_needed().connect(sigc::mem_fun(*this, &AlgoWin::emit_tab_change));
55 ab->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoWin::emit_new_map_signal));
57 runbutton=new Gtk::Button("Run");
58 runbutton->signal_released().connect(sigc::mem_fun(*ab,&AlgoBox::run));
59 runbutton->signal_activate().connect(sigc::mem_fun(*ab,&AlgoBox::run));
61 closebutton=new Gtk::Button("Close");
62 closebutton->signal_released().connect(sigc::mem_fun(*this,&AlgoWin::on_hide));
63 closebutton->signal_activate().connect(sigc::mem_fun(*this,&AlgoWin::on_hide));
65 Gtk::HBox * hbox=new Gtk::HBox();
67 hbox->pack_start(*runbutton);
68 hbox->pack_start(*closebutton);
70 vbox->pack_start(*label);
71 vbox->pack_start(*ab);
72 vbox->pack_start(*hbox);
79 void AlgoWin::update_tablist(std::vector<std::string> tabnames)
81 ab->update_tablist(tabnames);
84 void AlgoWin::update_maplist(MapStorage * mapstorage)
86 ab->update_maplist(mapstorage);
89 void AlgoWin::on_hide()
91 signal_closed.emit(this);
92 Gtk::Window::on_hide();
95 void AlgoWin::emit_tab_change(std::string newtab)
97 signal_maplist_need.emit(this, newtab);