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