1 /************************************************************************
3 * Copyright 2010-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 ************************************************************************/
25 #include "QcAbstractStepValue.h"
26 #include "../QcHelper.h"
27 #include "../style/style.hpp"
31 class QcSlider
: public QWidget
, QcHelper
, QcAbstractStepValue
, QtCollider::Style::Client
34 Q_PROPERTY( double shiftScale READ dummyFloat WRITE setShiftScale
);
35 Q_PROPERTY( double ctrlScale READ dummyFloat WRITE setCtrlScale
);
36 Q_PROPERTY( double altScale READ dummyFloat WRITE setAltScale
);
37 Q_PROPERTY( double step READ step WRITE setStep
)
38 Q_PROPERTY( double pixelStep READ pixelStep
)
39 Q_PROPERTY( double value READ value WRITE setValue
);
40 Q_PROPERTY( int orientation READ orientation WRITE setOrientation
);
41 Q_PROPERTY( int handleLength READ handleLength WRITE setHandleLength
);
42 Q_PROPERTY( QColor grooveColor READ grooveColor WRITE setGrooveColor
);
43 Q_PROPERTY( QColor focusColor READ focusColor WRITE setFocusColor
);
44 Q_PROPERTY( QColor knobColor READ knobColor WRITE setKnobColor
);
47 void increment( double factor
);
48 void decrement( double factor
);
52 void preAction( double );
56 double value() { return _value
; }
57 void setValue( double val
);
59 double step() { return _step
; }
60 void setStep( double d
) { _step
= d
; }
63 Qt::Orientation
orientation() const { return _ort
; }
64 void setOrientation( int );
66 int handleLength() const { return _hndLen
; }
67 void setHandleLength( int i
) { _hndLen
= i
; updateGeometry(); update(); }
69 const QColor
& knobColor() const
70 { return _knobColor
.isValid() ? _knobColor
: palette().color(QPalette::ButtonText
); }
71 void setKnobColor(const QColor
&c
) { _knobColor
= c
; update(); }
73 virtual QSize
sizeHint() const;
74 virtual QSize
minimumSizeHint() const;
77 virtual void mousePressEvent ( QMouseEvent
* );
78 virtual void mouseMoveEvent ( QMouseEvent
* );
79 virtual void wheelEvent ( QWheelEvent
* );
80 virtual void paintEvent ( QPaintEvent
* );
84 double valueAt( const QPoint
&pos
);