1 QMultiSliderView : QView {
2 var <editable=true, <step=0;
4 var <indexIsHorizontal=true, <elasticMode=false;
5 var <indexThumbSize=12, <valueThumbSize=12, <gap=1;
6 var <drawLines=false, <drawRects=true;
10 *qtClass { ^"QcMultiSlider" }
13 ^this.palette.baseColor;
16 background_ { arg color;
17 this.setProperty( \palette, this.palette.baseColor_(color) );
20 size { ^this.getProperty(\sliderCount) }
21 size_ { arg int; this.setProperty( \sliderCount, int ) }
23 indexIsHorizontal_ { arg bool;
24 indexIsHorizontal = bool;
26 this.setProperty( \orientation, QOrientation(\horizontal) );
28 this.setProperty( \orientation, QOrientation(\vertical) );
32 editable_ { arg aBool;
34 this.setProperty( \editable, aBool );
42 this.editable_( bool.not );
47 this.setProperty( \stepSize, aFloat );
51 ^this.getProperty( \values );
54 value_ { arg floatArray;
55 this.setProperty( \values, floatArray );
58 valueAction_ { arg val;
64 ^this.getProperty( \value );
67 currentvalue_ { arg aFloat;
68 this.setProperty( \value, aFloat );
72 ^this.getProperty( \index );
76 this.setProperty( \index, anInt );
80 ^this.getProperty( \selectionSize );
83 selectionSize_ { arg anInt;
84 this.setProperty( \selectionSize, anInt );
87 reference_ { arg aFloatArray;
88 reference = aFloatArray;
89 this.setProperty( \reference, aFloatArray );
92 startIndex_ { arg anInt;
93 this.setProperty( \startIndex, anInt );
96 elasticMode_ { arg int;
97 elasticMode = int.booleanValue;
98 this.setProperty( \elastic, elasticMode);
101 thumbSize_ { arg float;
102 this.indexThumbSize_(float);
103 this.valueThumbSize_(float);
106 indexThumbSize_ { arg float;
107 indexThumbSize = float;
108 this.setProperty( \indexThumbSize, float );
111 valueThumbSize_ { arg float;
112 valueThumbSize = float;
113 this.setProperty( \valueThumbSize, float );
118 this.setProperty( \gap, anInt );
122 xOffset_ { arg int; this.gap_(int); }
123 xOffset { arg int; ^this.gap; }
125 drawLines_ { arg bool;
127 this.setProperty( \drawLines, bool );
130 drawRects_ { arg bool;
132 this.setProperty( \drawRects, bool );
135 showIndex_ { arg aBool;
136 this.setProperty( \highlight, aBool );
139 isFilled_ { arg aBool;
140 this.setProperty( \isFilled, aBool );
143 fillColor_ { arg aColor;
144 this.setProperty( \fillColor, aColor );
147 strokeColor_ { arg aColor;
148 this.setProperty( \strokeColor, aColor );
151 colors_ { arg colorStroke, colorFill;
152 this.strokeColor_( colorStroke );
153 this.fillColor_ ( colorFill );
156 metaAction_ { arg func;
157 this.manageMethodConnection( metaAction, func, 'metaAction()', \doMetaAction );
162 metaAction.value(this);
165 defaultKeyDownAction { arg char, mod, uni, key;
167 QKey.left, { this.index = this.index - 1 },
168 QKey.right, { this.index = this.index + 1 },
169 QKey.up, { this.currentvalue = this.currentvalue + this.step },
170 QKey.down, { this.currentvalue = this.currentvalue - this.step }
175 var val = this.value;
177 if( val.size < 1 ) {^nil};
178 c = this.selectionSize;
185 defaultCanReceiveDrag { ^true; }
187 arg data = QView.currentDrag;
188 if( data.size > 0 ) {
189 if( data[0].size > 0 ) {
190 this.value = data[0];
191 this.reference = data[1];