1 /************************************************************************
3 * Copyright 2010 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 ************************************************************************/
22 #ifndef QC_MULTI_SLIDER
23 #define QC_MULTI_SLIDER
25 #include "../QcHelper.h"
29 class QcMultiSlider
: public QWidget
, QcHelper
31 // TODO setting selection with mouse
33 Q_PROPERTY( VariantList values READ values WRITE setValues
);
34 Q_PROPERTY( VariantList reference READ dummyVariantList WRITE setReference
);
35 Q_PROPERTY( float value READ value WRITE setValue
);
36 Q_PROPERTY( int sliderCount READ sliderCount WRITE setSliderCount
);
37 Q_PROPERTY( float stepSize READ dummyFloat WRITE setStepSize
);
38 Q_PROPERTY( int index READ index WRITE setIndex
);
39 Q_PROPERTY( int selectionSize READ selectionSize WRITE setSelectionSize
);
40 Q_PROPERTY( Qt::Orientation orientation
41 READ orientation WRITE setOrientation
);
42 Q_PROPERTY( bool elastic READ dummyBool WRITE setElastic
);
43 Q_PROPERTY( int indexThumbSize READ dummyFloat WRITE setIndexThumbSize
);
44 Q_PROPERTY( float valueThumbSize READ dummyFloat WRITE setValueThumbSize
);
45 Q_PROPERTY( int gap READ dummyInt WRITE setGap
);
46 Q_PROPERTY( bool drawLines READ dummyBool WRITE setDrawLines
);
47 Q_PROPERTY( bool drawRects READ dummyBool WRITE setDrawRects
);
48 Q_PROPERTY( bool isFilled READ dummyBool WRITE setIsFilled
);
49 Q_PROPERTY( bool highlight READ dummyBool WRITE setHighlight
);
50 Q_PROPERTY( QColor fillColor READ dummyColor WRITE setFillColor
);
51 Q_PROPERTY( QColor strokeColor READ dummyColor WRITE setStrokeColor
);
52 Q_PROPERTY( bool editable READ dummyBool WRITE setEditable
);
53 Q_PROPERTY( int startIndex READ dummyInt WRITE setStartIndex
);
57 QSize
sizeHint() const { return QSize( 500,300 ); }
58 QSize
minimumSizeHint() const { return QSize( 50, 50 ); }
67 Qt::Orientation
orientation() const { return ort
; }
68 VariantList
values() const;
70 int index() const { return _currentIndex
; }
71 int selectionSize() const { return _selectionSize
; }
73 int sliderCount() const { return _values
.size(); }
74 void setSliderCount( int size
);
75 void setValues( const VariantList
& );
76 void setReference( const VariantList
& );
77 void setValue( float f
);
78 void setStepSize( float f
);
79 void setIndex( int i
);
80 void setSelectionSize( int i
);
81 void setOrientation( Qt::Orientation o
) { ort
= o
; update(); }
82 void setElastic( bool b
) { elastic
= b
; update(); }
83 void setIndexThumbSize( float f
) { thumbSize
.setWidth(f
); update(); }
84 void setValueThumbSize( float f
) { thumbSize
.setHeight(f
); update(); }
85 void setGap( int i
) { gap
= i
; update(); }
86 void setDrawLines( bool b
) { drawLines
= b
; update(); }
87 void setDrawRects( bool b
) { drawRects
= b
; update(); }
88 void setIsFilled( bool b
) { isFilled
= b
; update(); }
89 void setHighlight( bool b
) { highlight
= b
; update(); }
90 void setFillColor( const QColor
& c
) { _fillColor
= c
; update(); }
91 void setStrokeColor( const QColor
& c
) { _strokeColor
= c
; update(); }
92 void setEditable( bool b
) { editable
= b
; }
93 void setStartIndex( int i
) { startIndex
= i
; update(); }
95 inline float valueFromPos( float pos
, float range
);
96 inline void setValue( int index
, float value
);
97 void mousePressEvent( QMouseEvent
* );
98 void mouseMoveEvent( QMouseEvent
* );
99 void paintEvent( QPaintEvent
* );
102 QList
<float> _values
;
107 // functional properties