2014-09-24 09:38:16 +00:00
|
|
|
/*
|
2020-06-15 17:42:37 +02:00
|
|
|
Copyright 2006-2020 The QElectroTech Team
|
2014-09-24 09:38:16 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef DVEVENTINTERFACE_H
|
|
|
|
#define DVEVENTINTERFACE_H
|
|
|
|
|
2015-09-19 13:27:06 +00:00
|
|
|
#include <QObject>
|
|
|
|
|
2014-09-24 09:38:16 +00:00
|
|
|
class QMouseEvent;
|
|
|
|
class QWheelEvent;
|
2014-10-10 18:16:02 +00:00
|
|
|
class QKeyEvent;
|
2014-09-24 09:38:16 +00:00
|
|
|
class DiagramView;
|
|
|
|
class Diagram;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The DVEventInterface class
|
|
|
|
* This class is the main interface for manage event of a Diagram View.
|
|
|
|
* This do nothing, for create new event behavior, we must to create new class from this.
|
|
|
|
* Each method return a bool: True if the methode do something else return false.
|
|
|
|
* Each method of DVEventInterface return false;
|
|
|
|
* isRunning() return true if action is started but not finish. By default return false.
|
|
|
|
* isFinish() return true when the action is finish, or not started. By default return true.
|
|
|
|
*/
|
2015-09-19 13:27:06 +00:00
|
|
|
class DVEventInterface : public QObject
|
2014-09-24 09:38:16 +00:00
|
|
|
{
|
2015-09-19 13:27:06 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2014-09-24 09:38:16 +00:00
|
|
|
public:
|
|
|
|
DVEventInterface(DiagramView *dv);
|
2017-08-05 02:10:01 +00:00
|
|
|
~DVEventInterface () override = 0;
|
2014-09-24 09:38:16 +00:00
|
|
|
virtual bool mouseDoubleClickEvent (QMouseEvent *event);
|
|
|
|
virtual bool mousePressEvent (QMouseEvent *event);
|
|
|
|
virtual bool mouseMoveEvent (QMouseEvent *event);
|
|
|
|
virtual bool mouseReleaseEvent (QMouseEvent *event);
|
|
|
|
virtual bool wheelEvent (QWheelEvent *event);
|
2014-10-10 18:16:02 +00:00
|
|
|
virtual bool keyPressEvent (QKeyEvent *event);
|
|
|
|
virtual bool KeyReleaseEvent (QKeyEvent *event);
|
2014-09-24 09:38:16 +00:00
|
|
|
virtual bool isRunning () const;
|
|
|
|
virtual bool isFinish () const;
|
|
|
|
|
2015-09-19 13:27:06 +00:00
|
|
|
signals:
|
|
|
|
/**
|
|
|
|
* @brief finish
|
|
|
|
* emited when the interface finish is work
|
|
|
|
*/
|
|
|
|
void finish();
|
|
|
|
|
2014-09-24 09:38:16 +00:00
|
|
|
protected:
|
|
|
|
DiagramView *m_dv;
|
|
|
|
Diagram *m_diagram;
|
|
|
|
bool m_running;
|
2014-10-10 18:16:02 +00:00
|
|
|
bool m_abort;
|
2014-09-24 09:38:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DVEVENTINTERFACE_H
|