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));
46 ab->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoWin::emit_new_map_signal));
48 runbutton=new Gtk::Button("Run");
49 runbutton->signal_released().connect(sigc::mem_fun(*ab,&AlgoBox::run));
50 runbutton->signal_activate().connect(sigc::mem_fun(*ab,&AlgoBox::run));
52 closebutton=new Gtk::Button("Close");
53 closebutton->signal_released().connect(sigc::mem_fun(*this,&AlgoWin::on_hide));
54 closebutton->signal_activate().connect(sigc::mem_fun(*this,&AlgoWin::on_hide));
56 Gtk::HBox * hbox=new Gtk::HBox();
58 hbox->pack_start(*runbutton);
59 hbox->pack_start(*closebutton);
61 vbox->pack_start(*label);
62 vbox->pack_start(*ab);
63 vbox->pack_start(*hbox);
70 void AlgoWin::update_tablist(std::vector<std::string> tabnames)
72 ab->update_tablist(tabnames);
75 void AlgoWin::update_maplist(MapStorage * mapstorage)
77 ab->update_maplist(mapstorage);
80 void AlgoWin::on_hide()
82 signal_closed.emit(this);
83 Gtk::Window::on_hide();
86 void AlgoWin::emit_tab_change(std::string newtab)
88 signal_maplist_need.emit(this, newtab);