File indexing completed on 2024-04-28 15:40:29
0001 /* SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org> 0002 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef VIEWHANDLER_H 0007 #define VIEWHANDLER_H 0008 #include "ImageDisplay.h" 0009 0010 #include <QMouseEvent> 0011 #include <qpoint.h> 0012 0013 class ImageDisplay; 0014 class QRubberBand; 0015 0016 namespace Viewer 0017 { 0018 0019 class ViewHandler : public QObject 0020 { 0021 Q_OBJECT 0022 public: 0023 explicit ViewHandler(ImageDisplay *display); 0024 bool mousePressEvent(QMouseEvent *e, const QPoint &unTranslatedPos, double scaleFactor); 0025 bool mouseReleaseEvent(QMouseEvent *e, const QPoint &unTranslatedPos, double scaleFactor); 0026 bool mouseMoveEvent(QMouseEvent *e, const QPoint &unTranslatedPos, double scaleFactor); 0027 void hideEvent(); 0028 0029 private: 0030 bool m_scale, m_pan; 0031 QPoint m_start, m_untranslatedStart, m_last; 0032 double m_errorX, m_errorY; 0033 QRubberBand *m_rubberBand; 0034 ImageDisplay *m_display; 0035 }; 0036 } 0037 0038 #endif /* VIEWHANDLER_H */ 0039 0040 // vi:expandtab:tabstop=4 shiftwidth=4: