COIN-OR::LEMON - Graph Library

source: lemon-0.x/gui/algowin.h @ 1951:cb7a6e0573bc

Last change on this file since 1951:cb7a6e0573bc was 1896:92ef660710f1, checked in by Hegyi Péter, 14 years ago

Documentation of classes realizing algorithm running.

File size: 5.0 KB
[1871]1// -*- C++ -*- //
3#ifndef ALGOWIN_H
4#define ALGOWIN_H
6class AlgoWin;
8#include <all_include.h>
[1879]9//#include <mapstorage.h>
[1871]10#include <algobox.h>
11#include <libgnomecanvasmm.h>
12#include <libgnomecanvasmm/polygon.h>
[1879]14class MapStorage;
[1896]16///Algorithm identifiers.
[1876]17enum {GENERAL, KRUSKAL, ALGO_NUM}; // algorithm IDs;
[1896]19///Window displaying graphical interface for different algorithms.
21///This class displays a graphical interface to set up
22///and run different algorithms. Different algorithms need
23///different inputs, running methods, etc. Therefore
24///class \ref AlgoWin is only a holder of a base class, the so
25///called AlgoBox. \ref AlgoBox is the ancestor of other
26///classes. These child classes realize interfaces of different
27///algorithms, but as their common ancestor is \ref AlgoBox
28///the interface of them is the same. \ref AlgoWin communicates
29///with these classes through this common interface. But it the
30///real object to be placed in \ref AlgoWin depends on the algorithm
31///which the \ref AlgoWin actually has to display. It gets the
32///id of algorithm to display at initialization, and therefore it is
33///able to place in itself the requested child of \ref AlgoBox
34/// visualizing the appropriate algorithm.
[1876]35class AlgoWin : public Gtk::Window
[1896]38  ///Algorithm specific part of \ref AlgoWin
[1871]39  AlgoBox * ab;
41  ///Run button.
43  ///If pressed, algorithm should run.
44  ///That is why common ancestor of different
45  ///algorithm realizer classes have to be. In case of
46  ///pressing run button a common method can be called.
[1876]47  Gtk::Button * runbutton;
49  ///Close button. If pressed, \ref AlgoWin should close.
[1876]50  Gtk::Button * closebutton;
[1896]53  ///Signal emitted upon close of window
55  ///It is necessary, because \ref MainWin have to
56  ///score the opened \ref AlgoWin s, to be able to communicate
57  ///with them: let them know about changement in tabs, maps, etc.
58  ///If \ref AlgoWin is closed, \ref MainWin has to deregistrate it.
59  ///Therefore signal contains address of emitter \ref AlgoWin.
60  sigc::signal<void, AlgoWin *> signal_closed;
62  ///Signal indicating that informatino on certain maplist is required.
64  ///It is just a forwarded signal from \ref AlgoBox, benefit of common ancestor
65  ///algorithm class. User can select the graph (the holder \ref NoteBookTab) on
66  ///which the algorithm should run. But different graphs (\ref NoteBookTab) have
67  ///different maps. If selected tab changes this signal is emitted by \ref AlgoBox,
68  ///caught and reemitted by \ref AlgoWin.
69  ///
70  ///Signal contains the address of \ref AlgoWin to let \ref MainWin know
71  ///where should the information needed forwarded, and the name of
72  ///\ref NoteBookTab, of which maps are inquired.
73  sigc::signal<void, AlgoWin *, std::string> signal_maplist_need;
75  ///Signal that indicates that a \ref NewMapWin should be popped up.
77  ///This is a forwarded signal. If \ref AlgoBox emits a signal
78  ///to let a \ref NewMapWin pop up, |ref AlgoWin catch and reemit it.
79  ///
80  ///Signal contains the name of \ref NoteBookTab, in which the new map
81  ///should be created and a boolean that indicates whether an edge or a
82  ///nodemap should be created.
83  sigc::signal<void, std::string, bool> signal_newmapwin_need;
[1896]86  ///Close window if escape key is pressed.
[1876]87  bool closeIfEscapeIsPressed(GdkEventKey* e);
[1896]89  ///Returns \ref signal_closed to be bindable somewhere.
[1876]90  sigc::signal<void, AlgoWin *> signal_closing();
92  ///Returns \ref signal_maplist_need to be bindable somewhere.
[1876]93  sigc::signal<void, AlgoWin *, std::string> signal_maplist_needed();
[1896]95  ///Returns \ref signal_newmapwin_need to be bindable somewhere.
96  sigc::signal<void, std::string, bool> signal_newmapwin_needed(){return signal_newmapwin_need;};
98  ///Forwards signal emitted by \ref AlgoBox, in which it indicates changement in selection of tabs.
[1876]99  void emit_tab_change(std::string);
101  ///Forwards signal emitted by \ref AlgoBox, in which it indicates need for \ref NewMapWin.
[1884]102  void emit_new_map_signal(std::string tabname, bool itisedge){signal_newmapwin_need.emit(tabname, itisedge);};
[1896]104  ///Constructor
[1896]106  ///It builds the window according to the information provided
107  ///by the creator. It needs the identifier of the algorithm
108  ///to visualize, and a list of name of \ref NoteBookTab s that can
109  ///be found in \ref MainWin.
110  ///\param algoid identifier of algorithm to show
111  ///\param tablist list of tabs in \ref MainWin
112  AlgoWin(int algoid, std::vector<std::string> tablist);
114  ///Forwards list of \ref NoteBookTabs toward \ref AlgoBox
116  ///In case of changement in tabs in \ref MainWin
117  ///\ref MainWin automatically updates tablist in
118  ///\ref AlgoWin s.
[1876]119  void update_tablist(std::vector<std::string> tabnames);
121  ///Forwards list of requested maps toward \ref AlgoBox
123  ///Upon catching the signal in which \ref AlgoBox requests
124  ///list of maps \ref MainWin responds
125  ///through this function.
[1879]126  void update_maplist(MapStorage *);
[1896]128  ///Called when window is closing.
130  ///\ref AlgoWin has to be deregistrated in \ref MainWin
131  ///thereforeit emits signal \ref signal_closed.
[1876]132  void on_hide();
134#endif //ALGOWIN_H
Note: See TracBrowser for help on using the repository browser.