// -*- C++ -*- //

#ifndef MAP_WIN_H
#define MAP_WIN_H

class MapWin;

#include <all_include.h>
#include <mapstorage.h>
#include <graph_displayer_canvas.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>

///This class is responsible for creating a window,
///on which the visualization attributes can be
///assigned to maps.
class MapWin : public Gtk::Window
{
protected:
  ///The \ref GraphDisplayerCanvas on which the graph will be drawn.
  ///It has to be known for this class, because
  ///when a map assigned to a certain attribute
  ///a function of the \ref GraphDisplayerCanvas will be called.
  GraphDisplayerCanvas & gdc;

  ///The \ref MapStorage in which the visualizable maps are stored
  MapStorage & ms;

  Gtk::Table * table;
  
  Gtk::Combo * e_combo_array, * n_combo_array;

  Gtk::Label * label;

  Gtk::VBox vbox;

public:
  ///Constructor of MapWin creates the widgets shown in MapWin.
  MapWin(const std::string& title, MapStorage &, GraphDisplayerCanvas &);

  ///If a radiobutton is clicked, this function determines
  ///which button was that and after that calls the
  ///appropriate function of the \ref GraphDisplayerCanvas
  ///to change the visible values of that attribute.
  virtual void eComboChanged(int);
  ///If a radiobutton is clicked, this function determines
  ///which button was that and after that calls the
  ///appropriate function of the \ref GraphDisplayerCanvas
  ///to change the visible values of that attribute.
  virtual void nComboChanged(int);

  ///This function is created to set the appropriate maps on the newly created node
  void updateNode(Graph::Node);

  ///This function is created to set the appropriate maps on the newly created edge
  void updateEdge(Graph::Edge);

  ///This function inserts name of the new edgemap in the list in the combo box
  void registerNewEdgeMap(std::string);

  ///This function inserts name of the new nodemap in the list in the combo box
  void registerNewNodeMap(std::string);

  virtual bool closeIfEscapeIsPressed(GdkEventKey*);

};

#endif //MAP_WIN_H
