annotate panned.h @ 363:f89e50d748ed feature_93

Enable Push button whenever the repo is non-empty, even when there is no remote location -- ask for remote location when it is pressed. Also change "Change Remote..." to "Set Remote..." to be consistent with this new usage
author Chris Cannam
date Thu, 17 Mar 2011 17:48:18 +0000
parents 8fd71f570884
children
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@168 57 QPoint m_lastOrigin;
Chris@168 58 QPointF m_velocity;
Chris@168 59 bool m_dragging;
Chris@168 60 int m_dragTimerMs;
Chris@168 61 QTimer *m_dragTimer;
Chris@168 62
Chris@168 63 virtual void mousePressEvent(QMouseEvent *);
Chris@168 64 virtual void mouseMoveEvent(QMouseEvent *);
Chris@168 65 virtual void mouseReleaseEvent(QMouseEvent *);
Chris@168 66
cannam@45 67 virtual void paintEvent(QPaintEvent *);
cannam@45 68 virtual void resizeEvent(QResizeEvent *);
cannam@45 69 virtual void drawForeground(QPainter *, const QRectF &);
cannam@45 70 virtual void wheelEvent(QWheelEvent *);
cannam@45 71 virtual void leaveEvent(QEvent *);
cannam@45 72 };
cannam@45 73
cannam@45 74 #endif
cannam@45 75