Forgot the meat.
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
24 #include <all_include.h>
26 #include <libgnomecanvasmm.h>
27 #include <libgnomecanvasmm/polygon.h>
29 ///A widget by which node and edgemaps can be selected, deselected and created.
31 ///During the usage of \ref glemon we have to select
32 ///maps several times. We also need some aid-function
33 ///like new map creation and deselecting previously
34 ///selected map. Instead of writing a the mapselection
35 ///at all occurences we can use this widget by connecting
36 ///its signals to the correct place.
37 class MapSelector : public Gtk::HBox
40 ///This signal indicates that the selection has been changed by user.
41 sigc::signal<void, std::string> signal_cbt;
43 ///Signal that indicates that user wants to create a new map.
44 sigc::signal<void, bool> signal_newmapwin;
46 ///If this is true, beyond the mapnames a 'Default' selection is available as well.
48 ///For example \ref MapWin needs 'Default' option as well. In this case no map
49 ///will be visualized by the appropriate property.
50 ///But \ref AlgoWin do not need 'Default' option, because if no map is selected,
51 ///no algorithm can be run.
52 ///Its value is got and set in contructor.
55 ///Are the names of edgemaps or nodemaps stored here.
58 ///Shows whether 'Default' option is selected or not.
61 ///It is true when the new button had been pressed but the new map has not been registrated yet.
63 ///Before signal of \ref NewMapWin request is emitted by the \ref MapSelector
64 ///this variable is set to true. When the new map
65 ///is done, it will be registrated in all existing \ref MapSelector
66 ///by \ref append_text function. That function checks
67 ///whether this variable is true. If it is true that means
68 ///that this \ref MapSelector has requested \ref NewMapWin.
69 ///Therefore it set itself to the recently created map.
70 ///After that \ref set_new_map is set again false, not to
71 ///set maps active if \ref MapSelector piece is not the requester.
74 ///The widget that holds the names of maps.
76 ///It can be rolled down
77 ///Names in it are selectable.
78 Gtk::ComboBoxText cbt;
80 std::vector<std::string> cbt_content;
85 ///\ref NewMapWin wilol pop-up
90 ///If pressed \ref cbt will
91 ///set to 'Default' option.
93 ///It is visible only if \ref def is true.
96 ///Container in which GUI elements are packed.
99 ///Shows purpose of \ref MapSelector piece.
104 ///Constructor of \ref MapSelector
106 ///Creates the layout and binds signal to the correct place.
107 ///\param optionlist list of names to place in \ref cbt
108 ///\param act preselected option
109 ///\param purpose text of label indicating purpose of \ref MapStorage
110 ///\param itisedge do \ref MapSelector contains edgemap names or nodemapnames.
111 ///\param def do we need 'Default' option. See \ref def.
112 MapSelector(std::vector<std::string> optionlist, std::string act, std::string purpose, bool itisedge, bool def=true);
114 ///Returns signal emitted if the user has changed the selection. (\ref signal_cbt)
115 sigc::signal<void, std::string> signal_cbt_ch();
117 ///Returns signal emitted if the user has pressed New button (\ref newbut) (\ref signal_newmapwin)
118 sigc::signal<void, bool> signal_newmapwin_needed();
120 ///Maintain \ref cbt.
122 ///Fills in \ref cbt with names, taking
123 ///into account that the previously selected option
124 ///has to be set back after the operation.
125 void update_list( std::vector<std::string> );
127 ///Handles changement in \ref cbt.
129 ///In default case it emits a signal with the selected option.
130 ///But if 'Default' option is selected, it resets the \ref MapSelector
131 virtual void comboChanged();
133 ///Requests a \ref NewMapWin
135 ///See \ref set_new_map.
136 ///First it sets \ref set_new_map true to be identified
137 ///at registration of new map that
138 ///it has sent the \ref signal_newmapwin, therefore it
139 ///has to set \ref cbt to that option.
140 virtual void new_but_pressed();
142 ///If called, 'Default' option is selected, that means unselection of any maps.
144 ///Practically this means that if this is called,
145 ///properties of graph will set to default state.
146 ///The function achieves this by emitting appropriately
147 ///parametrized signal_cbt.
148 virtual void reset();
150 ///Returns the currently selected option.
151 Glib::ustring get_active_text();
153 ///Sets the parameter active in \ref cbt.
155 ///\param new_value the
156 ///new value to be set in \ref cbt.
157 void set_active_text(Glib::ustring new_value);
159 ///Sets the parameter active in \ref cbt.
161 ///index of row to be set in \ref cbt.
162 void set_active(int index){cbt.set_active(index);};
164 ///Clear all options from \ref cbt.
165 void clear(){cbt.clear();};
167 ///Appends a new option to the existing ones in \ref cbt.
169 ///If \ref set_new_map is true, the
170 ///\ref MapSelector has requested the opened \ref NewMapWin,
171 ///from that the option to append is coming. In this case
172 ///this function will set \ref cbt to the new option.
173 ///\param new_option new option to append
174 void append_text(Glib::ustring new_option);
176 #endif //MAPSELECTOR_H