ladanyi@1412: // -*- C++ -*- // ladanyi@1412: ladanyi@1412: #ifndef GRAPH_DISPLAYER_CANVAS_H ladanyi@1412: #define GRAPH_DISPLAYER_CANVAS_H ladanyi@1412: ladanyi@1412: #include ladanyi@1412: #include ladanyi@1412: #include ladanyi@1412: #include ladanyi@1412: ladanyi@1412: class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA ladanyi@1412: { ladanyi@1412: typedef Gnome::Canvas::CanvasAA Parent; ladanyi@1412: ladanyi@1412: public: ladanyi@1412: GraphDisplayerCanvas(Graph &, CoordinatesMap &, MapStorage &); ladanyi@1412: virtual ~GraphDisplayerCanvas(); ladanyi@1412: ladanyi@1412: int changeLineWidth (std::string mapname); ladanyi@1412: int changeColor (std::string mapname); ladanyi@1412: int changeText (std::string mapname); ladanyi@1412: int rezoom(); ladanyi@1412: ladanyi@1412: protected: ladanyi@1412: ladanyi@1412: virtual bool on_expose_event(GdkEventExpose *); ladanyi@1412: ladanyi@1412: private: ladanyi@1412: ladanyi@1412: ///Event handler function that handles dragging nodes of displayed_graph ladanyi@1412: bool event_handler(GdkEvent* e, Node n); ladanyi@1412: ladanyi@1412: ///The graph, on which we work ladanyi@1412: Graph g; ladanyi@1412: ///Map of nodes of planefigure ladanyi@1412: Graph::NodeMap nodesmap; ladanyi@1412: ///Map of edges of planefigure ladanyi@1412: Graph::EdgeMap edgesmap; ladanyi@1412: ladanyi@1412: ///Map of texts to write on edges ladanyi@1412: Graph::EdgeMap edgetextmap; ladanyi@1412: ladanyi@1412: ///Group of graphical elements of displayed_graph ladanyi@1412: Gnome::Canvas::Group displayed_graph; ladanyi@1412: ladanyi@1412: ///Here we store the maps that can be displayed through properties. ladanyi@1412: MapStorage mapstorage; ladanyi@1412: ladanyi@1412: ///Indicates whether the button of mouse is pressed or not ladanyi@1412: bool isbutton; ladanyi@1412: ladanyi@1412: ///At this location was the mousebutton pressed. ladanyi@1412: ///It helps to calculate the distance of dragging. ladanyi@1412: double clicked_x, clicked_y; ladanyi@1412: ladanyi@1412: ///Remembers which Gnome::Canvas::Item was pressed. ladanyi@1412: ///this variable is needed, because ladanyi@1412: ///1. we cannot query the item at he cursor as fast as it could not cause a Segmentation Fault ladanyi@1412: ///2. we would like to handle only ony item per movement, therefore quering it is not a working solution ladanyi@1412: Gnome::Canvas::Item * active_item; ladanyi@1412: ladanyi@1412: ladanyi@1412: }; ladanyi@1412: ladanyi@1412: #endif //GRAPH_DISPLAYER_CANVAS_H