EpsWin and DesignWin does not need to know NoteBookTab.
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
25 #include <all_include.h>
26 #include <libgnomecanvasmm.h>
27 #include <libgnomecanvasmm/polygon.h>
29 ///Ancestor class of algorithm graphical interface classes.
31 ///It also demonstrates, how should an algorithm graphical interface
32 ///work. Children of this class have the same functions and attributes,
33 ///therefore with all of them can the holder \ref AlgoWin communicate
36 ///IMPORTANT! In a child class only the following tasks are to do:
38 ///-call \ref init function with correct parameters from correctly parametrized constructor
40 ///-implement \ref build_box function
42 ///-implement \ref run function
44 ///because all other thing is automatically done in \ref init function!
46 class AlgoBox : public Gtk::VBox
48 ///Signal emitted in case of need for list of maps.
50 ///If the user has selected different tab to work on
51 ///new maps are selected as well. These new maps should be
52 ///provided for \ref AlgoBox. To get these maps, \ref AlgoBox
54 sigc::signal<void, std::string> signal_maplist_need;
56 ///Signal emitted in case of need for \ref NewMapWin.
58 ///If user wants to create a new for an input, or output
59 ///it can let \ref NewMapWin popped up from here as well.
60 ///In that case will be this signal emitted.
61 sigc::signal<void, std::string, bool> signal_newmapwin_need;
63 ///Signal emitted when maplists are updated after tab change
64 sigc::signal<void> signal_maplist_updated;
68 ///Holder of tabnames.
69 Gtk::ComboBoxText tabcbt;
71 ///Holder of widgets, in which nodemaps can be selected to work on.
72 std::vector<MapSelector *> nodemapcbts;
74 ///Holder of widgets, in which edgemaps can be selected to work on.
75 std::vector<MapSelector *> edgemapcbts;
77 ///Maps of selected tabs.
78 MapStorage * mapstorage;
81 ///Empty constructor called by children.
86 ///Calls \ref init function
87 ///with the provided parameters. \ref init function
88 ///is needed, because it is virtual, therefore the
89 ///functions of the proper class will be called when
91 ///\param tablist list of tabs in \ref MainWin
92 AlgoBox(std::vector<std::string> tablist);
94 ///Initiates \ref AlgoBox.
96 ///Creates the graphical interface for the realized algorithm, initiates variables, connects signals.
98 ///List of tabs in \ref MainWin is required, but no one
99 ///will be selected automatically. Every other
100 ///entry field remains empty (unselected), until a \ref NoteBookTab
103 ///It also have to bind all the signals to the correct place.
104 ///This function is virtual, in all type of children of
105 ///\ref AlgoBox the correct function willbe called.
107 ///Therefore it is IMPORTANT that only \ref run and \ref build_box
108 ///has to be implemented in children of \ref AlgoBox, every other
109 ///thing will automatically work properly by the help of this
110 ///function that must be called in constructor of child!!!
111 virtual void init(std::vector<std::string>);
113 ///Signal emitted, when selected tab changes, and new list of maps required.
114 sigc::signal<void, std::string> signal_maplist_needed();
116 ///Emitted if user wants to create a new map for inpuit or output.
117 sigc::signal<void, std::string, bool> signal_newmapwin_needed(){return signal_newmapwin_need;};
119 sigc::signal<void> signal_upon_maplist_updated(){return signal_maplist_updated;};
121 ///Emits signal that requires list of maps for the recently selected \ref NoteBookTab.
122 void emit_tab_change();
124 ///Interface, through which \ref AlgoBox can be notified about tab addition, deletion in \ref MainWin
128 void update_tablist( std::vector< std::string > tl );
130 ///Interface, through which \ref AlgoBox can get the maps of the recently selected \ref NoteBookTab
132 ///\param ms the maps
133 ///of the recently selected \ref NoteBookTab
134 void update_maplist( MapStorage * ms);
136 ///Interface, through which \ref AlgoBox can be notified about nodemap addition.
138 ///If new map was added to \ref MapStorage of currently selected \ref NoteBookTab
139 ///a signal is emitted by it. This signal is connected to this function, so \ref MapSelector s
140 ///in \ref nodemapcbts can be notified, and those can registrate the new map. (\ref MapSelector::append_text)
141 void nodemaplist_changed(std::string);
143 ///Interface, through which \ref AlgoBox can be notified about edgemap addition.
145 ///If new map was added to \ref MapStorage of currently selected \ref NoteBookTab
146 ///a signal is emitted by it. This signal is connected to this function, so \ref MapSelector s
147 ///in \ref edgemapcbts can be notified, and those can registrate the new map. (\ref MapSelector::append_text)
148 void edgemaplist_changed(std::string);
150 ///Aid function to provide data for a given entry.
152 ///At the moment it is only used for updating info
153 ///in \ref tabcbt. It clears it first, after that
154 ///inserts the data got from caller, and if there
155 ///was previously selected item it switches entry
157 ///\param tl list of entries (at the moment tabs in \ref MainWin)
158 ///\param cbt the entry to update (at the moment only \ref tabcbt)
159 void update_cbt( std::vector< std::string > tl, Gtk::ComboBoxText & cbt);
161 ///Runs the ralized algorithm.
163 ///Prepare the data for it
164 ///and after that postprocess it if necessary.
165 ///This is only a demo here, but in children it
166 ///runs the algorithm really.
169 ///Creates the layout of the \ref AlgoBox
171 ///Place all the entries
172 ///required. Run and close button is not
173 ///its responsibility!
174 virtual void build_box();
176 ///Emits \ref signal_newmapwin_need if user wants to create new input or output map.
178 ///Called in case of pressing \ref MapSelector::newbut.
179 ///\param itisedge edge or nodemap is required.
180 virtual void emit_new_map_signal(bool itisedge);
182 ///Aid function to make addition of \ref MapSelector easy in \ref build_box.
184 ///\param label label to show in \ref MapSelector
185 ///\param itisedge whether edge or nodemaps stored in \ref MapSelector
186 void addMapSelector(std::string label, bool itisedge);