#ifndef TOOL_H #define TOOL_H #include #include #include #include "../../../fixC11.h" #include "../Painter.h" class MapView2D; /** * interface for every MapView tool. * a tool may be a background tool (e.g. a ruler-display, grid, ..) * or a foreground (active) one, which e.g. selects nodes, creates a new element, ... */ class Tool : public QObject { Q_OBJECT public: Tool() {;} virtual ~Tool() {;} /** the tool must return its name here */ virtual const std::string getName() const = 0; /** the tool was activated (by user or by code) */ virtual void becomesActive() {;} /** the tool was deactivated (by user or by code) */ virtual void becomesInactive() {;} /** events: return TRUE when you consumed the event */ virtual bool mousePressEvent(MapView2D* m, QMouseEvent* e) { (void) m; (void) e; return false; } virtual bool mouseMoveEvent(MapView2D* m, QMouseEvent* e) { (void) m; (void) e; return false; } virtual bool mouseReleaseEvent(MapView2D* m, QMouseEvent* e) { (void) m; (void) e; return false; } virtual bool wheelEvent(MapView2D* m, QWheelEvent* e) { (void) m; (void) e; return false; } virtual bool keyPressEvent(MapView2D* m, QKeyEvent* e) { (void) m; (void) e; return false; } virtual void paintBefore(MapView2D* m, Painter& p) { (void) m; (void) p; } virtual void paintAfter(MapView2D* m, Painter& p) { (void) m; (void) p; } virtual void layerChange(MapView2D* m) { (void) m; } signals: void onHelpTextChange(QString str); }; #endif // TOOL_H