Zoom is now available with mouse-wheel.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
19 #include "mapselector.h"
21 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)
32 cbt.set_active_text((Glib::ustring)act);
36 //binding signal to the actual entry
37 cbt.signal_changed().connect
39 sigc::mem_fun((*this), &MapSelector::comboChanged),
43 label=new Gtk::Label(labeltext);
45 label->set_width_chars(longest_property_string_length);
50 defbut=new Gtk::Button();
51 defbut->set_label("Reset");
53 defbut->signal_pressed().connect
55 sigc::mem_fun(*this, &MapSelector::reset)
59 newbut=new Gtk::Button(Gtk::Stock::NEW);
61 newbut->signal_pressed().connect
63 sigc::mem_fun(*this, &MapSelector::new_but_pressed)
78 void MapSelector::new_but_pressed()
81 signal_newmapwin.emit(itisedge);
84 void MapSelector::update_list( std::vector< std::string > ml )
86 int prev_act=cbt.get_active_row_number();
89 std::vector< std::string >::iterator emsi=ml.begin();
90 for(;emsi!=ml.end();emsi++)
92 cbt.append_text(*emsi);
93 cbt_content.push_back(*emsi);
97 cbt.prepend_text("Default values");
98 cbt_content.push_back("Default values");
102 cbt.set_active(prev_act);
106 void MapSelector::comboChanged()
108 if(cbt.get_active_row_number()!=0 || !def)
111 Glib::ustring mapname = cbt.get_active_text();
112 if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
114 signal_cbt.emit(mapname);
117 else if((!default_state)&&(cbt.get_active_row_number()==0))
123 void MapSelector::reset()
133 Glib::ustring MapSelector::get_active_text()
135 return cbt.get_active_text();
138 void MapSelector::set_active_text(Glib::ustring text)
142 cbt.set_active_text(text);
146 cbt.set_active_text("Default values");
150 void MapSelector::append_text(Glib::ustring text)
152 cbt.append_text(text);
153 cbt_content.push_back(text);
157 set_active_text(text);
162 sigc::signal<void, std::string> MapSelector::signal_cbt_ch()
167 sigc::signal<void, bool> MapSelector::signal_newmapwin_needed()
169 return signal_newmapwin;