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 );
134 fillColor { ^this.getProperty(\fillColor) }
135 fillColor_ { arg color; this.setProperty( \fillColor, color ) }
137 strokeColor { ^this.getProperty(\strokeColor) }
138 strokeColor_ { arg color; this.setProperty( \strokeColor, color ) }
140 colors_ { arg colorStroke, colorFill;
141 this.strokeColor_( colorStroke );
142 this.fillColor_ ( colorFill );
145 metaAction_ { arg func;
146 this.manageMethodConnection( metaAction, func, 'metaAction()', \doMetaAction );
151 metaAction.value(this);
154 defaultKeyDownAction { arg char, mod, uni, keycode, key;
156 QKey.left, { this.index = this.index - 1 },
157 QKey.right, { this.index = this.index + 1 },
158 QKey.up, { this.currentvalue = this.currentvalue + this.step },
159 QKey.down, { this.currentvalue = this.currentvalue - this.step }
164 var val = this.value;
166 if( val.size < 1 ) {^nil};
167 c = this.selectionSize;
174 defaultCanReceiveDrag { ^true; }
176 arg data = QView.currentDrag;
177 if( data.size > 0 ) {
178 if( data[0].size > 0 ) {
179 this.value = data[0];
180 this.reference = data[1];