Forgotten file committed.
1 #include "mapselector.h"
3 MapSelector::MapSelector(std::vector<std::string> ml, std::string act, std::string labeltext, bool edge, bool d):def(d),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),
25 label=new Gtk::Label(labeltext);
27 label->set_width_chars(longest_property_string_length);
29 defbut=new Gtk::Button();
30 defbut->set_label("Reset");
32 defbut->signal_pressed().connect
34 sigc::mem_fun(*this, &MapSelector::reset)
37 newbut=new Gtk::Button(Gtk::Stock::NEW);
39 newbut->signal_pressed().connect
41 sigc::mem_fun(*this, &MapSelector::new_but_pressed)
52 void MapSelector::new_but_pressed()
55 signal_newmapwin.emit(itisedge);
58 void MapSelector::update_list( std::vector< std::string > ml )
60 int prev_act=cbt.get_active_row_number();
62 std::vector< std::string >::iterator emsi=ml.begin();
63 for(;emsi!=ml.end();emsi++)
65 cbt.append_text(*emsi);
69 cbt.prepend_text("Default values");
73 cbt.set_active(prev_act);
77 void MapSelector::comboChanged()
79 if(cbt.get_active_row_number()!=0)
82 Glib::ustring mapname = cbt.get_active_text();
83 if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
85 signal_cbt.emit(mapname);
88 else if((!default_state)&&(cbt.get_active_row_number()==0))
94 void MapSelector::reset()
104 Glib::ustring MapSelector::get_active_text()
106 return cbt.get_active_text();
109 void MapSelector::set_active_text(Glib::ustring text)
111 cbt.set_active_text(text);
114 void MapSelector::append_text(Glib::ustring text)
116 cbt.append_text(text);
119 set_active_text(text);
124 sigc::signal<void, std::string> MapSelector::signal_cbt_ch()
129 sigc::signal<void, bool> MapSelector::signal_newmapwin_needed()
131 return signal_newmapwin;