According to xy->Point changement.
8 #include <all_include.h>
9 //#include <mapstorage.h>
11 #include <libgnomecanvasmm.h>
12 #include <libgnomecanvasmm/polygon.h>
16 ///Algorithm identifiers.
17 enum {GENERAL, KRUSKAL, ALGO_NUM}; // algorithm IDs;
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.
35 class AlgoWin : public Gtk::Window
38 ///Algorithm specific part of \ref AlgoWin
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.
47 Gtk::Button * runbutton;
49 ///Close button. If pressed, \ref AlgoWin should close.
50 Gtk::Button * closebutton;
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.
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.
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;
86 ///Close window if escape key is pressed.
87 bool closeIfEscapeIsPressed(GdkEventKey* e);
89 ///Returns \ref signal_closed to be bindable somewhere.
90 sigc::signal<void, AlgoWin *> signal_closing();
92 ///Returns \ref signal_maplist_need to be bindable somewhere.
93 sigc::signal<void, AlgoWin *, std::string> signal_maplist_needed();
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.
99 void emit_tab_change(std::string);
101 ///Forwards signal emitted by \ref AlgoBox, in which it indicates need for \ref NewMapWin.
102 void emit_new_map_signal(std::string tabname, bool itisedge){signal_newmapwin_need.emit(tabname, itisedge);};
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
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.
126 void update_maplist(MapStorage *);
128 ///Called when window is closing.
130 ///\ref AlgoWin has to be deregistrated in \ref MainWin
131 ///thereforeit emits signal \ref signal_closed.