/usr/share/SuperCollider/SCClassLibrary/QtCollider/QWindow.sc is in supercollider-common 1:3.6.3~repack-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | QTopScrollWidget : QScrollCanvas {
var <>win;
doDrawFunc { win.drawFunc.value(win); }
}
QScrollTopView : QScrollView {
var >window;
*qtClass {^'QcScrollWindow'}
*new { arg win, name, bounds, resizable, border;
^super.newCustom([name, bounds, resizable, border])
.initQScrollTopView(win);
}
initQScrollTopView { arg win;
var cnv;
window = win;
// NOTE: The canvas widget must not be a QView, so that asking its
// children for parent will skip it and hit this view instead.
cnv = QTopScrollWidget.new;
cnv.win = win;
this.canvas = cnv;
}
bounds {
var r;
r = this.getProperty( \geometry );
^r.moveTo(0,0);
}
bounds_ { arg rect;
var rNew = rect.asRect;
var rOld = this.getProperty( \geometry );
this.setProperty( \geometry, rOld.resizeTo( rNew.width, rNew.height ) );
}
drawingEnabled_ { arg bool; canvas.setProperty( \drawingEnabled, bool ); }
findWindow { ^window; }
}
QTopView : QView {
var >window;
*qtClass {^'QcWindow'}
*new { arg win, name, bounds, resizable, border;
^super.newCustom([name, bounds, resizable, border])
.initQTopView(win);
}
initQTopView { arg win; window = win; }
bounds {
var r;
r = this.getProperty( \geometry );
^r.moveTo(0,0);
}
bounds_ { arg rect;
var rNew = rect.asRect;
var rOld = this.getProperty( \geometry );
this.setProperty( \geometry, rOld.resizeTo( rNew.width, rNew.height ) );
}
drawingEnabled_ { arg bool; this.setProperty( \drawingEnabled, bool ); }
findWindow { ^window; }
doDrawFunc { window.drawFunc.value(window) }
}
QWindow
{
classvar <allWindows, <>initAction;
var resizable, <drawFunc;
var <view;
//TODO
var <>acceptsClickThrough=false;
var <currentSheet;
*implementsClass {^'Window'}
*screenBounds {
_QWindow_ScreenBounds
}
*availableBounds {
_QWindow_AvailableGeometry
}
*closeAll {
allWindows.copy.do { |win| win.close };
}
/* NOTE:
- 'server' is only for compatibility with SwingOSC
- all args have to be of correct type for QWidget constructor to match!
*/
*new { arg name="",
bounds,
resizable = true,
border = true,
server,
scroll = false;
if( bounds.isNil ) {
bounds = Rect(0,0,400,400).center_( QWindow.availableBounds.center );
}{
bounds = QWindow.flipY( bounds.asRect );
};
^super.new.initQWindow( name, bounds, resizable, border, scroll );
}
//------------------------ QWindow specific -----------------------//
initQWindow { arg name, bounds, resize, border, scroll;
if( scroll )
{ view = QScrollTopView.new(this,name,bounds,resize,border); }
{ view = QTopView.new(this,name,bounds,resize,border); };
// set some necessary object vars
resizable = resize == true;
// allWindows array management
QWindow.addWindow( this );
view.connectFunction( 'destroyed()', { QWindow.removeWindow(this); }, false );
// action to call whenever a window is created
QWindow.initAction.value( this );
}
asView {
^view;
}
bounds_ { arg aRect;
var r = QWindow.flipY( aRect.asRect );
view.setProperty( \geometry, r );
if( resizable.not ) { view.fixedSize = r.size }
}
bounds {
^QWindow.flipY( view.getProperty( \geometry ) );
}
setInnerExtent { arg w, h;
// bypass this.bounds, to avoid QWindow flipping the y coordinate
var r = view.getProperty(\geometry );
view.setProperty(\geometry, r.resizeTo( w, h ); )
}
background { ^view.background; }
background_ { arg aColor; view.background = aColor; }
drawFunc_ { arg aFunction;
view.drawingEnabled = aFunction.notNil;
drawFunc = aFunction;
}
setTopLeftBounds{ arg rect, menuSpacer=45;
view.setProperty( \geometry, rect.moveBy( 0, menuSpacer ) );
}
onClose { ^view.onClose }
onClose_ { arg func; view.onClose_(func) }
// TODO
addToOnClose{ arg function; }
removeFromOnClose{ arg function; }
//------------------- simply redirected to QView ---------------------//
sizeHint { ^view.sizeHint }
minSizeHint { ^view.minSizeHint }
alpha_ { arg value; view.alpha_(value); }
addFlowLayout { arg margin, gap; ^view.addFlowLayout( margin, gap ); }
close { view.close; }
isClosed { ^view.isClosed; }
visible { ^view.visible; }
visible_ { arg boolean; view.visible_(boolean); }
front { view.front; }
fullScreen { view.fullScreen; }
endFullScreen { view.endFullScreen; }
minimize { view.minimize; }
unminimize { view.unminimize; }
name { ^view.name; }
name_ { arg string; view.name_(string); }
refresh { view.refresh; }
userCanClose { ^view.userCanClose; }
userCanClose_ { arg boolean; view.userCanClose_( boolean ); }
alwaysOnTop { ^view.alwaysOnTop; }
alwaysOnTop_ { arg boolean; view.alwaysOnTop_(boolean); }
layout { ^view.layout; }
layout_ { arg layout; view.layout_(layout); }
toFrontAction_ { arg action; view.toFrontAction_(action) }
toFrontAction { ^view.toFrontAction }
endFrontAction_ { arg action; view.endFrontAction_(action) }
endFrontAction { ^view.endFrontAction }
acceptsMouseOver { ^view.acceptsMouseOver }
acceptsMouseOver_ { arg flag; view.acceptsMouseOver_(flag) }
// ---------------------- private ------------------------------------
*flipY { arg aRect;
var flippedTop = QWindow.screenBounds.height - aRect.top - aRect.height;
^Rect( aRect.left, flippedTop, aRect.width, aRect.height );
}
*addWindow { arg window;
allWindows = allWindows.add( window );
}
*removeWindow { arg window;
allWindows.remove( window );
}
}
|