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