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 _PANNER_H_
|
Chris@57
|
19 #define _PANNER_H_
|
cannam@45
|
20
|
cannam@45
|
21 #include <QGraphicsView>
|
cannam@45
|
22
|
cannam@45
|
23 class Panned;
|
cannam@45
|
24
|
cannam@45
|
25 class Panner : public QGraphicsView
|
cannam@45
|
26 {
|
cannam@45
|
27 Q_OBJECT
|
cannam@45
|
28
|
cannam@45
|
29 public:
|
cannam@45
|
30 Panner();
|
cannam@45
|
31 virtual ~Panner() { }
|
cannam@45
|
32
|
cannam@45
|
33 virtual void setScene(QGraphicsScene *);
|
cannam@45
|
34
|
cannam@45
|
35 void connectToPanned(Panned *p);
|
cannam@45
|
36
|
cannam@45
|
37 signals:
|
cannam@45
|
38 void pannedRectChanged(QRectF);
|
cannam@45
|
39 void pannerChanged(QRectF);
|
cannam@45
|
40 void zoomIn();
|
cannam@45
|
41 void zoomOut();
|
cannam@45
|
42
|
cannam@45
|
43 public slots:
|
cannam@45
|
44 void slotSetPannedRect(QRectF);
|
cannam@45
|
45
|
cannam@45
|
46 protected slots:
|
cannam@45
|
47 void slotSceneRectChanged(const QRectF &);
|
Chris@132
|
48 void slotSceneChanged(const QList<QRectF> &);
|
cannam@45
|
49
|
cannam@45
|
50 protected:
|
cannam@45
|
51 QRectF m_pannedRect;
|
cannam@45
|
52
|
cannam@45
|
53 void moveTo(QPoint);
|
cannam@45
|
54
|
Chris@113
|
55 void fit(QRectF);
|
Chris@113
|
56
|
cannam@45
|
57 virtual void paintEvent(QPaintEvent *);
|
cannam@45
|
58 virtual void mousePressEvent(QMouseEvent *e);
|
cannam@45
|
59 virtual void mouseMoveEvent(QMouseEvent *e);
|
cannam@45
|
60 virtual void mouseReleaseEvent(QMouseEvent *e);
|
cannam@45
|
61 virtual void mouseDoubleClickEvent(QMouseEvent *e);
|
cannam@45
|
62 virtual void wheelEvent(QWheelEvent *e);
|
cannam@45
|
63
|
cannam@45
|
64 virtual void resizeEvent(QResizeEvent *);
|
cannam@45
|
65
|
cannam@45
|
66 virtual void updateScene(const QList<QRectF> &);
|
cannam@45
|
67 virtual void drawItems(QPainter *, int, QGraphicsItem *[],
|
cannam@45
|
68 const QStyleOptionGraphicsItem []);
|
cannam@45
|
69
|
cannam@45
|
70 bool m_clicked;
|
Chris@389
|
71 bool m_moved;
|
cannam@45
|
72 QRectF m_clickedRect;
|
cannam@45
|
73 QPoint m_clickedPoint;
|
cannam@45
|
74
|
cannam@45
|
75 QPixmap m_cache;
|
cannam@45
|
76 };
|
cannam@45
|
77
|
cannam@45
|
78 #endif
|
cannam@45
|
79
|