MapSelector has become a standalone class.
1 #include "mapselector.h"
3 MapSelector::MapSelector(std::vector<std::string> ml, std::string act, int identifier, bool edge):id(identifier),itisedge(edge),set_new_map(false)
14 cbt.set_active_text((Glib::ustring)act);
18 //binding signal to the actual entry
19 cbt.signal_changed().connect
21 sigc::mem_fun((*this), &MapSelector::comboChanged),
27 label=new Gtk::Label(edge_property_strings[id]);
31 label=new Gtk::Label(node_property_strings[id]);
34 label->set_width_chars(longest_property_string_length);
36 defbut=new Gtk::Button();
37 defbut->set_label("Reset");
39 defbut->signal_pressed().connect
41 sigc::mem_fun(*this, &MapSelector::reset)
44 newbut=new Gtk::Button(Gtk::Stock::NEW);
46 newbut->signal_pressed().connect
48 sigc::mem_fun(*this, &MapSelector::new_but_pressed)
59 void MapSelector::new_but_pressed()
62 signal_newmapwin.emit(itisedge);
65 void MapSelector::update_list( std::vector< std::string > ml )
67 int prev_act=cbt.get_active_row_number();
69 std::vector< std::string >::iterator emsi=ml.begin();
70 for(;emsi!=ml.end();emsi++)
72 cbt.append_text(*emsi);
74 cbt.prepend_text("Default values");
77 cbt.set_active(prev_act);
81 void MapSelector::comboChanged()
83 if(cbt.get_active_row_number()!=0)
86 Glib::ustring mapname = cbt.get_active_text();
87 if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
89 signal_cbt.emit(mapname);
92 else if((!default_state)&&(cbt.get_active_row_number()==0))
98 void MapSelector::reset()
108 Glib::ustring MapSelector::get_active_text()
110 return cbt.get_active_text();
113 void MapSelector::set_active_text(Glib::ustring text)
115 cbt.set_active_text(text);
118 void MapSelector::append_text(Glib::ustring text)
120 cbt.append_text(text);
123 set_active_text(text);
128 sigc::signal<void, std::string> MapSelector::signal_cbt_ch()
133 sigc::signal<void, bool> MapSelector::signal_newmapwin_needed()
135 return signal_newmapwin;