1.1 --- a/gui/algowin.h Sat Jan 14 08:44:59 2006 +0000
1.2 +++ b/gui/algowin.h Sat Jan 14 13:42:37 2006 +0000
1.3 @@ -13,35 +13,122 @@
1.4
1.5 class MapStorage;
1.6
1.7 +///Algorithm identifiers.
1.8 enum {GENERAL, KRUSKAL, ALGO_NUM}; // algorithm IDs;
1.9
1.10 +///Window displaying graphical interface for different algorithms.
1.11 +
1.12 +///This class displays a graphical interface to set up
1.13 +///and run different algorithms. Different algorithms need
1.14 +///different inputs, running methods, etc. Therefore
1.15 +///class \ref AlgoWin is only a holder of a base class, the so
1.16 +///called AlgoBox. \ref AlgoBox is the ancestor of other
1.17 +///classes. These child classes realize interfaces of different
1.18 +///algorithms, but as their common ancestor is \ref AlgoBox
1.19 +///the interface of them is the same. \ref AlgoWin communicates
1.20 +///with these classes through this common interface. But it the
1.21 +///real object to be placed in \ref AlgoWin depends on the algorithm
1.22 +///which the \ref AlgoWin actually has to display. It gets the
1.23 +///id of algorithm to display at initialization, and therefore it is
1.24 +///able to place in itself the requested child of \ref AlgoBox
1.25 +/// visualizing the appropriate algorithm.
1.26 class AlgoWin : public Gtk::Window
1.27 {
1.28 private:
1.29 + ///Algorithm specific part of \ref AlgoWin
1.30 AlgoBox * ab;
1.31 +
1.32 + ///Run button.
1.33 +
1.34 + ///If pressed, algorithm should run.
1.35 + ///That is why common ancestor of different
1.36 + ///algorithm realizer classes have to be. In case of
1.37 + ///pressing run button a common method can be called.
1.38 Gtk::Button * runbutton;
1.39 +
1.40 + ///Close button. If pressed, \ref AlgoWin should close.
1.41 Gtk::Button * closebutton;
1.42
1.43 protected:
1.44 - sigc::signal<void, AlgoWin *> signal_closed;
1.45 - sigc::signal<void, AlgoWin *, std::string> signal_maplist_need;
1.46 - sigc::signal<void, std::string, bool> signal_newmapwin_need;
1.47 + ///Signal emitted upon close of window
1.48 +
1.49 + ///It is necessary, because \ref MainWin have to
1.50 + ///score the opened \ref AlgoWin s, to be able to communicate
1.51 + ///with them: let them know about changement in tabs, maps, etc.
1.52 + ///If \ref AlgoWin is closed, \ref MainWin has to deregistrate it.
1.53 + ///Therefore signal contains address of emitter \ref AlgoWin.
1.54 + sigc::signal<void, AlgoWin *> signal_closed;
1.55 +
1.56 + ///Signal indicating that informatino on certain maplist is required.
1.57 +
1.58 + ///It is just a forwarded signal from \ref AlgoBox, benefit of common ancestor
1.59 + ///algorithm class. User can select the graph (the holder \ref NoteBookTab) on
1.60 + ///which the algorithm should run. But different graphs (\ref NoteBookTab) have
1.61 + ///different maps. If selected tab changes this signal is emitted by \ref AlgoBox,
1.62 + ///caught and reemitted by \ref AlgoWin.
1.63 + ///
1.64 + ///Signal contains the address of \ref AlgoWin to let \ref MainWin know
1.65 + ///where should the information needed forwarded, and the name of
1.66 + ///\ref NoteBookTab, of which maps are inquired.
1.67 + sigc::signal<void, AlgoWin *, std::string> signal_maplist_need;
1.68 +
1.69 + ///Signal that indicates that a \ref NewMapWin should be popped up.
1.70 +
1.71 + ///This is a forwarded signal. If \ref AlgoBox emits a signal
1.72 + ///to let a \ref NewMapWin pop up, |ref AlgoWin catch and reemit it.
1.73 + ///
1.74 + ///Signal contains the name of \ref NoteBookTab, in which the new map
1.75 + ///should be created and a boolean that indicates whether an edge or a
1.76 + ///nodemap should be created.
1.77 + sigc::signal<void, std::string, bool> signal_newmapwin_need;
1.78
1.79 public:
1.80 + ///Close window if escape key is pressed.
1.81 bool closeIfEscapeIsPressed(GdkEventKey* e);
1.82
1.83 + ///Returns \ref signal_closed to be bindable somewhere.
1.84 sigc::signal<void, AlgoWin *> signal_closing();
1.85 +
1.86 + ///Returns \ref signal_maplist_need to be bindable somewhere.
1.87 sigc::signal<void, AlgoWin *, std::string> signal_maplist_needed();
1.88 - sigc::signal<void, std::string, bool> signal_newmapwin_needed(){return signal_newmapwin_need;};
1.89
1.90 + ///Returns \ref signal_newmapwin_need to be bindable somewhere.
1.91 + sigc::signal<void, std::string, bool> signal_newmapwin_needed(){return signal_newmapwin_need;};
1.92 +
1.93 + ///Forwards signal emitted by \ref AlgoBox, in which it indicates changement in selection of tabs.
1.94 void emit_tab_change(std::string);
1.95 +
1.96 + ///Forwards signal emitted by \ref AlgoBox, in which it indicates need for \ref NewMapWin.
1.97 void emit_new_map_signal(std::string tabname, bool itisedge){signal_newmapwin_need.emit(tabname, itisedge);};
1.98
1.99 - AlgoWin(int, std::vector<std::string>);
1.100 + ///Constructor
1.101
1.102 + ///It builds the window according to the information provided
1.103 + ///by the creator. It needs the identifier of the algorithm
1.104 + ///to visualize, and a list of name of \ref NoteBookTab s that can
1.105 + ///be found in \ref MainWin.
1.106 + ///\param algoid identifier of algorithm to show
1.107 + ///\param tablist list of tabs in \ref MainWin
1.108 + AlgoWin(int algoid, std::vector<std::string> tablist);
1.109 +
1.110 + ///Forwards list of \ref NoteBookTabs toward \ref AlgoBox
1.111 +
1.112 + ///In case of changement in tabs in \ref MainWin
1.113 + ///\ref MainWin automatically updates tablist in
1.114 + ///\ref AlgoWin s.
1.115 void update_tablist(std::vector<std::string> tabnames);
1.116 +
1.117 + ///Forwards list of requested maps toward \ref AlgoBox
1.118 +
1.119 + ///Upon catching the signal in which \ref AlgoBox requests
1.120 + ///list of maps \ref MainWin responds
1.121 + ///through this function.
1.122 void update_maplist(MapStorage *);
1.123
1.124 + ///Called when window is closing.
1.125 +
1.126 + ///\ref AlgoWin has to be deregistrated in \ref MainWin
1.127 + ///thereforeit emits signal \ref signal_closed.
1.128 void on_hide();
1.129 };
1.130 #endif //ALGOWIN_H