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