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@57
|
8 Copyright (c) 2010 Chris Cannam
|
Chris@57
|
9 Copyright (c) 2010 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;
|
cannam@45
|
25
|
cannam@45
|
26 class Panned : public QGraphicsView
|
cannam@45
|
27 {
|
cannam@45
|
28 Q_OBJECT
|
cannam@45
|
29
|
cannam@45
|
30 public:
|
cannam@45
|
31 Panned();
|
cannam@45
|
32 virtual ~Panned() { }
|
cannam@45
|
33
|
Chris@133
|
34 virtual void setScene(QGraphicsScene *s);
|
Chris@133
|
35
|
cannam@45
|
36 signals:
|
cannam@45
|
37 void pannedRectChanged(QRectF);
|
cannam@45
|
38 void wheelEventReceived(QWheelEvent *);
|
cannam@45
|
39 void pannedContentsScrolled();
|
cannam@45
|
40 void mouseLeaves();
|
cannam@45
|
41
|
cannam@45
|
42 public slots:
|
cannam@45
|
43 void slotSetPannedRect(QRectF);
|
cannam@45
|
44 void slotEmulateWheelEvent(QWheelEvent *ev);
|
cannam@45
|
45
|
Chris@53
|
46 void zoomIn();
|
Chris@53
|
47 void zoomOut();
|
Chris@53
|
48
|
cannam@45
|
49 protected:
|
cannam@45
|
50 QRectF m_pannedRect;
|
cannam@45
|
51
|
cannam@45
|
52 virtual void paintEvent(QPaintEvent *);
|
cannam@45
|
53 virtual void resizeEvent(QResizeEvent *);
|
cannam@45
|
54 virtual void drawForeground(QPainter *, const QRectF &);
|
cannam@45
|
55 virtual void wheelEvent(QWheelEvent *);
|
cannam@45
|
56 virtual void leaveEvent(QEvent *);
|
cannam@45
|
57 };
|
cannam@45
|
58
|
cannam@45
|
59 #endif
|
cannam@45
|
60
|