Chris@132: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@132: Chris@132: /* Chris@132: Sonic Visualiser Chris@132: An audio file viewer and annotation editor. Chris@132: Centre for Digital Music, Queen Mary, University of London. Chris@182: This file copyright 2006 QMUL. Chris@132: Chris@132: This program is free software; you can redistribute it and/or Chris@132: modify it under the terms of the GNU General Public License as Chris@132: published by the Free Software Foundation; either version 2 of the Chris@132: License, or (at your option) any later version. See the file Chris@132: COPYING included with this distribution for more information. Chris@132: */ Chris@132: Chris@132: #ifndef _THUMBWHEEL_H_ Chris@132: #define _THUMBWHEEL_H_ Chris@132: Chris@132: #include Chris@382: #include Chris@382: Chris@382: #include Chris@132: Chris@187: class RangeMapper; Chris@187: Chris@132: class Thumbwheel : public QWidget Chris@132: { Chris@132: Q_OBJECT Chris@132: Chris@132: public: Chris@133: Thumbwheel(Qt::Orientation orientation, QWidget *parent = 0); Chris@132: virtual ~Thumbwheel(); Chris@132: Chris@133: int getMinimumValue() const; Chris@133: int getMaximumValue() const; Chris@133: int getDefaultValue() const; Chris@132: float getSpeed() const; Chris@132: bool getTracking() const; Chris@132: bool getShowScale() const; Chris@132: int getValue() const; Chris@132: Chris@187: void setRangeMapper(RangeMapper *mapper); // I take ownership, will delete Chris@187: const RangeMapper *getRangeMapper() const { return m_rangeMapper; } Chris@908: double getMappedValue() const; Chris@187: Chris@187: void setShowToolTip(bool show); Chris@187: Chris@132: QSize sizeHint() const; Chris@132: Chris@132: signals: Chris@132: void valueChanged(int); Chris@132: Chris@189: void mouseEntered(); Chris@189: void mouseLeft(); Chris@189: Chris@133: public slots: Chris@133: void setMinimumValue(int min); Chris@133: void setMaximumValue(int max); Chris@133: void setDefaultValue(int deft); Chris@133: void setSpeed(float speed); Chris@133: void setTracking(bool tracking); Chris@133: void setShowScale(bool show); Chris@133: void setValue(int value); Chris@908: void setMappedValue(double mappedValue); Chris@256: void scroll(bool up); Chris@133: void resetToDefault(); Chris@133: Chris@187: protected slots: Chris@187: void updateMappedValue(int value); Chris@187: Chris@189: protected: Chris@189: virtual void mousePressEvent(QMouseEvent *e); Chris@189: virtual void mouseDoubleClickEvent(QMouseEvent *e); Chris@189: virtual void mouseMoveEvent(QMouseEvent *e); Chris@189: virtual void mouseReleaseEvent(QMouseEvent *e); Chris@189: virtual void wheelEvent(QWheelEvent *e); Chris@189: virtual void paintEvent(QPaintEvent *e); Chris@189: virtual void enterEvent(QEvent *); Chris@189: virtual void leaveEvent(QEvent *); Chris@189: Chris@132: int m_min; Chris@132: int m_max; Chris@132: int m_default; Chris@132: int m_value; Chris@908: double m_mappedValue; Chris@187: bool m_noMappedUpdate; Chris@165: float m_rotation; Chris@132: Qt::Orientation m_orientation; Chris@132: float m_speed; Chris@132: bool m_tracking; Chris@132: bool m_showScale; Chris@132: bool m_clicked; Chris@133: bool m_atDefault; Chris@132: QPoint m_clickPos; Chris@165: float m_clickRotation; Chris@187: bool m_showTooltip; Chris@187: RangeMapper *m_rangeMapper; Chris@382: QImage m_cache; Chris@132: }; Chris@132: Chris@132: #endif