Documentation of MapSelector. If no default value is present in MapSelector, Reset button does not appear.
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);
32 defbut=new Gtk::Button();
33 defbut->set_label("Reset");
35 defbut->signal_pressed().connect
37 sigc::mem_fun(*this, &MapSelector::reset)
41 newbut=new Gtk::Button(Gtk::Stock::NEW);
43 newbut->signal_pressed().connect
45 sigc::mem_fun(*this, &MapSelector::new_but_pressed)
60 void MapSelector::new_but_pressed()
63 signal_newmapwin.emit(itisedge);
66 void MapSelector::update_list( std::vector< std::string > ml )
68 int prev_act=cbt.get_active_row_number();
70 std::vector< std::string >::iterator emsi=ml.begin();
71 for(;emsi!=ml.end();emsi++)
73 cbt.append_text(*emsi);
77 cbt.prepend_text("Default values");
81 cbt.set_active(prev_act);
85 void MapSelector::comboChanged()
87 if(cbt.get_active_row_number()!=0 || !def)
90 Glib::ustring mapname = cbt.get_active_text();
91 if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
93 signal_cbt.emit(mapname);
96 else if((!default_state)&&(cbt.get_active_row_number()==0))
102 void MapSelector::reset()
112 Glib::ustring MapSelector::get_active_text()
114 return cbt.get_active_text();
117 void MapSelector::set_active_text(Glib::ustring text)
119 cbt.set_active_text(text);
122 void MapSelector::append_text(Glib::ustring text)
124 cbt.append_text(text);
127 set_active_text(text);
132 sigc::signal<void, std::string> MapSelector::signal_cbt_ch()
137 sigc::signal<void, bool> MapSelector::signal_newmapwin_needed()
139 return signal_newmapwin;