76 lines
2.1 KiB
C++
76 lines
2.1 KiB
C++
/*
|
||
* © Copyright 2014 – Urheberrechtshinweis
|
||
* Alle Rechte vorbehalten / All Rights Reserved
|
||
*
|
||
* Programmcode ist urheberrechtlich geschuetzt.
|
||
* Das Urheberrecht liegt, soweit nicht ausdruecklich anders gekennzeichnet, bei Frank Ebner.
|
||
* Keine Verwendung ohne explizite Genehmigung.
|
||
* (vgl. § 106 ff UrhG / § 97 UrhG)
|
||
*/
|
||
|
||
#ifndef TOOL_H
|
||
#define TOOL_H
|
||
|
||
#include <QKeyEvent>
|
||
#include <QMouseEvent>
|
||
#include <QObject>
|
||
|
||
#include "../../../fixC11.h"
|
||
|
||
#include "../Painter.h"
|
||
|
||
class QPinchGesture;
|
||
class QPanGesture;
|
||
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 bool pinchTriggered(MapView2D* m, QPinchGesture* g) { (void) m; (void) g; return false; }
|
||
virtual bool panTriggered(MapView2D* m, QPanGesture* g) { (void) m; (void) g; 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
|