gui/map_win.h
author deba
Wed, 23 Nov 2005 15:42:36 +0000
changeset 1829 183b4cbf9733
parent 1819 fd82adfbe905
child 1837 8dd6160ff699
permissions -rw-r--r--
Correcting alteration notifing
     1 // -*- C++ -*- //
     2 
     3 #ifndef MAP_WIN_H
     4 #define MAP_WIN_H
     5 
     6 class MapWin;
     7 
     8 #include "all_include.h"
     9 #include "graph_displayer_canvas.h"
    10 #include "mapstorage.h"
    11 #include "new_map_win.h"
    12 #include <libgnomecanvasmm.h>
    13 #include <libgnomecanvasmm/polygon.h>
    14 
    15 ///This class is responsible for creating a window,
    16 ///on which the visualization attributes can be
    17 ///assigned to maps.
    18 class MapWin : public Gtk::Window
    19 {
    20 
    21   class MapSelector : public Gtk::HBox
    22   {
    23   protected:
    24     GraphDisplayerCanvas & gdc;
    25     ///The \ref MapStorage in which the visualizable maps are stored
    26     MapStorage & ms;
    27 
    28     int id;
    29 
    30     bool itisedge;
    31 
    32     bool default_state;
    33 
    34     bool set_new_map;
    35 
    36     Gtk::ComboBoxText cbt;
    37 
    38     Gtk::Button * newbut, * defbut;
    39 
    40     Gtk::HBox hbox;
    41 
    42     Gtk::Label * label;
    43 
    44     Node node_to_update;
    45     Edge edge_to_update;
    46 
    47 
    48   public:
    49 
    50     MapSelector(GraphDisplayerCanvas &, MapStorage &, int, bool);
    51 
    52     void update_list();
    53 
    54     ///If a radiobutton is clicked, this function determines
    55     ///which button was that and after that calls the
    56     ///appropriate function of the \ref GraphDisplayerCanvas
    57     ///to change the visible values of that attribute.
    58     virtual void comboChanged();
    59 
    60     virtual void new_but_pressed();
    61 
    62     virtual void reset();
    63 
    64     virtual void update(Node node);
    65     virtual void update(Edge edge);
    66 
    67     Glib::ustring get_active_text();
    68     void set_active_text(Glib::ustring);
    69     void append_text(Glib::ustring);
    70   };
    71 
    72 
    73 
    74 protected:
    75   ///The \ref GraphDisplayerCanvas on which the graph will be drawn.
    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 
    84   Gtk::Table * table;
    85   
    86   MapSelector ** e_combo_array, ** n_combo_array;
    87 
    88   Gtk::Label * label;
    89 
    90   Gtk::VBox vbox;
    91 
    92 public:
    93   ///Constructor of MapWin creates the widgets shown in MapWin.
    94   MapWin(const std::string& title, MapStorage &, GraphDisplayerCanvas &);
    95 
    96   ///This function is created to set the appropriate maps on the newly created node
    97   void updateNode(Graph::Node);
    98 
    99   ///This function is created to set the appropriate maps on the newly created edge
   100   void updateEdge(Graph::Edge);
   101 
   102   ///This function inserts name of the new edgemap in the list in the combo box
   103   void registerNewEdgeMap(std::string);
   104 
   105   ///This function inserts name of the new nodemap in the list in the combo box
   106   void registerNewNodeMap(std::string);
   107 
   108   virtual bool closeIfEscapeIsPressed(GdkEventKey*);
   109 
   110   void update();
   111 };
   112 
   113 #endif //MAP_WIN_H