Chris@132
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@132
|
2
|
Chris@132
|
3 /*
|
Chris@132
|
4 Sonic Visualiser
|
Chris@132
|
5 An audio file viewer and annotation editor.
|
Chris@132
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@182
|
7 This file copyright 2006 QMUL.
|
Chris@132
|
8
|
Chris@132
|
9 This program is free software; you can redistribute it and/or
|
Chris@132
|
10 modify it under the terms of the GNU General Public License as
|
Chris@132
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@132
|
12 License, or (at your option) any later version. See the file
|
Chris@132
|
13 COPYING included with this distribution for more information.
|
Chris@132
|
14 */
|
Chris@132
|
15
|
Chris@132
|
16 #ifndef _THUMBWHEEL_H_
|
Chris@132
|
17 #define _THUMBWHEEL_H_
|
Chris@132
|
18
|
Chris@132
|
19 #include <QWidget>
|
Chris@132
|
20
|
Chris@187
|
21 class RangeMapper;
|
Chris@187
|
22
|
Chris@132
|
23 class Thumbwheel : public QWidget
|
Chris@132
|
24 {
|
Chris@132
|
25 Q_OBJECT
|
Chris@132
|
26
|
Chris@132
|
27 public:
|
Chris@133
|
28 Thumbwheel(Qt::Orientation orientation, QWidget *parent = 0);
|
Chris@132
|
29 virtual ~Thumbwheel();
|
Chris@132
|
30
|
Chris@133
|
31 int getMinimumValue() const;
|
Chris@133
|
32 int getMaximumValue() const;
|
Chris@133
|
33 int getDefaultValue() const;
|
Chris@132
|
34 float getSpeed() const;
|
Chris@132
|
35 bool getTracking() const;
|
Chris@132
|
36 bool getShowScale() const;
|
Chris@132
|
37 int getValue() const;
|
Chris@132
|
38
|
Chris@132
|
39 virtual void mousePressEvent(QMouseEvent *e);
|
Chris@132
|
40 virtual void mouseDoubleClickEvent(QMouseEvent *e);
|
Chris@132
|
41 virtual void mouseMoveEvent(QMouseEvent *e);
|
Chris@132
|
42 virtual void mouseReleaseEvent(QMouseEvent *e);
|
Chris@132
|
43 virtual void wheelEvent(QWheelEvent *e);
|
Chris@132
|
44 virtual void paintEvent(QPaintEvent *e);
|
Chris@132
|
45
|
Chris@187
|
46 void setRangeMapper(RangeMapper *mapper); // I take ownership, will delete
|
Chris@187
|
47 const RangeMapper *getRangeMapper() const { return m_rangeMapper; }
|
Chris@187
|
48 float getMappedValue() const;
|
Chris@187
|
49
|
Chris@187
|
50 void setShowToolTip(bool show);
|
Chris@187
|
51
|
Chris@132
|
52 QSize sizeHint() const;
|
Chris@132
|
53
|
Chris@132
|
54 signals:
|
Chris@132
|
55 void valueChanged(int);
|
Chris@132
|
56
|
Chris@133
|
57 public slots:
|
Chris@133
|
58 void setMinimumValue(int min);
|
Chris@133
|
59 void setMaximumValue(int max);
|
Chris@133
|
60 void setDefaultValue(int deft);
|
Chris@133
|
61 void setSpeed(float speed);
|
Chris@133
|
62 void setTracking(bool tracking);
|
Chris@133
|
63 void setShowScale(bool show);
|
Chris@133
|
64 void setValue(int value);
|
Chris@187
|
65 void setMappedValue(float mappedValue);
|
Chris@133
|
66 void resetToDefault();
|
Chris@133
|
67
|
Chris@187
|
68 protected slots:
|
Chris@187
|
69 void updateMappedValue(int value);
|
Chris@187
|
70
|
Chris@132
|
71 private:
|
Chris@132
|
72 int m_min;
|
Chris@132
|
73 int m_max;
|
Chris@132
|
74 int m_default;
|
Chris@132
|
75 int m_value;
|
Chris@187
|
76 float m_mappedValue;
|
Chris@187
|
77 bool m_noMappedUpdate;
|
Chris@165
|
78 float m_rotation;
|
Chris@132
|
79 Qt::Orientation m_orientation;
|
Chris@132
|
80 float m_speed;
|
Chris@132
|
81 bool m_tracking;
|
Chris@132
|
82 bool m_showScale;
|
Chris@132
|
83 bool m_clicked;
|
Chris@133
|
84 bool m_atDefault;
|
Chris@132
|
85 QPoint m_clickPos;
|
Chris@165
|
86 float m_clickRotation;
|
Chris@187
|
87 bool m_showTooltip;
|
Chris@187
|
88 RangeMapper *m_rangeMapper;
|
Chris@132
|
89 };
|
Chris@132
|
90
|
Chris@132
|
91 #endif
|