00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 00002 00003 /* 00004 Sonic Visualiser 00005 An audio file viewer and annotation editor. 00006 Centre for Digital Music, Queen Mary, University of London. 00007 This file copyright 2006 QMUL. 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License as 00011 published by the Free Software Foundation; either version 2 of the 00012 License, or (at your option) any later version. See the file 00013 COPYING included with this distribution for more information. 00014 */ 00015 00016 #ifndef _THUMBWHEEL_H_ 00017 #define _THUMBWHEEL_H_ 00018 00019 #include <QWidget> 00020 00021 class RangeMapper; 00022 00023 class Thumbwheel : public QWidget 00024 { 00025 Q_OBJECT 00026 00027 public: 00028 Thumbwheel(Qt::Orientation orientation, QWidget *parent = 0); 00029 virtual ~Thumbwheel(); 00030 00031 int getMinimumValue() const; 00032 int getMaximumValue() const; 00033 int getDefaultValue() const; 00034 float getSpeed() const; 00035 bool getTracking() const; 00036 bool getShowScale() const; 00037 int getValue() const; 00038 00039 void setRangeMapper(RangeMapper *mapper); // I take ownership, will delete 00040 const RangeMapper *getRangeMapper() const { return m_rangeMapper; } 00041 float getMappedValue() const; 00042 00043 void setShowToolTip(bool show); 00044 00045 QSize sizeHint() const; 00046 00047 signals: 00048 void valueChanged(int); 00049 00050 void mouseEntered(); 00051 void mouseLeft(); 00052 00053 public slots: 00054 void setMinimumValue(int min); 00055 void setMaximumValue(int max); 00056 void setDefaultValue(int deft); 00057 void setSpeed(float speed); 00058 void setTracking(bool tracking); 00059 void setShowScale(bool show); 00060 void setValue(int value); 00061 void setMappedValue(float mappedValue); 00062 void scroll(bool up); 00063 void resetToDefault(); 00064 00065 protected slots: 00066 void updateMappedValue(int value); 00067 00068 protected: 00069 virtual void mousePressEvent(QMouseEvent *e); 00070 virtual void mouseDoubleClickEvent(QMouseEvent *e); 00071 virtual void mouseMoveEvent(QMouseEvent *e); 00072 virtual void mouseReleaseEvent(QMouseEvent *e); 00073 virtual void wheelEvent(QWheelEvent *e); 00074 virtual void paintEvent(QPaintEvent *e); 00075 virtual void enterEvent(QEvent *); 00076 virtual void leaveEvent(QEvent *); 00077 00078 int m_min; 00079 int m_max; 00080 int m_default; 00081 int m_value; 00082 float m_mappedValue; 00083 bool m_noMappedUpdate; 00084 float m_rotation; 00085 Qt::Orientation m_orientation; 00086 float m_speed; 00087 bool m_tracking; 00088 bool m_showScale; 00089 bool m_clicked; 00090 bool m_atDefault; 00091 QPoint m_clickPos; 00092 float m_clickRotation; 00093 bool m_showTooltip; 00094 RangeMapper *m_rangeMapper; 00095 }; 00096 00097 #endif
1.5.1