supernova: fixes for boost-1.49 and gcc-4.7
[supercollider.git] / SCClassLibrary / QtCollider / QRangeSlider.sc
blob09ff241ca85d45510425357ee5f7f17d0270b85f
1 QRangeSlider : QAbstractStepValue {
2   *qtClass { ^"QcRangeSlider" }
4   *new { arg parent, bounds;
5     ^super.new( parent, bounds ).initQRangeSlider( bounds );
6   }
8   initQRangeSlider { arg bounds;
9     var r;
10     if( bounds.notNil ) {
11       r = bounds.asRect;
12       if( r.width > r.height ) {
13         this.orientation_( \horizontal );
14       } {
15         this.orientation_( \vertical );
16       }
17     }
18   }
20   pixelStep {
21     // FIXME for now we are using step instead
22     ^this.step;
23   }
25   orientation_ { arg aSymbol;
26     this.setProperty( \orientation, QOrientation(aSymbol) );
27   }
29   lo {
30     ^this.getProperty( \loValue );
31   }
33   lo_ { arg aFloat;
34     this.setProperty( \loValue, aFloat );
35   }
37   activeLo_ { arg aFloat;
38     this.lo_(aFloat);
39     this.doAction;
40   }
42   hi {
43     ^this.getProperty( \hiValue );
44   }
46   hi_ { arg aFloat;
47     this.setProperty( \hiValue, aFloat );
48   }
50   activeHi_ { arg aFloat;
51     this.hi_(aFloat);
52     this.doAction;
53   }
55   range {
56     ^(this.hi - this.lo);
57   }
59   range_ { arg aFloat;
60     this.hi_( this.lo + aFloat; )
61   }
63   activeRange_ { arg aFloat;
64     this.range_(aFloat);
65     this.doAction;
66   }
68   setSpan { arg lo, hi;
69     this.lo_(lo);
70     this.hi_(hi);
71   }
73   setSpanActive { arg lo, hi;
74     this.setSpan(lo,hi);
75     this.doAction;
76   }
78   setDeviation { arg deviation, average;
79     this.lo_( average - deviation );
80     this.hi_( average + deviation );
81   }
83   knobColor {
84     ^this.palette.buttonText;
85   }
87   knobColor_ { arg color;
88     this.palette = this.palette.buttonText_(color);
89   }
91   background {
92     ^this.getProperty(\grooveColor);
93   }
95   background_ { arg color;
96     this.setProperty(\grooveColor, color);
97   }
99   defaultGetDrag { ^Point(this.lo,this.hi); }
100   defaultCanReceiveDrag { ^(QView.currentDrag.class === Point); }
101   defaultReceiveDrag {
102     var pt = QView.currentDrag;
103     this.setSpanActive( pt.x, pt.y );
104   }