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