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