1 QAbstractScroll : QView {
2 var <hasHorizontalScroller = true, <hasVerticalScroller = true;
3 var <autohidesScrollers = true;
5 autohidesScrollers_ { arg aBool;
7 if( hasHorizontalScroller ) {
8 this.setProperty( \horizontalScrollBarPolicy, 0 );
10 if( hasVerticalScroller ) {
11 this.setProperty( \verticalScrollBarPolicy, 0 );
14 if( hasHorizontalScroller ) {
15 this.setProperty( \horizontalScrollBarPolicy, 2 )
17 if( hasVerticalScroller ) {
18 this.setProperty( \verticalScrollBarPolicy, 2 );
21 autohidesScrollers = aBool;
24 hasHorizontalScroller_ { arg aBool;
27 if( autohidesScrollers ) { policy = 0 } { policy = 2 };
28 this.setProperty( \horizontalScrollBarPolicy, policy );
30 this.setProperty( \horizontalScrollBarPolicy, 1 );
32 hasHorizontalScroller = aBool;
35 hasVerticalScroller_ { arg aBool;
38 if( autohidesScrollers ) { policy = 0 } { policy = 2 };
39 this.setProperty( \verticalScrollBarPolicy, policy );
41 this.setProperty( \verticalScrollBarPolicy, 1 );
43 hasVerticalScroller = aBool;
47 /////////////////////// CONTAINERS ////////////////////////////////
49 QHLayoutView : QView {
50 *qtClass { ^"QcHLayoutWidget" }
53 QVLayoutView : QView {
54 *qtClass { ^"QcVLayoutWidget" }
57 QScrollView : QAbstractScroll {
58 var <background, <hasBorder=true;
60 *qtClass { ^"QcScrollArea" }
62 background_ { arg aColor;
64 this.setProperty( \background, aColor, true );
67 hasBorder_ { arg aBool;
69 this.setProperty( \hasBorder, aBool );
73 ^this.getProperty( \innerBounds, Rect.new );
77 ^this.getProperty( \visibleOrigin, Point.new );
80 visibleOrigin_ { arg point;
81 this.setProperty( \visibleOrigin, point );
85 /////////////////////////// WIDGETS ///////////////////////////////
87 QTextViewBase : QView {
92 this.setProperty( \alignment, QAlignment(aSymbol) );
96 QStaticText : QTextViewBase {
99 *qtClass { ^"QLabel" }
101 *new { arg aParent, aBounds;
102 var obj = super.new( aParent, aBounds );
103 obj.setProperty(\wordWrap, true);
107 background_ { arg aColor;
108 if( this.background.isNil ) {
109 this.setProperty( \autoFillBackground, true);
111 super.background_( aColor );
116 this.setProperty( \text, text );
120 ^this.palette.windowTextColor;
123 stringColor_ { arg color;
124 this.setProperty( \palette, this.palette.windowTextColor_(color) );
128 QTextField : QTextViewBase {
129 *qtClass { ^"QcTextField" }
132 ^this.getProperty( \text );
136 this.setProperty( \text, text );
140 ^this.palette.baseTextColor;
143 stringColor_ { arg color;
144 this.setProperty( \palette, this.palette.baseTextColor_(color) );
148 ^this.palette.baseColor;
151 background_ { arg color;
152 this.setProperty( \palette, this.palette.baseColor_(color) )
160 this.string_( val.asString );
163 valueAction_ { arg val;
164 this.string_( val.asString );
172 *qtClass { ^"QcButton" }
179 ^this.getProperty( \value );
183 this.setProperty( \value, argVal );
186 valueAction_ { arg anInt;
187 this.value_( anInt );
191 states_ { arg stateArray;
193 super.setProperty( \states, stateArray );
199 *qtClass { ^"QcCheckBox" }
201 *new{ |parent,bounds,text|
202 ^super.new(parent,bounds).init(text)
210 ^this.getProperty(\value)
214 this.setProperty(\value,val)
218 this.setProperty(\text,string)
222 ^this.getProperty(\text)
226 QAbstractStepValue : QView {
227 var <step, <shift_scale, <ctrl_scale, <alt_scale;
231 this.setProperty( \step, aFloat );
235 ^this.getProperty( \value );
239 this.setProperty( \value, argVal );
242 valueAction_ { arg val;
247 shift_scale_ { arg aFloat;
248 shift_scale = aFloat;
249 this.setProperty( \shiftScale, aFloat );
252 ctrl_scale_ { arg aFloat;
254 this.setProperty( \ctrlScale, aFloat );
257 alt_scale_ { arg aFloat;
259 this.setProperty( \altScale, aFloat );
263 this.nonimpl( \increment );
267 this.nonimpl( \decrement );
271 QSlider : QAbstractStepValue {
272 //compatibility stuff:
276 *qtClass { ^"QcSlider" }
278 *new { arg parent, bounds;
279 ^super.new( parent, bounds ).initQSlider( bounds );
283 ^this.palette.buttonColor;
286 knobColor_ { arg color;
287 this.setProperty( \palette, this.palette.buttonColor_(color) );
290 initQSlider { arg bounds;
292 if( bounds.notNil ) {
294 if( r.width > r.height ) {
295 this.orientation_( \horizontal );
297 this.orientation_( \vertical );
306 orientation_ { arg aSymbol;
307 orientation = aSymbol;
308 this.setProperty( \orientation, QOrientation(aSymbol) );
312 QNumberBox : QAbstractStepValue {
313 var <clipLo, <clipHi, <scroll, <scroll_step, <decimals;
314 var <align, <buttonsVisible = false;
315 var <normalColor, <typingColor;
317 *qtClass { ^"QcNumberBox" }
319 *new { arg aParent, aBounds;
320 var obj = super.new( aParent, aBounds );
330 normalColor = Color.black;
331 typingColor = Color.red;
334 clipLo_ { arg aFloat;
336 this.setProperty( \minimum, aFloat; );
339 clipHi_ { arg aFloat;
341 this.setProperty( \maximum, aFloat; );
346 this.setProperty( \scroll, aBool );
349 scroll_step_ { arg aFloat;
350 scroll_step = aFloat;
351 this.setProperty( \scrollStep, aFloat );
354 decimals_ { arg anInt;
356 this.setProperty( \decimals, anInt );
359 align_ { arg alignment;
361 this.setProperty( \alignment, QAlignment(alignment));
365 ^this.palette.baseTextColor;
368 stringColor_ { arg color;
369 this.setProperty( \palette, this.palette.baseTextColor_(color) );
372 normalColor_ { arg aColor;
373 normalColor = aColor;
374 this.setProperty( \normalColor, aColor );
377 typingColor_ { arg aColor;
378 typingColor = aColor;
379 this.setProperty( \editingColor, aColor );
383 ^this.palette.baseColor;
386 background_ { arg color;
387 this.setProperty( \palette, this.palette.baseColor_(color) )
390 buttonsVisible_ { arg aBool;
391 buttonsVisible = aBool;
392 this.setProperty( \buttonsVisible, aBool );
396 QItemViewBase : QView
400 items_ { arg stringArray;
402 this.setProperty( \items, stringArray);
406 ^items.at( this.value );
409 valueAction_ { arg val;
415 QPopUpMenu : QItemViewBase {
417 *qtClass { ^"QcPopUpMenu" }
420 var v = this.getProperty( \currentIndex );
421 if( v < 0 ) { ^nil } { ^v };
425 this.setProperty( \currentIndex, val ? -1 );
429 ^this.palette.buttonTextColor;
432 stringColor_ { arg color;
433 this.setProperty( \palette, this.palette.buttonTextColor_(color) );
438 var <bufnum, <style=0, <xZoom=1.0, <yZoom=1.0, <x=0.0, <y=0.0;
441 *qtClass { ^"QcScope" }
445 this.setProperty( \bufferNumber, anInt );
450 this.setProperty( \style, anInt );
455 this.setProperty( \xZoom, aFloat );
460 this.setProperty( \yZoom, aFloat );
465 this.setProperty( \xOffset, aFloat );
470 this.setProperty( \yOffset, aFloat );
473 waveColors_ { arg aColorArray;
474 waveColors = aColorArray;
475 this.setProperty( \waveColors, aColorArray );
478 background { ^this.getProperty( \background, Color.new ); }
480 background_ { arg color; this.setProperty( \background, color, true ); }