COIN-OR::LEMON - Graph Library

source: glemon-0.x/map_win.h @ 89:4042761b21e3

gui
Last change on this file since 89:4042761b21e3 was 89:4042761b21e3, checked in by Hegyi Péter, 19 years ago

Reorganizing.

File size: 2.7 KB
Line 
1// -*- C++ -*- //
2
3#ifndef MAP_WIN_H
4#define MAP_WIN_H
5
6class 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.
18class 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    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
75protected:
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
85  NewMapWin & nmw;
86
87  Gtk::Table * table;
88 
89  MapSelector ** e_combo_array, ** n_combo_array;
90
91  Gtk::Label * label;
92
93  Gtk::VBox vbox;
94
95public:
96  ///Constructor of MapWin creates the widgets shown in MapWin.
97  MapWin(const std::string& title, MapStorage &, GraphDisplayerCanvas &, NewMapWin &);
98
99  ///This function is created to set the appropriate maps on the newly created node
100  void updateNode(Graph::Node);
101
102  ///This function is created to set the appropriate maps on the newly created edge
103  void updateEdge(Graph::Edge);
104
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
111  virtual bool closeIfEscapeIsPressed(GdkEventKey*);
112
113  void update();
114};
115
116#endif //MAP_WIN_H
Note: See TracBrowser for help on using the repository browser.