/usr/share/SuperCollider/SCClassLibrary/QtCollider/QTreeView.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 | QTreeView : QView {
var <itemPressedAction;
var <onItemChanged;
*qtClass { ^'QcTreeWidget' }
columns_ { arg labels; this.setProperty( \columns, labels ); }
columns { ^this.getProperty( \columns ); }
numColumns { ^this.getProperty( \columnCount ); }
addItem { arg strings;
^this.invokeMethod( \addItem, [QTreeViewItem(),strings] ).prValidItem(this);
}
insertItem { arg index, strings;
^this.invokeMethod( \insertItem, [QTreeViewItem(),index, strings] ).prValidItem(this);
}
removeItem { arg item; this.invokeMethod( \removeItem, item ); }
numItems { ^this.getProperty( \topLevelItemCount ); }
clear { this.invokeMethod(\clear); }
currentItem {
^this.getProperty( \currentItem ).prValidItem(this);
}
currentItem_ { arg item;
this.setProperty( \currentItem, item ? QTreeViewItem() );
}
itemAt { arg index;
^this.invokeMethod( \item, [QTreeViewItem(), index] ).prValidItem(this);
}
canSort { ^this.getProperty( \sortingEnabled ) }
canSort_ { arg bool; this.setProperty( \sortingEnabled, bool ) }
sort { arg column, descending = false;
this.invokeMethod( \sort, [column, descending] )
}
itemPressedAction_ { arg action;
if(itemPressedAction.notNil) {
this.disconnectFunction( 'itemPressedAction()', itemPressedAction );
};
if(action.notNil) {
this.connectFunction( 'itemPressedAction()', action );
};
itemPressedAction = action;
}
onItemChanged_ { arg hook;
if(onItemChanged.notNil) {
this.disconnectFunction( 'currentItemChanged()', onItemChanged );
};
if(hook.notNil) {
this.connectFunction( 'currentItemChanged()', hook );
};
onItemChanged = hook;
}
/*
NOTE:
These methods can only operate on top level items
Should we include them?
value {
var i = this.currentItem.index;
if( i < 0 ) { ^nil } { ^i };
}
value_ { arg index;
var item;
if( index.notNil ) {
this.currentItem = this.itemAt(index);
} {
this.currentItem = nil;
};
}
*/
background { ^this.palette.base; }
background_ { arg color; this.palette = this.palette.base_(color) }
/////////// PRIVATE:
prForEachColumnDataPair { arg data, func;
var n = this.numColumns;
var i = 0;
var d = [] ++ data;
var nd = d.size - 1;
var id;
if( nd >= 0 ) {
while { i < n } {
id = i.wrap(0,nd);
func.value( i, d[id] );
i = i + 1;
};
};
}
// dummy for convenience in case tree view is invalid
prValidItem {
^nil;
}
}
QTreeViewItem {
var qtObject;
var <id;
var finalizer;
var <treeView;
== { arg other;
^ other.class == QTreeViewItem and: {id == other.id}
}
isNull { ^ id.isNil }
parent {
^treeView.invokeMethod( \parentItem, this ).prValidItem(treeView);
}
index {
var i = treeView.invokeMethod( \indexOfItem, this );
if(i.isInteger) {^i} {^-1};
}
childAt { arg index;
^treeView.invokeMethod( \item, [this, index] ).prValidItem(treeView);
}
addChild { arg strings;
^treeView.invokeMethod( \addItem, [this,strings] ).prValidItem(treeView);
}
insertChild { arg index, strings;
^treeView.invokeMethod( \insertItem, [this,index,strings] ).prValidItem(treeView);
}
strings {
^treeView.invokeMethod( \strings, this );
}
strings_ { arg strings;
strings.do { |string, column| this.setString(column,string) };
}
setString { arg column, string;
treeView.invokeMethod( \setText, [this,column,string] );
}
colors_ { arg colors;
treeView.prForEachColumnDataPair( colors, {
|column,color| this.setColor(column,color);
} );
}
setColor { arg column, color;
treeView.invokeMethod( \setColor, [this,column,color] );
}
textColors_ { arg textColors;
treeView.prForEachColumnDataPair( textColors, {
|column,color| this.setTextColor(column,color);
} );
}
setTextColor { arg column, color;
treeView.invokeMethod( \setTextColor, [this,column,color] );
}
setView { arg column, view;
if( view.notNil ) {
treeView.invokeMethod( \setItemWidget, [this, column, view] );
} {
this.removeView( column );
};
}
removeView { arg column;
treeView.invokeMethod( \removeItemWidget, [this, column] );
}
view { arg column;
^treeView.invokeMethod( \itemWidget, [this,column] );
}
/////// PRIVATE:
prValidItem { arg treeView_;
if( qtObject.notNil ) {
treeView = treeView_;
^this;
} {
^nil
};
}
}
|