annotate src/panned.h @ 461:33a1c7c9d9d9

Textual fix
author Chris Cannam
date Thu, 30 Jun 2011 09:43:18 +0100
parents 44cef6368690
children 533519ebc0cb
rev   line source
Chris@57 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
cannam@45 2
cannam@45 3 /*
Chris@57 4 EasyMercurial
Chris@57 5
Chris@57 6 Based on HgExplorer by Jari Korhonen
Chris@57 7 Copyright (c) 2010 Jari Korhonen
Chris@244 8 Copyright (c) 2011 Chris Cannam
Chris@244 9 Copyright (c) 2011 Queen Mary, University of London
Chris@57 10
cannam@45 11 This program is free software; you can redistribute it and/or
cannam@45 12 modify it under the terms of the GNU General Public License as
cannam@45 13 published by the Free Software Foundation; either version 2 of the
cannam@45 14 License, or (at your option) any later version. See the file
cannam@45 15 COPYING included with this distribution for more information.
cannam@45 16 */
cannam@45 17
Chris@57 18 #ifndef _PANNED_H_
Chris@57 19 #define _PANNED_H_
cannam@45 20
cannam@45 21 #include <QGraphicsView>
cannam@45 22
cannam@45 23 class QWheelEvent;
cannam@45 24 class QEvent;
Chris@168 25 class QTimer;
cannam@45 26
cannam@45 27 class Panned : public QGraphicsView
cannam@45 28 {
cannam@45 29 Q_OBJECT
cannam@45 30
cannam@45 31 public:
cannam@45 32 Panned();
cannam@45 33 virtual ~Panned() { }
cannam@45 34
Chris@133 35 virtual void setScene(QGraphicsScene *s);
Chris@133 36
cannam@45 37 signals:
cannam@45 38 void pannedRectChanged(QRectF);
cannam@45 39 void wheelEventReceived(QWheelEvent *);
cannam@45 40 void pannedContentsScrolled();
cannam@45 41 void mouseLeaves();
cannam@45 42
cannam@45 43 public slots:
cannam@45 44 void slotSetPannedRect(QRectF);
cannam@45 45 void slotEmulateWheelEvent(QWheelEvent *ev);
cannam@45 46
Chris@53 47 void zoomIn();
Chris@53 48 void zoomOut();
Chris@53 49
Chris@168 50 private slots:
Chris@168 51 void dragTimerTimeout();
Chris@168 52
cannam@45 53 protected:
cannam@45 54 QRectF m_pannedRect;
cannam@45 55
Chris@168 56 QPoint m_lastDragPos;
Chris@403 57 QPoint m_lastDragStart;
Chris@168 58 QPoint m_lastOrigin;
Chris@168 59 QPointF m_velocity;
Chris@168 60 bool m_dragging;
Chris@168 61 int m_dragTimerMs;
Chris@168 62 QTimer *m_dragTimer;
Chris@168 63
Chris@403 64 enum DragDirection {
Chris@403 65 UnknownDrag,
Chris@403 66 HorizontalDrag,
Chris@403 67 VerticalDrag,
Chris@403 68 FreeDrag
Chris@403 69 };
Chris@403 70 DragDirection m_dragDirection;
Chris@403 71 void updateDragDirection(QPoint);
Chris@403 72
Chris@168 73 virtual void mousePressEvent(QMouseEvent *);
Chris@168 74 virtual void mouseMoveEvent(QMouseEvent *);
Chris@168 75 virtual void mouseReleaseEvent(QMouseEvent *);
Chris@168 76
cannam@45 77 virtual void paintEvent(QPaintEvent *);
cannam@45 78 virtual void resizeEvent(QResizeEvent *);
cannam@45 79 virtual void drawForeground(QPainter *, const QRectF &);
cannam@45 80 virtual void wheelEvent(QWheelEvent *);
cannam@45 81 virtual void leaveEvent(QEvent *);
cannam@45 82 };
cannam@45 83
cannam@45 84 #endif
cannam@45 85