gui/algobox.h
changeset 1896 92ef660710f1
parent 1886 8b225c2935e7
     1.1 --- a/gui/algobox.h	Sat Jan 14 08:44:59 2006 +0000
     1.2 +++ b/gui/algobox.h	Sat Jan 14 13:42:37 2006 +0000
     1.3 @@ -11,42 +11,157 @@
     1.4  #include <libgnomecanvasmm.h>
     1.5  #include <libgnomecanvasmm/polygon.h>
     1.6  
     1.7 +///Ancestor class of algorithm graphical interface classes.
     1.8 +
     1.9 +///It also demonstrates, how should an algorithm graphical interface
    1.10 +///work. Children of this class have the same functions and attributes,
    1.11 +///therefore with all of them can the holder \ref AlgoWin communicate
    1.12 +///in the same way.
    1.13 +///
    1.14 +///IMPORTANT! In a child class only the following tasks are to do:
    1.15 +///
    1.16 +///-call \ref init function with correct parameters from correctly parametrized constructor
    1.17 +///
    1.18 +///-implement \ref build_box function
    1.19 +///
    1.20 +///-implement \ref run function
    1.21 +///
    1.22 +///because all other thing is automatically done in \ref init function!
    1.23 +
    1.24  class AlgoBox : public Gtk::VBox
    1.25  {
    1.26 -  sigc::signal<void, std::string> signal_maplist_need;  
    1.27 -  sigc::signal<void, std::string, bool> signal_newmapwin_need;  
    1.28 +  ///Signal emitted in case of need for list of maps.
    1.29 +
    1.30 +  ///If the user has selected different tab to work on
    1.31 +  ///new maps are selected as well. These new maps should be
    1.32 +  ///provided for \ref AlgoBox. To get these maps, \ref AlgoBox
    1.33 +  ///emits this signal.
    1.34 +  sigc::signal<void, std::string> signal_maplist_need;
    1.35 +
    1.36 +  ///Signal emitted in case of need for \ref NewMapWin.
    1.37 +
    1.38 +  ///If user wants to create a new for an input, or output
    1.39 +  ///it can let \ref NewMapWin popped up from here as well.
    1.40 +  ///In that case will be this signal emitted.
    1.41 +  sigc::signal<void, std::string, bool> signal_newmapwin_need;
    1.42  
    1.43  protected:
    1.44 +  ///Holder of tabnames.
    1.45    Gtk::ComboBoxText tabcbt;
    1.46 +
    1.47 +  ///Holder of widgets, in which nodemaps can be selected to work on.
    1.48    std::vector<MapSelector *> nodemapcbts;
    1.49 +
    1.50 +  ///Holder of widgets, in which edgemaps can be selected to work on.
    1.51    std::vector<MapSelector *> edgemapcbts;
    1.52  
    1.53 +  ///Maps of selected tabs.
    1.54    MapStorage * mapstorage;
    1.55  
    1.56  public:
    1.57 +  ///Empty constructor called by children.
    1.58    AlgoBox(){};
    1.59 -  AlgoBox(std::vector<std::string>);
    1.60  
    1.61 +  ///Constructor
    1.62 +
    1.63 +  ///Calls \ref init function
    1.64 +  ///with the provided parameters. \ref init function
    1.65 +  ///is needed, because it is virtual, therefore the
    1.66 +  ///functions of the proper class will be called when
    1.67 +  ///running.
    1.68 +  ///\param tablist list of tabs in \ref MainWin
    1.69 +  AlgoBox(std::vector<std::string> tablist);
    1.70 +
    1.71 +  ///Initiates \ref AlgoBox.
    1.72 +
    1.73 +  ///Creates the graphical interface for the realized algorithm, initiates variables, connects signals.
    1.74 +  ///
    1.75 +  ///List of tabs in \ref MainWin is required, but no one
    1.76 +  ///will be selected automatically. Every other
    1.77 +  ///entry field remains empty (unselected), until a \ref NoteBookTab
    1.78 +  ///is selected.
    1.79 +  ///
    1.80 +  ///It also have to bind all the signals to the correct place.
    1.81 +  ///This function is virtual, in all type of children of
    1.82 +  ///\ref AlgoBox the correct function willbe called.
    1.83 +  ///
    1.84 +  ///Therefore it is IMPORTANT that only \ref run and \ref build_box
    1.85 +  ///has to be implemented in children of \ref AlgoBox, every other
    1.86 +  ///thing will automatically work properly by the help of this
    1.87 +  ///function that must be called in constructor of child!!!
    1.88    virtual void init(std::vector<std::string>);
    1.89  
    1.90 -  sigc::signal<void, std::string> signal_maplist_needed();  
    1.91 -  sigc::signal<void, std::string, bool> signal_newmapwin_needed(){return signal_newmapwin_need;};  
    1.92 +  ///Signal emitted, when selected tab changes, and new list of maps required.
    1.93 +  sigc::signal<void, std::string> signal_maplist_needed();
    1.94 +
    1.95 +  ///Emitted if user wants to create a new map for inpuit or output.
    1.96 +  sigc::signal<void, std::string, bool> signal_newmapwin_needed(){return signal_newmapwin_need;};
    1.97 +
    1.98 +  ///Emits signal that requires list of maps for the recently selected \ref NoteBookTab.
    1.99    void emit_tab_change();
   1.100  
   1.101 +  ///Interface, through which \ref AlgoBox can be notified about tab addition, deletion in \ref MainWin
   1.102 +
   1.103 +  ///\param tl list
   1.104 +  ///of new tab state.
   1.105    void update_tablist( std::vector< std::string > tl );
   1.106 -  void update_maplist( MapStorage * );
   1.107  
   1.108 +  ///Interface, through which \ref AlgoBox can get the maps of the recently selected \ref NoteBookTab
   1.109 +
   1.110 +  ///\param ms the maps
   1.111 +  ///of the recently selected \ref NoteBookTab
   1.112 +  void update_maplist( MapStorage * ms);
   1.113 +
   1.114 +  ///Interface, through which \ref AlgoBox can be notified about nodemap addition.
   1.115 +
   1.116 +  ///If new map was added to \ref MapStorage of currently selected \ref NoteBookTab
   1.117 +  ///a signal is emitted by it. This signal is connected to this function, so \ref MapSelector s
   1.118 +  ///in \ref nodemapcbts can be notified, and those can registrate the new map. (\ref MapSelector::append_text)
   1.119    void nodemaplist_changed(std::string);
   1.120 +
   1.121 +  ///Interface, through which \ref AlgoBox can be notified about edgemap addition.
   1.122 +
   1.123 +  ///If new map was added to \ref MapStorage of currently selected \ref NoteBookTab
   1.124 +  ///a signal is emitted by it. This signal is connected to this function, so \ref MapSelector s
   1.125 +  ///in \ref edgemapcbts can be notified, and those can registrate the new map. (\ref MapSelector::append_text)
   1.126    void edgemaplist_changed(std::string);
   1.127  
   1.128 -  void update_cbt( std::vector< std::string > tl, Gtk::ComboBoxText &);
   1.129 -  
   1.130 +  ///Aid function to provide data for a given entry.
   1.131 +
   1.132 +  ///At the moment it is only used for updating info
   1.133 +  ///in \ref tabcbt. It clears it first, after that
   1.134 +  ///inserts the data got from caller, and if there
   1.135 +  ///was previously selected item it switches entry
   1.136 +  ///to that.
   1.137 +  ///\param tl list of entries (at the moment tabs in \ref MainWin)
   1.138 +  ///\param cbt the entry to update (at the moment only \ref tabcbt)
   1.139 +  void update_cbt( std::vector< std::string > tl, Gtk::ComboBoxText & cbt);
   1.140 +
   1.141 +  ///Runs the ralized algorithm.
   1.142 +
   1.143 +  ///Prepare the data for it
   1.144 +  ///and after that postprocess it if necessary.
   1.145 +  ///This is only a demo here, but in children it
   1.146 +  ///runs the algorithm really.
   1.147    virtual void run();
   1.148 -  
   1.149 +
   1.150 +  ///Creates the layout of the \ref AlgoBox
   1.151 +
   1.152 +  ///Place all the entries
   1.153 +  ///required. Run and close button is not
   1.154 +  ///its responsibility!
   1.155    virtual void build_box();
   1.156  
   1.157 -  virtual void emit_new_map_signal(bool);
   1.158 +  ///Emits \ref signal_newmapwin_need if user wants to create new input or output map.
   1.159  
   1.160 -  void addMapSelector(std::string, bool);
   1.161 +  ///Called in case of pressing \ref MapSelector::newbut.
   1.162 +  ///\param itisedge edge or nodemap is required.
   1.163 +  virtual void emit_new_map_signal(bool itisedge);
   1.164 +
   1.165 +  ///Aid function to make addition of \ref MapSelector easy in \ref build_box.
   1.166 +
   1.167 +  ///\param label label to show in \ref MapSelector
   1.168 +  ///\param itisedge whether edge or nodemaps stored in \ref MapSelector
   1.169 +  void addMapSelector(std::string label, bool itisedge);
   1.170  };
   1.171  #endif //ALGOBOX_H