1 QMultiSliderView : QView {
3 var <elasticMode=false;
4 var <indexThumbSize=12, <valueThumbSize=12, <gap=1;
5 var <drawLines=false, <drawRects=true;
9 *qtClass { ^"QcMultiSlider" }
11 size { ^this.getProperty(\sliderCount) }
12 size_ { arg int; this.setProperty( \sliderCount, int ) }
14 indexIsHorizontal { ^this.getProperty(\orientation) == QOrientation(\vertical) }
16 indexIsHorizontal_ { arg bool;
17 this.setProperty( \orientation, QOrientation(if(bool){\vertical}{\horizontal}) );
20 editable_ { arg aBool;
22 this.setProperty( \editable, aBool );
30 this.editable_( bool.not );
33 step { ^this.getProperty(\step) }
34 step_ { arg val; this.setProperty( \step, val ) }
37 ^this.getProperty( \values );
41 if( array.isKindOf(DoubleArray).not and: {array.isKindOf(FloatArray).not} )
42 { array = array.as(DoubleArray) };
43 this.setProperty( \values, array );
46 valueAction_ { arg val;
52 ^this.getProperty( \value );
55 currentvalue_ { arg aFloat;
56 this.setProperty( \value, aFloat );
60 ^this.getProperty( \index );
64 this.setProperty( \index, anInt );
68 ^this.getProperty( \selectionSize );
71 selectionSize_ { arg anInt;
72 this.setProperty( \selectionSize, anInt );
75 reference { ^this.getProperty(\reference) }
77 reference_ { arg array;
78 if( array.isKindOf(DoubleArray).not and: {array.isKindOf(FloatArray).not} )
79 { array = array.as(DoubleArray) };
80 this.setProperty( \reference, array );
83 startIndex_ { arg anInt;
84 this.setProperty( \startIndex, anInt );
87 elasticMode_ { arg int;
88 elasticMode = int.booleanValue;
89 this.setProperty( \elastic, elasticMode);
92 thumbSize_ { arg float;
93 this.indexThumbSize_(float);
94 this.valueThumbSize_(float);
97 indexThumbSize_ { arg float;
98 indexThumbSize = float;
99 this.setProperty( \indexThumbSize, float );
102 valueThumbSize_ { arg float;
103 valueThumbSize = float;
104 this.setProperty( \valueThumbSize, float );
109 this.setProperty( \gap, anInt );
113 xOffset_ { arg int; this.gap_(int); }
114 xOffset { arg int; ^this.gap; }
116 drawLines_ { arg bool;
118 this.setProperty( \drawLines, bool );
121 drawRects_ { arg bool;
123 this.setProperty( \drawRects, bool );
126 showIndex_ { arg aBool;
127 this.setProperty( \highlight, aBool );
130 isFilled_ { arg aBool;
131 this.setProperty( \isFilled, aBool );
138 background_ { arg color;
139 this.palette = this.palette.base_(color);
142 fillColor_ { arg aColor;
143 this.setProperty( \fillColor, aColor );
146 strokeColor_ { arg aColor;
147 this.setProperty( \strokeColor, aColor );
150 colors_ { arg colorStroke, colorFill;
151 this.strokeColor_( colorStroke );
152 this.fillColor_ ( colorFill );
155 metaAction_ { arg func;
156 this.manageMethodConnection( metaAction, func, 'metaAction()', \doMetaAction );
161 metaAction.value(this);
164 defaultKeyDownAction { arg char, mod, uni, key;
166 QKey.left, { this.index = this.index - 1 },
167 QKey.right, { this.index = this.index + 1 },
168 QKey.up, { this.currentvalue = this.currentvalue + this.step },
169 QKey.down, { this.currentvalue = this.currentvalue - this.step }
174 var val = this.value;
176 if( val.size < 1 ) {^nil};
177 c = this.selectionSize;
184 defaultCanReceiveDrag { ^true; }
186 arg data = QView.currentDrag;
187 if( data.size > 0 ) {
188 if( data[0].size > 0 ) {
189 this.value = data[0];
190 this.reference = data[1];