[1442] | 1 | // -*- C++ -*- // |
---|
| 2 | |
---|
| 3 | #ifndef MAP_WIN_H |
---|
| 4 | #define MAP_WIN_H |
---|
| 5 | |
---|
[1512] | 6 | class MapWin; |
---|
| 7 | |
---|
[1606] | 8 | #include "all_include.h" |
---|
| 9 | #include "graph_displayer_canvas.h" |
---|
| 10 | #include "mapstorage.h" |
---|
[1733] | 11 | #include "new_map_win.h" |
---|
[1442] | 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 | { |
---|
[1819] | 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 | NewMapWin & nmw; |
---|
| 28 | |
---|
| 29 | int id; |
---|
| 30 | |
---|
| 31 | bool itisedge; |
---|
| 32 | |
---|
| 33 | bool default_state; |
---|
| 34 | |
---|
| 35 | bool set_new_map; |
---|
| 36 | |
---|
| 37 | Gtk::ComboBoxText cbt; |
---|
| 38 | |
---|
| 39 | Gtk::Button * newbut, * defbut; |
---|
| 40 | |
---|
| 41 | Gtk::HBox hbox; |
---|
| 42 | |
---|
| 43 | Gtk::Label * label; |
---|
| 44 | |
---|
| 45 | Node node_to_update; |
---|
| 46 | Edge edge_to_update; |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | public: |
---|
| 50 | |
---|
| 51 | MapSelector(GraphDisplayerCanvas &, MapStorage &, NewMapWin &, int, bool); |
---|
| 52 | |
---|
| 53 | void update_list(); |
---|
| 54 | |
---|
| 55 | ///If a radiobutton is clicked, this function determines |
---|
| 56 | ///which button was that and after that calls the |
---|
| 57 | ///appropriate function of the \ref GraphDisplayerCanvas |
---|
| 58 | ///to change the visible values of that attribute. |
---|
| 59 | virtual void comboChanged(); |
---|
| 60 | |
---|
| 61 | virtual void new_but_pressed(); |
---|
| 62 | |
---|
| 63 | virtual void reset(); |
---|
| 64 | |
---|
| 65 | virtual void update(Node node); |
---|
| 66 | virtual void update(Edge edge); |
---|
| 67 | |
---|
| 68 | Glib::ustring get_active_text(); |
---|
| 69 | void set_active_text(Glib::ustring); |
---|
| 70 | void append_text(Glib::ustring); |
---|
| 71 | }; |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | |
---|
[1442] | 75 | protected: |
---|
| 76 | ///The \ref GraphDisplayerCanvas on which the graph will be drawn. |
---|
| 77 | ///It has to be known for this class, because |
---|
| 78 | ///when a map assigned to a certain attribute |
---|
| 79 | ///a function of the \ref GraphDisplayerCanvas will be called. |
---|
| 80 | GraphDisplayerCanvas & gdc; |
---|
| 81 | |
---|
| 82 | ///The \ref MapStorage in which the visualizable maps are stored |
---|
| 83 | MapStorage & ms; |
---|
| 84 | |
---|
[1733] | 85 | NewMapWin & nmw; |
---|
| 86 | |
---|
[1512] | 87 | Gtk::Table * table; |
---|
[1442] | 88 | |
---|
[1731] | 89 | MapSelector ** e_combo_array, ** n_combo_array; |
---|
[1442] | 90 | |
---|
[1446] | 91 | Gtk::Label * label; |
---|
[1442] | 92 | |
---|
[1512] | 93 | Gtk::VBox vbox; |
---|
| 94 | |
---|
[1442] | 95 | public: |
---|
| 96 | ///Constructor of MapWin creates the widgets shown in MapWin. |
---|
[1733] | 97 | MapWin(const std::string& title, MapStorage &, GraphDisplayerCanvas &, NewMapWin &); |
---|
[1442] | 98 | |
---|
[1512] | 99 | ///This function is created to set the appropriate maps on the newly created node |
---|
[1524] | 100 | void updateNode(Graph::Node); |
---|
[1512] | 101 | |
---|
| 102 | ///This function is created to set the appropriate maps on the newly created edge |
---|
[1524] | 103 | void updateEdge(Graph::Edge); |
---|
[1512] | 104 | |
---|
[1586] | 105 | ///This function inserts name of the new edgemap in the list in the combo box |
---|
| 106 | void registerNewEdgeMap(std::string); |
---|
| 107 | |
---|
| 108 | ///This function inserts name of the new nodemap in the list in the combo box |
---|
| 109 | void registerNewNodeMap(std::string); |
---|
| 110 | |
---|
[1524] | 111 | virtual bool closeIfEscapeIsPressed(GdkEventKey*); |
---|
[1586] | 112 | |
---|
[1606] | 113 | void update(); |
---|
[1442] | 114 | }; |
---|
| 115 | |
---|
| 116 | #endif //MAP_WIN_H |
---|