This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
IndoorMap/mapview/2D/tools/Tool.h
2018-10-25 12:23:40 +02:00

76 lines
2.1 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* © 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