cmake: supernova - missing include_directories() for Jack
[supercollider.git] / QtCollider / widgets / QcMultiSlider.h
blob2f3c7e07497179ce50bfa9d9cd91074997063a1b
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"
26 #include "../style/style.hpp"
27 #include "../Common.h"
29 #include <QWidget>
31 class QcMultiSlider : public QWidget, QcHelper, QtCollider::Style::Client
33 // TODO setting selection with mouse
34 Q_OBJECT
35 Q_PROPERTY( int sliderCount READ sliderCount WRITE setSliderCount);
36 Q_PROPERTY( QVector<double> values READ values WRITE setValues );
37 Q_PROPERTY( QVector<double> reference READ reference WRITE setReference );
38 Q_PROPERTY( double value READ value WRITE setValue );
39 Q_PROPERTY( double step READ step WRITE setStep );
40 Q_PROPERTY( int index READ index WRITE setIndex );
41 Q_PROPERTY( int selectionSize READ selectionSize WRITE setSelectionSize );
42 Q_PROPERTY( Qt::Orientation orientation
43 READ orientation WRITE setOrientation );
44 Q_PROPERTY( bool elastic READ dummyBool WRITE setElastic );
45 Q_PROPERTY( int indexThumbSize READ dummyFloat WRITE setIndexThumbSize );
46 Q_PROPERTY( float valueThumbSize READ dummyFloat WRITE setValueThumbSize );
47 Q_PROPERTY( int gap READ dummyInt WRITE setGap );
48 Q_PROPERTY( bool drawLines READ dummyBool WRITE setDrawLines );
49 Q_PROPERTY( bool drawRects READ dummyBool WRITE setDrawRects );
50 Q_PROPERTY( bool isFilled READ dummyBool WRITE setIsFilled );
51 Q_PROPERTY( bool highlight READ dummyBool WRITE setHighlight );
52 Q_PROPERTY( QColor fillColor READ dummyColor WRITE setFillColor );
53 Q_PROPERTY( QColor strokeColor READ dummyColor WRITE setStrokeColor );
54 Q_PROPERTY( bool editable READ dummyBool WRITE setEditable );
55 Q_PROPERTY( int startIndex READ dummyInt WRITE setStartIndex );
56 Q_PROPERTY( QColor focusColor READ focusColor WRITE setFocusColor );
58 Q_SIGNALS:
59 void modified();
60 void interacted();
61 void action();
62 void metaAction();
64 public Q_SLOTS:
65 void doAction();
67 public:
68 QcMultiSlider();
70 QVector<double> values() const;
71 void setValues( const QVector<double> & );
72 double value() const;
73 void setValue( double );
75 QVector<double> reference() const;
76 void setReference( const QVector<double> & );
78 double step() const { return roundStep; }
79 void setStep( double );
81 QSize sizeHint() const { return QSize( 500,300 ); }
82 QSize minimumSizeHint() const { return QSize( 50, 50 ); }
84 protected:
85 virtual void mousePressEvent( QMouseEvent * );
86 virtual void mouseMoveEvent( QMouseEvent * );
87 virtual void paintEvent( QPaintEvent * );
89 private:
90 Qt::Orientation orientation() const { return ort; }
91 int index() const { return _currentIndex; }
92 int selectionSize() const { return _selectionSize; }
93 int sliderCount() const { return _values.size(); }
94 void setSliderCount( int size );
95 void setIndex( int i );
96 void setSelectionSize( int i );
97 void setOrientation( Qt::Orientation o ) { ort = o; update(); }
98 void setElastic( bool b ) { elastic = b; update(); }
99 void setIndexThumbSize( float f ) { thumbSize.setWidth(f); update(); }
100 void setValueThumbSize( float f ) { thumbSize.setHeight(f); update(); }
101 void setGap( int i ) { gap = i; update(); }
102 void setDrawLines( bool b ) { drawLines = b; update(); }
103 void setDrawRects( bool b ) { drawRects = b; update(); }
104 void setIsFilled( bool b ) { isFilled = b; update(); }
105 void setHighlight( bool b ) { highlight = b; update(); }
106 void setFillColor( const QColor& c ) { _fillColor = c; update(); }
107 void setStrokeColor( const QColor& c ) { _strokeColor = c; update(); }
108 void setEditable( bool b ) { editable = b; }
109 void setStartIndex( int i ) { startIndex = qBound(0, i, _values.count()-1); update(); }
111 QRect contentsRect();
112 QRect valueRect( int count, double & spacing );
113 inline float valueFromPos( float pos, float range );
114 inline void setValue( int index, double value );
115 double rounded ( double value );
117 // values
118 QList<double> _values;
119 QList<double> _ref;
120 int _currentIndex;
121 int _selectionSize;
123 // functional properties
124 double roundStep;
125 bool editable;
127 // visual properties
128 Qt::Orientation ort;
129 bool elastic;
130 QSizeF thumbSize;
131 int gap;
132 bool drawRects;
133 bool drawLines;
134 bool isFilled;
135 bool highlight;
136 QColor _fillColor;
137 QColor _strokeColor;
138 QColor _focusColor;
139 int startIndex;
141 // temporary
142 QPoint moveOrigin;
145 #endif