comparison widgets/Panner.h @ 173:9c40dc10c88c

* Rename the existing Panner to Overview (big duh!) * Fixes to the new Panner.
author Chris Cannam
date Thu, 19 Oct 2006 09:57:27 +0000
parents d0b95a8cac96
children 96b8a790730a
comparison
equal deleted inserted replaced
172:d0b95a8cac96 173:9c40dc10c88c
23 Q_OBJECT 23 Q_OBJECT
24 24
25 public: 25 public:
26 Panner(QWidget *parent = 0); 26 Panner(QWidget *parent = 0);
27 virtual ~Panner(); 27 virtual ~Panner();
28
29 void setDefaultRectCentre(float, float);
28 30
29 virtual void mousePressEvent(QMouseEvent *e); 31 virtual void mousePressEvent(QMouseEvent *e);
30 virtual void mouseDoubleClickEvent(QMouseEvent *e); 32 virtual void mouseDoubleClickEvent(QMouseEvent *e);
31 virtual void mouseMoveEvent(QMouseEvent *e); 33 virtual void mouseMoveEvent(QMouseEvent *e);
32 virtual void mouseReleaseEvent(QMouseEvent *e); 34 virtual void mouseReleaseEvent(QMouseEvent *e);
87 void setRectCentreY(float y); 89 void setRectCentreY(float y);
88 90
89 protected: 91 protected:
90 void normalise(); 92 void normalise();
91 void emitAndUpdate(); 93 void emitAndUpdate();
94 void resetToDefault();
92 95
93 float m_rectX; 96 float m_rectX;
94 float m_rectY; 97 float m_rectY;
95 float m_rectWidth; 98 float m_rectWidth;
96 float m_rectHeight; 99 float m_rectHeight;
100
101 float m_defaultCentreX;
102 float m_defaultCentreY;
103 bool m_defaultsSet;
104
105 float centreX() const { return m_rectX + m_rectWidth/2; }
106 float centreY() const { return m_rectY + m_rectHeight/2; }
107
108 bool m_clicked;
109 QPoint m_clickPos;
110 float m_dragStartX;
111 float m_dragStartY;
97 }; 112 };
98 113
99 #endif 114 #endif
100 115