1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/gui/graph_displayer_canvas.h Wed May 11 16:55:18 2005 +0000
1.3 @@ -0,0 +1,65 @@
1.4 +// -*- C++ -*- //
1.5 +
1.6 +#ifndef GRAPH_DISPLAYER_CANVAS_H
1.7 +#define GRAPH_DISPLAYER_CANVAS_H
1.8 +
1.9 +#include <all_include.h>
1.10 +#include <mapstorage.h>
1.11 +#include <libgnomecanvasmm.h>
1.12 +#include <libgnomecanvasmm/polygon.h>
1.13 +
1.14 +class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA
1.15 +{
1.16 + typedef Gnome::Canvas::CanvasAA Parent;
1.17 +
1.18 +public:
1.19 + GraphDisplayerCanvas(Graph &, CoordinatesMap &, MapStorage &);
1.20 + virtual ~GraphDisplayerCanvas();
1.21 +
1.22 + int changeLineWidth (std::string mapname);
1.23 + int changeColor (std::string mapname);
1.24 + int changeText (std::string mapname);
1.25 + int rezoom();
1.26 +
1.27 +protected:
1.28 +
1.29 + virtual bool on_expose_event(GdkEventExpose *);
1.30 +
1.31 +private:
1.32 +
1.33 + ///Event handler function that handles dragging nodes of displayed_graph
1.34 + bool event_handler(GdkEvent* e, Node n);
1.35 +
1.36 + ///The graph, on which we work
1.37 + Graph g;
1.38 + ///Map of nodes of planefigure
1.39 + Graph::NodeMap<Gnome::Canvas::Ellipse *> nodesmap;
1.40 + ///Map of edges of planefigure
1.41 + Graph::EdgeMap<Gnome::Canvas::Line *> edgesmap;
1.42 +
1.43 + ///Map of texts to write on edges
1.44 + Graph::EdgeMap<Gnome::Canvas::Text *> edgetextmap;
1.45 +
1.46 + ///Group of graphical elements of displayed_graph
1.47 + Gnome::Canvas::Group displayed_graph;
1.48 +
1.49 + ///Here we store the maps that can be displayed through properties.
1.50 + MapStorage mapstorage;
1.51 +
1.52 + ///Indicates whether the button of mouse is pressed or not
1.53 + bool isbutton;
1.54 +
1.55 + ///At this location was the mousebutton pressed.
1.56 + ///It helps to calculate the distance of dragging.
1.57 + double clicked_x, clicked_y;
1.58 +
1.59 + ///Remembers which Gnome::Canvas::Item was pressed.
1.60 + ///this variable is needed, because
1.61 + ///1. we cannot query the item at he cursor as fast as it could not cause a Segmentation Fault
1.62 + ///2. we would like to handle only ony item per movement, therefore quering it is not a working solution
1.63 + Gnome::Canvas::Item * active_item;
1.64 +
1.65 +
1.66 +};
1.67 +
1.68 +#endif //GRAPH_DISPLAYER_CANVAS_H