map_win.h
branchgui
changeset 94 adfdc2f70548
parent 90 e9f8f44f12a3
child 95 628c0b383d2f
equal deleted inserted replaced
11:a3fc882b2fab 12:90af6bbef35c
     3 #ifndef MAP_WIN_H
     3 #ifndef MAP_WIN_H
     4 #define MAP_WIN_H
     4 #define MAP_WIN_H
     5 
     5 
     6 class MapWin;
     6 class MapWin;
     7 
     7 
     8 #include "all_include.h"
     8 #include <all_include.h>
     9 #include "graph_displayer_canvas.h"
     9 #include <main_win.h>
    10 #include "mapstorage.h"
       
    11 #include "new_map_win.h"
       
    12 #include <libgnomecanvasmm.h>
    10 #include <libgnomecanvasmm.h>
    13 #include <libgnomecanvasmm/polygon.h>
    11 #include <libgnomecanvasmm/polygon.h>
    14 
    12 
    15 ///This class is responsible for creating a window,
    13 ///This class is responsible for creating a window,
    16 ///on which the visualization attributes can be
    14 ///on which the visualization attributes can be
    19 {
    17 {
    20 
    18 
    21   class MapSelector : public Gtk::HBox
    19   class MapSelector : public Gtk::HBox
    22   {
    20   {
    23   protected:
    21   protected:
    24     GraphDisplayerCanvas & gdc;
    22     sigc::signal<void, std::string> signal_cbt;
    25     ///The \ref MapStorage in which the visualizable maps are stored
    23     sigc::signal<void, bool> signal_newmapwin;
    26     MapStorage & ms;
       
    27 
    24 
    28     int id;
    25     int id;
    29 
    26 
    30     bool itisedge;
    27     bool itisedge;
    31 
    28 
    39 
    36 
    40     Gtk::HBox hbox;
    37     Gtk::HBox hbox;
    41 
    38 
    42     Gtk::Label * label;
    39     Gtk::Label * label;
    43 
    40 
    44     Node node_to_update;
       
    45     Edge edge_to_update;
       
    46 
       
    47 
       
    48   public:
    41   public:
    49 
    42 
    50     MapSelector(GraphDisplayerCanvas &, MapStorage &, int, bool);
    43     MapSelector(std::vector<std::string>, int, bool);
    51 
    44 
    52     void update_list();
    45     sigc::signal<void, std::string> signal_cbt_ch();
       
    46     sigc::signal<void, bool> signal_newmapwin_needed();
       
    47 
       
    48     void update_list( std::vector<std::string> );
    53 
    49 
    54     ///If a radiobutton is clicked, this function determines
    50     ///If a radiobutton is clicked, this function determines
    55     ///which button was that and after that calls the
    51     ///which button was that and after that calls the
    56     ///appropriate function of the \ref GraphDisplayerCanvas
    52     ///appropriate function of the \ref GraphDisplayerCanvas
    57     ///to change the visible values of that attribute.
    53     ///to change the visible values of that attribute.
    59 
    55 
    60     virtual void new_but_pressed();
    56     virtual void new_but_pressed();
    61 
    57 
    62     virtual void reset();
    58     virtual void reset();
    63 
    59 
    64     virtual void update(Node node);
       
    65     virtual void update(Edge edge);
       
    66 
       
    67     Glib::ustring get_active_text();
    60     Glib::ustring get_active_text();
    68     void set_active_text(Glib::ustring);
    61     void set_active_text(Glib::ustring);
    69     void append_text(Glib::ustring);
    62     void append_text(Glib::ustring);
    70   };
    63   };
    71 
    64 
    72 
    65 
    73 
    66 
    74 protected:
    67 protected:
    75   ///The \ref GraphDisplayerCanvas on which the graph will be drawn.
    68   MainWin & mainwin;
    76   ///It has to be known for this class, because
       
    77   ///when a map assigned to a certain attribute
       
    78   ///a function of the \ref GraphDisplayerCanvas will be called.
       
    79   GraphDisplayerCanvas & gdc;
       
    80 
       
    81   ///The \ref MapStorage in which the visualizable maps are stored
       
    82   MapStorage & ms;
       
    83 
    69 
    84   Gtk::Table * table;
    70   Gtk::Table * table;
    85   
    71   
    86   MapSelector ** e_combo_array, ** n_combo_array;
    72   MapSelector ** e_combo_array, ** n_combo_array;
    87 
    73 
    89 
    75 
    90   Gtk::VBox vbox;
    76   Gtk::VBox vbox;
    91 
    77 
    92 public:
    78 public:
    93   ///Constructor of MapWin creates the widgets shown in MapWin.
    79   ///Constructor of MapWin creates the widgets shown in MapWin.
    94   MapWin(const std::string& title, MapStorage &, GraphDisplayerCanvas &);
    80   MapWin(const std::string& title, std::vector<std::string>, std::vector<std::string>, MainWin & mw);
    95 
    81 
    96   ///This function is created to set the appropriate maps on the newly created node
    82   void nodeMapChanged(std::string, int);
    97   void updateNode(Graph::Node);
       
    98 
    83 
    99   ///This function is created to set the appropriate maps on the newly created edge
    84   void edgeMapChanged(std::string, int);
   100   void updateEdge(Graph::Edge);
    85 
       
    86   void newMapWinNeeded(bool, int);
   101 
    87 
   102   ///This function inserts name of the new edgemap in the list in the combo box
    88   ///This function inserts name of the new edgemap in the list in the combo box
   103   void registerNewEdgeMap(std::string);
    89   void registerNewEdgeMap(std::string);
   104 
    90 
   105   ///This function inserts name of the new nodemap in the list in the combo box
    91   ///This function inserts name of the new nodemap in the list in the combo box
   106   void registerNewNodeMap(std::string);
    92   void registerNewNodeMap(std::string);
   107 
    93 
   108   virtual bool closeIfEscapeIsPressed(GdkEventKey*);
    94   virtual bool closeIfEscapeIsPressed(GdkEventKey*);
   109 
    95 
   110   void update();
    96   void update(std::vector<std::string>, std::vector<std::string>);
   111 };
    97 };
   112 
    98 
   113 #endif //MAP_WIN_H
    99 #endif //MAP_WIN_H