245
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1996 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
1789
|
12 |
"{ Package: 'stx:libview2' }"
|
|
13 |
|
2634
|
14 |
StrokingOrFillingWrapper subclass:#StrokingWrapper
|
|
15 |
instanceVariableNames:''
|
245
|
16 |
classVariableNames:''
|
|
17 |
poolDictionaries:''
|
1789
|
18 |
category:'Compatibility-ST80-Graphics-Display Objects'
|
245
|
19 |
!
|
|
20 |
|
280
|
21 |
!StrokingWrapper class methodsFor:'documentation'!
|
245
|
22 |
|
|
23 |
copyright
|
|
24 |
"
|
|
25 |
COPYRIGHT (c) 1996 by Claus Gittinger
|
|
26 |
All Rights Reserved
|
|
27 |
|
|
28 |
This software is furnished under a license and may be used
|
|
29 |
only in accordance with the terms of that license and with the
|
|
30 |
inclusion of the above copyright notice. This software may not
|
|
31 |
be provided or otherwise made available to, or used by, any
|
|
32 |
other person. No title to or ownership of the software is
|
|
33 |
hereby transferred.
|
|
34 |
"
|
|
35 |
|
|
36 |
!
|
|
37 |
|
|
38 |
documentation
|
|
39 |
"
|
280
|
40 |
a wrapper for a geometric object, which is to be drawn stroked.
|
|
41 |
This allows any geometric thingy to be used as a component in a view.
|
|
42 |
|
|
43 |
(background info: geometrics are mathematical objects - they do not
|
|
44 |
keep any color or lineStyle attributes. Wrappers add this information
|
|
45 |
and can also be used as components of a view)
|
254
|
46 |
|
265
|
47 |
Notice:
|
|
48 |
this class was implemented using protocol information
|
365
|
49 |
from alpha testers, from reading PD programs and
|
|
50 |
from the Hopkins/Horan book.
|
265
|
51 |
- it may not be complete or compatible to the corresponding ST-80 class.
|
|
52 |
If you encounter any incompatibilities, please forward a note
|
|
53 |
describing the incompatibility verbal (i.e. no code) to the ST/X team.
|
|
54 |
|
248
|
55 |
[see also:]
|
280
|
56 |
FillingWrapper Geometric GraphicsContext
|
248
|
57 |
|
245
|
58 |
[author:]
|
|
59 |
Claus Gittinger
|
|
60 |
"
|
|
61 |
!
|
|
62 |
|
|
63 |
examples
|
|
64 |
"
|
280
|
65 |
wrap an ellipticArc and display it
|
|
66 |
(notice, that no automatic redraw is performed):
|
|
67 |
[exBegin]
|
|
68 |
|v e component|
|
|
69 |
|
|
70 |
v := (StandardSystemView extent:250@250) openAndWait.
|
|
71 |
|
|
72 |
e := EllipticalArc boundingBox:(10@10 corner:90@90)
|
|
73 |
startAngle:0
|
|
74 |
sweepAngle:270.
|
|
75 |
component := StrokingWrapper on:e.
|
|
76 |
|
|
77 |
component displayOn:v.
|
|
78 |
[exEnd]
|
|
79 |
|
|
80 |
wrap a rectangle and an ellipticArc,
|
|
81 |
and add them as components to a View
|
|
82 |
(notice, that doing so makes the redraw automatic):
|
|
83 |
[exBegin]
|
|
84 |
|v e component|
|
|
85 |
|
|
86 |
v := StandardSystemView extent:250@250.
|
|
87 |
|
|
88 |
e := Rectangle origin:10@10 corner:90@90.
|
|
89 |
component := FillingWrapper on:e.
|
|
90 |
component foregroundColor:Color red.
|
|
91 |
|
|
92 |
v addComponent:component.
|
|
93 |
|
|
94 |
e := EllipticalArc boundingBox:(10@10 corner:90@90)
|
|
95 |
startAngle:0 sweepAngle:360.
|
|
96 |
component := StrokingWrapper on:e.
|
|
97 |
component lineWidth:5.
|
|
98 |
|
|
99 |
v addComponent:component.
|
|
100 |
|
|
101 |
v addComponent:(Button label:'hello').
|
|
102 |
|
|
103 |
v open
|
|
104 |
[exEnd]
|
|
105 |
with lineWidth & style:
|
|
106 |
(notice, that the redraw is automatic):
|
|
107 |
[exBegin]
|
|
108 |
|v e|
|
|
109 |
|
|
110 |
v := StandardSystemView extent:250@250.
|
|
111 |
|
|
112 |
e := EllipticalArc boundingBox:(10@10 corner:90@90)
|
|
113 |
startAngle:0
|
|
114 |
sweepAngle:270.
|
|
115 |
v addComponent:((StrokingWrapper on:e)
|
|
116 |
lineWidth:5;
|
|
117 |
lineStyle:#dashed;
|
|
118 |
foregroundColor:(Color red)).
|
|
119 |
|
|
120 |
e := EllipticalArc boundingBox:(30@30 corner:70@70)
|
|
121 |
startAngle:90
|
|
122 |
sweepAngle:270.
|
|
123 |
v addComponent:((StrokingWrapper on:e)
|
|
124 |
lineWidth:5;
|
|
125 |
lineStyle:#doubleDashed;
|
|
126 |
foregroundColor:(Color red);
|
|
127 |
backgroundColor:(Color green)).
|
|
128 |
v open.
|
|
129 |
[exEnd]
|
|
130 |
|
|
131 |
scrolling:
|
273
|
132 |
[exBegin]
|
|
133 |
|t s v e component|
|
|
134 |
|
|
135 |
t := StandardSystemView extent:250@200.
|
|
136 |
s := HVScrollableView for:View miniScroller:true in:t.
|
|
137 |
s origin:0.0@0.0 corner:1.0@1.0.
|
|
138 |
v := s scrolledView.
|
|
139 |
|
|
140 |
e := Rectangle origin:10@10 corner:90@90.
|
|
141 |
component := FillingWrapper on:e.
|
|
142 |
component foregroundColor:Color red.
|
|
143 |
v addComponent:component.
|
|
144 |
|
|
145 |
e := EllipticalArc boundingBox:(10@10 corner:90@90)
|
|
146 |
startAngle:0 sweepAngle:360.
|
|
147 |
component := StrokingWrapper on:e.
|
|
148 |
component lineWidth:5.
|
|
149 |
v addComponent:component.
|
|
150 |
|
|
151 |
e := Arrow from:100@100 to:150@250.
|
|
152 |
component := StrokingWrapper on:e.
|
|
153 |
component lineWidth:2.
|
|
154 |
v addComponent:component.
|
|
155 |
|
280
|
156 |
v addComponent:(Button label:'hello').
|
273
|
157 |
|
|
158 |
t open
|
|
159 |
[exEnd]
|
|
160 |
|
245
|
161 |
"
|
|
162 |
! !
|
|
163 |
|
280
|
164 |
!StrokingWrapper methodsFor:'displaying'!
|
245
|
165 |
|
|
166 |
displayOn:aGC
|
280
|
167 |
"display myself - here, display the geometric object asStroked"
|
|
168 |
|
2634
|
169 |
self displayStrokedOn:aGC
|
245
|
170 |
! !
|
|
171 |
|
280
|
172 |
!StrokingWrapper class methodsFor:'documentation'!
|
245
|
173 |
|
|
174 |
version
|
2634
|
175 |
^ '$Header: /cvs/stx/stx/libview2/StrokingWrapper.st,v 1.16 2009-05-06 07:29:41 cg Exp $'
|
245
|
176 |
! !
|