Syncronize glemon repo with the latest version of lemon.
(lemon::Path seems to seriously buggy)
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>
25 #include <mapstorage.h>
26 #include <mapselector.h>
27 #include <libgnomecanvasmm.h>
28 #include <libgnomecanvasmm/polygon.h>
30 ///Ancestor class of algorithm graphical interface classes.
32 ///It also demonstrates, how should an algorithm graphical interface
33 ///work. Children of this class have the same functions and attributes,
34 ///therefore with all of them can the holder \ref AlgoWin communicate
37 ///IMPORTANT! In a child class only the following tasks are to do:
39 ///-call \ref init function with correct parameters from correctly parametrized constructor
41 ///-implement \ref build_box function
43 ///-implement \ref run function
45 ///because all other thing is automatically done in \ref init function!
47 class AlgoBox : public Gtk::VBox
49 ///Signal emitted in case of need for list of maps.
51 ///If the user has selected different tab to work on
52 ///new maps are selected as well. These new maps should be
53 ///provided for \ref AlgoBox. To get these maps, \ref AlgoBox
55 sigc::signal<void, std::string> signal_maplist_need;
57 ///Signal emitted in case of need for \ref NewMapWin.
59 ///If user wants to create a new for an input, or output
60 ///it can let \ref NewMapWin popped up from here as well.
61 ///In that case will be this signal emitted.
62 sigc::signal<void, std::string, bool> signal_newmapwin_need;
64 ///Signal emitted when maplists are updated after tab change
65 sigc::signal<void> signal_maplist_updated;
69 ///Holder of tabnames.
70 Gtk::ComboBoxText tabcbt;
72 ///Holder of widgets, in which nodemaps can be selected to work on.
73 std::vector<MapSelector *> nodemapcbts;
75 ///Holder of widgets, in which edgemaps can be selected to work on.
76 std::vector<MapSelector *> edgemapcbts;
78 ///Maps of selected tabs.
79 MapStorage * mapstorage;
82 ///Empty constructor called by children.
87 ///Calls \ref init function
88 ///with the provided parameters. \ref init function
89 ///is needed, because it is virtual, therefore the
90 ///functions of the proper class will be called when
92 ///\param tablist list of tabs in \ref MainWin
93 AlgoBox(std::vector<std::string> tablist);
95 ///Initiates \ref AlgoBox.
97 ///Creates the graphical interface for the realized algorithm, initiates variables, connects signals.
99 ///List of tabs in \ref MainWin is required, but no one
100 ///will be selected automatically. Every other
101 ///entry field remains empty (unselected), until a \ref NoteBookTab
104 ///It also have to bind all the signals to the correct place.
105 ///This function is virtual, in all type of children of
106 ///\ref AlgoBox the correct function willbe called.
108 ///Therefore it is IMPORTANT that only \ref run and \ref build_box
109 ///has to be implemented in children of \ref AlgoBox, every other
110 ///thing will automatically work properly by the help of this
111 ///function that must be called in constructor of child!!!
112 virtual void init(std::vector<std::string>);
114 ///Signal emitted, when selected tab changes, and new list of maps required.
115 sigc::signal<void, std::string> signal_maplist_needed();
117 ///Emitted if user wants to create a new map for inpuit or output.
118 sigc::signal<void, std::string, bool> signal_newmapwin_needed(){return signal_newmapwin_need;};
120 sigc::signal<void> signal_upon_maplist_updated(){return signal_maplist_updated;};
122 ///Emits signal that requires list of maps for the recently selected \ref NoteBookTab.
123 void emit_tab_change();
125 ///Interface, through which \ref AlgoBox can be notified about tab addition, deletion in \ref MainWin
129 void update_tablist( std::vector< std::string > tl );
131 ///Interface, through which \ref AlgoBox can get the maps of the recently selected \ref NoteBookTab
133 ///\param ms the maps
134 ///of the recently selected \ref NoteBookTab
135 void update_maplist( MapStorage * ms);
137 ///Interface, through which \ref AlgoBox can be notified about nodemap addition.
139 ///If new map was added to \ref MapStorage of currently selected \ref NoteBookTab
140 ///a signal is emitted by it. This signal is connected to this function, so \ref MapSelector s
141 ///in \ref nodemapcbts can be notified, and those can registrate the new map. (\ref MapSelector::append_text)
142 void nodemaplist_changed(std::string);
144 ///Interface, through which \ref AlgoBox can be notified about edgemap addition.
146 ///If new map was added to \ref MapStorage of currently selected \ref NoteBookTab
147 ///a signal is emitted by it. This signal is connected to this function, so \ref MapSelector s
148 ///in \ref edgemapcbts can be notified, and those can registrate the new map. (\ref MapSelector::append_text)
149 void edgemaplist_changed(std::string);
151 ///Aid function to provide data for a given entry.
153 ///At the moment it is only used for updating info
154 ///in \ref tabcbt. It clears it first, after that
155 ///inserts the data got from caller, and if there
156 ///was previously selected item it switches entry
158 ///\param tl list of entries (at the moment tabs in \ref MainWin)
159 ///\param cbt the entry to update (at the moment only \ref tabcbt)
160 void update_cbt( std::vector< std::string > tl, Gtk::ComboBoxText & cbt);
162 ///Runs the ralized algorithm.
164 ///Prepare the data for it
165 ///and after that postprocess it if necessary.
166 ///This is only a demo here, but in children it
167 ///runs the algorithm really.
170 ///Creates the layout of the \ref AlgoBox
172 ///Place all the entries
173 ///required. Run and close button is not
174 ///its responsibility!
175 virtual void build_box();
177 ///Emits \ref signal_newmapwin_need if user wants to create new input or output map.
179 ///Called in case of pressing \ref MapSelector::newbut.
180 ///\param itisedge edge or nodemap is required.
181 virtual void emit_new_map_signal(bool itisedge);
183 ///Aid function to make addition of \ref MapSelector easy in \ref build_box.
185 ///\param label label to show in \ref MapSelector
186 ///\param itisedge whether edge or nodemaps stored in \ref MapSelector
187 void addMapSelector(std::string label, bool itisedge);