vmap.h: Enables one to create maps with a virtual base class.
4 bool MapWin::closeIfEscapeIsPressed(GdkEventKey* e)
6 if(e->keyval==GDK_Escape)
14 MapWin::MapWin(const std::string& title, std::vector<std::string> eml, std::vector<std::string> nml, NoteBookTab & mw):mytab(mw)
17 set_default_size(200, 50);
19 signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::closeIfEscapeIsPressed));
21 e_combo_array=new MapSelector * [EDGE_PROPERTY_NUM];
23 table=new Gtk::Table(EDGE_PROPERTY_NUM, 1, false);
25 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
27 e_combo_array[i]=new MapSelector(eml, mytab.getActiveEdgeMap(i), edge_property_strings[i], true);
29 (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
31 e_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::edgeMapChanged), i));
32 e_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded));
35 vbox.pack_start(*(new Gtk::Label("Edge properties")));
37 vbox.pack_start(*table);
39 vbox.pack_start(*(new Gtk::HSeparator));
41 n_combo_array=new MapSelector * [NODE_PROPERTY_NUM];
43 table=new Gtk::Table(NODE_PROPERTY_NUM, 1, false);
45 for(int i=0;i<NODE_PROPERTY_NUM;i++)
47 n_combo_array[i]=new MapSelector(nml, mytab.getActiveNodeMap(i), node_property_strings[i], false);
49 (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
51 n_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::nodeMapChanged), i));
52 n_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded));
57 vbox.pack_start(*(new Gtk::Label("Node properties")));
59 vbox.pack_start(*table);
65 void MapWin::nodeMapChanged(std::string mapname, int prop)
67 mytab.propertyChange(false, prop, mapname);
70 void MapWin::edgeMapChanged(std::string mapname, int prop)
72 mytab.propertyChange(true, prop, mapname);
75 void MapWin::newMapWinNeeded(bool itisedge)
77 mytab.popupNewMapWin(itisedge);
80 void MapWin::update(std::vector<std::string> eml, std::vector<std::string> nml)
82 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
84 e_combo_array[i]->update_list(eml);
87 for(int i=0;i<NODE_PROPERTY_NUM;i++)
89 n_combo_array[i]->update_list(nml);
93 void MapWin::registerNewEdgeMap(std::string newmapname)
95 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
97 //filling in combo box with choices
98 e_combo_array[i]->append_text((Glib::ustring)newmapname);
102 void MapWin::registerNewNodeMap(std::string newmapname)
104 for(int i=0;i<NODE_PROPERTY_NUM;i++)
106 //filling in combo box with choices
107 n_combo_array[i]->append_text((Glib::ustring)newmapname);
111 bool MapWin::on_delete_event(GdkEventAny * event)