File indexing completed on 2024-05-12 04:19:51

0001 /*
0002 Gwenview: an image viewer
0003 Copyright 2019 Steffen Hartleib <steffenhartleib@t-online.de>
0004 
0005 This program is free software; you can redistribute it and/or
0006 modify it under the terms of the GNU General Public License
0007 as published by the Free Software Foundation; either version 2
0008 of the License, or (at your option) any later version.
0009 
0010 This program is distributed in the hope that it will be useful,
0011 but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013 GNU General Public License for more details.
0014 
0015 You should have received a copy of the GNU General Public License
0016 along with this program; if not, write to the Free Software
0017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA.
0018 
0019 */
0020 #ifndef TAPHOLDANDMOVING_H
0021 #define TAPHOLDANDMOVING_H
0022 
0023 #include <lib/gwenviewlib_export.h>
0024 
0025 // Qt
0026 #include <QGesture>
0027 #include <QGestureRecognizer>
0028 
0029 // KF
0030 
0031 // Local
0032 
0033 namespace Gwenview
0034 {
0035 struct TapHoldAndMovingRecognizerPrivate;
0036 
0037 class GWENVIEWLIB_EXPORT TapHoldAndMoving : public QGesture
0038 {
0039     Q_PROPERTY(QPoint pos READ getPos WRITE setPos)
0040 
0041 public:
0042     explicit TapHoldAndMoving(QObject *parent = nullptr);
0043     QPoint getPos()
0044     {
0045         return pos;
0046     };
0047     void setPos(QPoint _pos)
0048     {
0049         pos = _pos;
0050     };
0051 
0052 private:
0053     QPoint pos;
0054 };
0055 
0056 class GWENVIEWLIB_EXPORT TapHoldAndMovingRecognizer : public QGestureRecognizer
0057 {
0058 public:
0059     explicit TapHoldAndMovingRecognizer();
0060     ~TapHoldAndMovingRecognizer() override;
0061 
0062 private:
0063     TapHoldAndMovingRecognizerPrivate *d;
0064 
0065     virtual QGesture *create(QObject *target) override;
0066     virtual Result recognize(QGesture *state, QObject *watched, QEvent *event) override;
0067 };
0068 
0069 } // namespace
0070 #endif /* TAPHOLDANDMOVING_H */