scide: LookupDialog - redo lookup on classes after partial lookup
[supercollider.git] / SCClassLibrary / Common / GUI / osx / scide_scapp / Base / SCPen.sc
blob64f3944a53253287afec8f452e3d0168fe90c29e
1 SCPen {
3         classvar font, fillColor, strokeColor;
5         *font_ { arg argFont;
6                 font = argFont;
7         }
9         *string { arg str;
10                 str.prDrawAtPoint( Point( 0, 0 ), font ? SCFont.default, fillColor ? Color.black );
11         }
13         *stringAtPoint { arg str, point;
14                 str.prDrawAtPoint( point, font ? SCFont.default, fillColor ? Color.black );
15         }
17         *stringInRect { arg str, rect;
18                 str.prDrawInRect( rect, font ? SCFont.default, fillColor ? Color.black );
19         }
21         *stringCenteredIn { arg str, inRect;
22                 var f = font ? SCFont.default;
23                 str.prDrawAtPoint(str.bounds( f ).centerIn(inRect), f, fillColor ? Color.black);        }
25         *stringLeftJustIn { arg str, inRect;
26                 var pos, bounds, f;
27                 f = font ? SCFont.default;
28                 bounds = str.prBounds( Rect.new, f );
29                 pos = bounds.centerIn(inRect);
30                 pos.x = inRect.left + 2;
31                 str.prDrawAtPoint(pos, f, fillColor ? Color.black);
32         }
34         *stringRightJustIn { arg str, inRect;
35                 var pos, bounds, f;
36                 f = font ? SCFont.default;
37                 bounds = str.prBounds( Rect.new, f );
38                 pos = bounds.centerIn(inRect);
39                 pos.x = inRect.right - 2 - bounds.width;
40                 str.prDrawAtPoint(pos, f, fillColor ? Color.black);
41         }
43         *image { arg img;
44                 img.drawAtPoint( Point( 0, 0 ), img.bounds );
45         }
47         *imageAtPoint { arg img, point;
48                 img.drawAtPoint( point, img.bounds );
49         }
51         *strokeColor_ { arg color;
52                 strokeColor = color;
53                 color.cocoaPrSetStroke;
54         }
56         *fillColor_ { arg color;
57                 fillColor = color;
58                 color.cocoaPrSetFill;
59         }
61         *color_ { arg color;
62                 color = color ? Color.black;
63                 fillColor = color;
64                 strokeColor = color;
65                 color.cocoaPrSetStroke.cocoaPrSetFill;
66         }
68         *use { arg function;
69                 var res;
70                 this.push;
71 //              this.prReset;
72                 res = function.value;
73                 this.pop;
74                 ^res
75         }
77         *prReset{
78                 this.color_(nil)
79         }
81         *translate { arg x=0, y=0;
82                 _Pen_Translate
83                 ^this.primitiveFailed
84         }
86         *scale { arg x=0, y=0;
87                 _Pen_Scale
88                 ^this.primitiveFailed
89         }
91         *skew { arg x=0, y=0;
92                 _Pen_Skew
93                 ^this.primitiveFailed
94         }
96         *rotate { arg angle=0, x=0, y=0;
97                 _Pen_Rotate
98                 ^this.primitiveFailed
99         }
101         *width_ { arg width = 1;
102                 _Pen_SetWidth
103                 ^this.primitiveFailed
104         }
106         // Paths:
107         *path { arg function;
108                 var res;
109                 this.beginPath;
110                 res = function.value;
111                 this.endPath;
112                 ^res
113         }
115         *beginPath {
116                 _Pen_BeginPath
117                 ^this.primitiveFailed
118         }
120         *moveTo { arg point;
121                 _Pen_MoveTo
122                 ^this.primitiveFailed
123         }
125         *lineTo { arg point;
126                 _Pen_LineTo
127                 ^this.primitiveFailed
128         }
130         *line { arg p1, p2;
131                 ^this.moveTo(p1).lineTo(p2);
132         }
134         *addArc { arg center, radius, startAngle, arcAngle;
135                 _Pen_AddArc
136                 ^this.primitiveFailed
137         }
139         *addWedge { arg center, radius, startAngle, arcAngle;
140                 _Pen_AddWedge
141                 ^this.primitiveFailed
142         }
144         *addAnnularWedge { arg center, innerRadius, outerRadius, startAngle, arcAngle;
145                 _Pen_AddAnnularWedge
146                 ^this.primitiveFailed
147         }
149         *addRect { arg rect;
150                 _Pen_AddRect
151                 ^this.primitiveFailed
152         }
154         *stroke {
155                 _Pen_StrokePath
156                 ^this.primitiveFailed
157         }
159         *fill {
160                 _Pen_FillPath
161                 ^this.primitiveFailed
162         }
164         *clip {
165                 _Pen_ClipPath
166                 ^this.primitiveFailed
167         }
168         *matrix_ { arg array;
169                 _Pen_SetMatrix
170                 ^this.primitiveFailed
171         }
173         *strokeRect { arg rect;
174                 _Pen_StrokeRect
175                 ^this.primitiveFailed
176         }
178         *fillRect { arg rect;
179                 _Pen_FillRect
180                 ^this.primitiveFailed
181         }
183         *strokeOval { arg rect;
184                 _Pen_StrokeOval
185                 ^this.primitiveFailed
186         }
188         *fillOval { arg rect;
189                 _Pen_FillOval
190                 ^this.primitiveFailed
191         }
193         *drawAquaButton { arg rect, type=0, down = false, on = false;
194                 _Pen_DrawAquaButton
195                 ^this.primitiveFailed
196         }
198         *setSmoothing { arg flag = true;
199                 this.deprecated(thisMethod, Meta_SCPen.findRespondingMethodFor(\smoothing_));
200                 this.smoothing = flag;
201         }
203         *smoothing_ { arg flag = true;
204                 _Pen_SetSmoothing
205                 ^this.primitiveFailed
206         }
208         //ADDITIONS:
210         *fillStroke {
211                 this.draw(3);
212         }
214         *clearRect {arg aRect=nil;
215                 _Pen_ClearRect
216                 ^this.primitiveFailed
217         }
219         *arcTo { arg point1, point2, radius;
220                 _Pen_AddArcToPoint
221                 ^this.primitiveFailed
222         }
224         *curveTo { arg point, cpoint1, cpoint2;
225                 _Pen_AddCubicCurve
226                 ^this.primitiveFailed
227         }
229         *quadCurveTo { arg point, cpoint1;
230                 _Pen_AddQuadCurve
231                 ^this.primitiveFailed
232         }
234         *alpha_ {arg opacity;
235                 _Pen_SetAlpha
236                 ^this.primitiveFailed
237         }
239         /*
240         different blend modes:
241         OS X 10.4 and > Only
242         --------------------
243         0 - Normal
244         1 - Multiply
245         2 - Screen
246         3 - Overlay
247         4 - Darken
248         5 - Lighten
249         6 - ColorDodge
250         7 - ColorBurn
251         8 - SoftLight
252         9 - HardLight
253         10 - Difference
254         11 - Exclusion
255         12 - Hue
256         13 - Saturation
257         14 - Color
258         15 - Luminosity
260         OS 10.5 and > Only
261         --------------------
262         16 - Clear
263         17 - Copy
264         18 - SourceIn
265         19 - SourceOut
266         20 - SourceATop
267         21 - DestinationOver
268         22 - DestinationIn
269         23 - DestinationATop
270         24 - XOR
271         25 - PlusDarker
272         26 - PlusLighter
273         */
275         *blendMode_{ arg mode;
276                 _Pen_SetBlendMode
277                 ^this.primitiveFailed
278         }
280         *setShadow { arg offsetPoint=Point(2,2), blur=0.5, color=Color.black;
281                 this.prSetShadow(offsetPoint, blur, color);
282         }
284         *prSetShadow { arg offsetPoint, blur, color;
285                 _Pen_SetShadow
286                 ^this.primitiveFailed
287         }
289         *beginTransparencyLayer {
290                 _Pen_BeginTLayer
291                 ^this.primitiveFailed
292         }
294         *endTransparencyLayer { // will work only for Mac Os X >= 10.3 - does nothing for others
295                 _Pen_EndTLayer
296                 ^this.primitiveFailed
297         }
299         *draw { arg option = 0;// 0 = fill, 1 = eofill, 2 = stroke, 3 = fillstroke, 4 = eofillstroke
300                 _Pen_DrawPath
301                 ^this.primitiveFailed
302         }
304         *joinStyle_ { arg style = 0; // 0 = miter, 1 = round, 2 = bevel
305                 _Pen_LineJoin
306                 ^this.primitiveFailed
307         }
309         *capStyle_ { arg style = 0; // 0 = butt, 1 = round, 2 = square
310                 _Pen_LineCap
311                 ^this.primitiveFailed
312         }
314         *lineDash_ { arg pattern; // should be a FloatArray
315                 _Pen_LineDash
316                 ^this.primitiveFailed
317         }
319         *addOval { arg rect;
320                 _Pen_AddOval
321                 ^this.primitiveFailed
322         }
324         *fillAxialGradient { arg startPoint, endPoint, color0, color1;
325                 this.prFillAxialGradient(startPoint, endPoint, color0, color1);
326         }
328         *fillRadialGradient { arg innerCircleCenter, outerCircleCenter, startRadius,
329                         endRadius, color0, color1;
330                 this.prFillRadialGradient(innerCircleCenter, outerCircleCenter, startRadius,
331                         endRadius, color0, color1)
332         }
334         *prFillAxialGradient { arg startPoint, endPoint, color0, color1;
335                 _Pen_DrawAxialGradient
336                 ^this.primitiveFailed
337         }
339         *prFillRadialGradient { arg innerCircleCenter, outerCircleCenter, startRadius,
340                         endRadius, color0, color1;
341                 _Pen_DrawRadialGradient
342                 ^this.primitiveFailed
343         }
345         // PRIVATE:
346         *push {
347                 _Pen_Push
348                 ^this.primitiveFailed
349         }
351         *pop {
352                 _Pen_Pop
353                 ^this.primitiveFailed
354         }