scide: LookupDialog - redo lookup on classes after partial lookup
[supercollider.git] / SCClassLibrary / Common / GUI / osx / scide_scapp / Base / SCCocoaView.sc
blob0f8cc34812655ed70a21d527001c39513c393219
1 SCTextView : SCView{
2         var <stringColor, <font, <editable;
3         var     <autohidesScrollers, <hasHorizontalScroller, <hasVerticalScroller, <textBounds;
4         var <usesTabToFocusNextView=true, <enterInterpretsSelection=true;
5         var <>linkAction;
7         mouseUp {arg x, y, modifiers, buttonNumber, clickCount, clickPos;
8                 mouseUpAction.value(this, x, y, modifiers, buttonNumber, clickCount, clickPos); }
10         doLinkAction { arg url, description;
11                 linkAction.value(this, url, description);
12         }
14         string{
15                 ^this.getProperty(\string);
16         }
18         string_{|str|
19                 ^this.setString(str, -1);
20         }
22         selectedString {
23                 ^this.getProperty(\selectedString);
24         }
26         selectedString_{|str|
27                 this.setProperty(\selectedString, str);
28         }
30         selectionStart {
31                 ^this.getProperty(\selectedRangeLocation);
32         }
34         selectionSize {
35                 ^this.getProperty(\selectedRange);
36         }
38         path {
39                 ^this.getProperty(\path);
40         }
42         stringColor_ {arg color;
43                 stringColor = color;
44                 this.setStringColor(color,-1, 0);
45         }
47         setStringColor{arg color, rangeStart = -1, rangeSize = 0;
48                 this.setProperty(\setTextColor, [color,rangeStart, rangeSize]);
49         }
51         syntaxColorize {
52                 this.setProperty(\setSyntaxColors);
53         }
55         font_ {arg afont;
56                 font = afont;
57                 this.setFont(font, -1, 0)
58         }
60         setFont{|       font, rangestart = -1, rangesize=0|
61                 this.setProperty(\setFont, [font, rangestart, rangesize]);
62         }
64         usesAutoInOutdent_{|bool|
65                 this.setProperty(\setUsesAutoInOutdent, bool);
66         }
68         setString{|string, rangestart=0, rangesize=0|
69                 this.setProperty(\insertStringInRange, [string, rangestart, rangesize]);
70         }
72         editable_{|bool|
73                 editable = bool;
74                 this.setProperty(\setEditable, bool);
75         }
77         enabled_{|bool|
78                 this.editable_(bool);
79         }
80         usesTabToFocusNextView_{|bool|
81                 usesTabToFocusNextView=bool;
82                 this.setProperty(\usesTabToFocusNextView, bool);
83         }
84         enterInterpretsSelection_{|bool|
85                 enterInterpretsSelection=bool;
86                 this.setProperty(\enterExecutesSelection, bool);
87         }
88         autohidesScrollers_{|bool|
89                 autohidesScrollers = bool;
90                 this.setProperty(\setAutohidesScrollers, bool);
91         }
92         hasHorizontalScroller_{|bool|
93                 hasHorizontalScroller = bool;
94                 this.setProperty(\setHasHorizontalScroller, bool);
95         }
96         hasVerticalScroller_{|bool|
97                 hasVerticalScroller = bool;
98                 this.setProperty(\setHasVerticalScroller, bool);
99         }
101         textBounds_{|rect|
102                 textBounds = rect;
103                 this.setProperty(\textBounds, rect);
104         }
106         open {|path|
107                 if ( path.contains( "://" ).not, {
108                         if ( path.first.asString != "/" ) { path = String.scDir +/+ path; };
109                         path = "file://"++path;
110                 });
111                 path = path.replace(" ", "%20");
112                 this.setProperty(\open, path);
113         }
115         *paletteExample{ arg parent, bounds;
116                 ^this.new(parent, bounds).string_("The quick brown fox jumps over the lazy dog.");
117         }
120 SCMovieView : SCView{
121         var <rate, <loopMode, <muted, <path, <editable;
123         /*
124         loop modes
125         0 Playback runs forward and backward between both endpoints.
126         1 Restarts playback at beginning when end is reached.
127         2 Playback stops when end is reached.
128         */
130         start{
131                 this.setProperty(\start);
132         }
134         stop{
135                 this.setProperty(\stop);
136         }
138         path_{|moviePath|
139                 path = moviePath;
140                 this.setProperty(\setMovie, moviePath);
141         }
143         muted_{|bool|
144                 muted = bool;
145                 this.setProperty(\setMuted, bool);
146         }
148         playSelectionOnly_{|bool|
149                 this.setProperty(\setPlaysSelectionOnly, bool);
150         }
152         rate_{|ratein|
153                 rate = ratein;
154                 this.setProperty(\setRate, ratein);
155         }
157         loopMode_{|mode|
158                 loopMode = mode;
159                 this.setProperty(\setLoopMode, mode);
160         }
162         gotoEnd{
163                 this.setProperty(\gotoEnd);
164         }
165         stepForward{
166                 this.setProperty(\stepForward);
167         }
169         stepBack{
170                 this.setProperty(\stepBack);
171         }
173         gotoBeginning{
174                 this.setProperty(\gotoBeginning);
175         }
177         currentTime_{|time|
178                 this.setProperty(\setCurrentTime, time);
179         }
181         currentTime{
182                 //"SCMovieView-currentTime is not implemented".warn;
183                 ^this.getProperty(\getCurrentTime);
184         }
186         editable_{|bool|
187                 editable = bool;
188                 this.setProperty(\setEditable, bool);
189         }
191         showControllerAndAdjustSize{|show, adjust|
192                 this.setProperty(\showControllerAndAdjustSize, [show, adjust]);
193         }
195         resizeWithMagnification{|size|
196                 this.setProperty(\resizeWithMagnification, size)
197         }
199         copy{
200                 this.setProperty(\copy);
201         }
202         clear{
203                 this.setProperty(\clear);
204         }
205         cut{
206                 this.setProperty(\cut);
207         }
208         paste{
209                 this.setProperty(\paste);
210         }
212         *paletteExample{ arg parent, bounds;
213                 ^this.new(parent, bounds).path_("Help/GUI/Cocoa-GUI/SCImage/flowers2.jpg");
214         }
218 SCWebView : SCView{
220         var <>onLoadFinished, <>onLoadFailed, <onLinkActivated, <enterInterpretsSelection=true;
222         url_ {|path|
223                 if ( path.contains( "://" ).not, {
224                 if ( path.first.asString != "/" ) { path = String.scDir +/+ path; };
225                 path = "file://"++path;
226                 });
227                 path = path.replace(" ", "%20");
228                 this.setProperty(\url, path);
229         }
231         url { ^this.getProperty(\url);}
233         title { ^this.getProperty(\title);}
235         forward { this.setProperty(\forward);}
237         back { this.setProperty(\back);}
239         reload { this.setProperty(\reload);}
241         didLoad { onLoadFinished.value(this); }
243         didFail { onLoadFailed.value(this); }
245         // Get the displayed content in html form.
246         html { ^this.getProperty(\html); }
248         // Set html content.
249         html_ { arg htmlString;
250                 this.setProperty(\html, htmlString);
251         }
253         editable_ { arg bool;
254                 this.setProperty(\editable, bool);
255         }
257         selectedText { ^this.getProperty(\selectedText); }
259         // Try to extract plain text from html content and return it.
260         plainText { ^this.getProperty(\plainText); }
262         onLinkActivated_{|func|
263                 onLinkActivated = func;
264                 this.setProperty(\handleLinks, func.isNil);
265         }
267         linkActivated {|linkString| onLinkActivated.value(this, linkString) }
269         findText { arg string, reverse = false;
270                 this.setProperty( \findText, [string, reverse] );
271         }
273         enterInterpretsSelection_{|bool|
274                 enterInterpretsSelection=bool;
275                 this.setProperty(\enterExecutesSelection, bool);
276         }
278         setFontFamily { arg generic, specific;
279                 this.setProperty(\fontFamily, [generic, specific]);
280         }
282         *paletteExample{ arg parent, bounds;
283                 ^this.new(parent, bounds).url_("http://supercollider.sourceforge.net");
284         }