1 /************************************************************************
3 * Copyright 2011-2012 Jakob Leben (jakob.leben@gmail.com)
5 * This file is part of SuperCollider Qt GUI.
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ************************************************************************/
26 #include "QcAbstractStepValue.h"
27 #include "../style/style.hpp"
29 class QcKnob
: public QWidget
, QcAbstractStepValue
, QtCollider::Style::Client
32 Q_PROPERTY( double shiftScale READ shiftScale WRITE setShiftScale
);
33 Q_PROPERTY( double ctrlScale READ ctrlScale WRITE setCtrlScale
);
34 Q_PROPERTY( double altScale READ altScale WRITE setAltScale
);
36 Q_PROPERTY( double value READ value WRITE setValue
)
37 Q_PROPERTY( int mode READ mode WRITE setMode
)
38 Q_PROPERTY( double step READ step WRITE setStep
)
39 Q_PROPERTY( bool centered READ centered WRITE setCentered
)
40 Q_PROPERTY( QColor focusColor READ focusColor WRITE setFocusColor
);
47 void setValue( double );
48 double value() const { return _value
; }
49 void setMode( int i
) { _mode
= i
; }
50 int mode() const { return _mode
; }
51 void setStep( float step
) { _step
= step
; }
52 float step() const { return _step
; }
53 void setCentered( bool b
) { _centered
= b
; update(); }
54 bool centered() const { return _centered
; }
56 virtual QSize
sizeHint() const { return QSize(40,40); }
57 virtual QSize
minimumSizeHint() const { return QSize(15,15); }
60 virtual void mousePressEvent( QMouseEvent
* );
61 virtual void mouseMoveEvent( QMouseEvent
* );
62 virtual void paintEvent( QPaintEvent
* );
65 double value( const QPoint
& );