author | Claus Gittinger <cg@exept.de> |
Mon, 13 May 1996 11:34:25 +0200 | |
changeset 266 | e9d35cd74f64 |
parent 265 | 45c83acd7562 |
child 282 | d534be80527f |
permissions | -rw-r--r-- |
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 |
" |
|
12 |
||
13 |
||
14 |
||
252 | 15 |
GeometricWrapper subclass:#FillingWrapper |
245 | 16 |
instanceVariableNames:'' |
17 |
classVariableNames:'' |
|
18 |
poolDictionaries:'' |
|
19 |
category:'Graphics-Display Objects' |
|
20 |
! |
|
21 |
||
22 |
!FillingWrapper class methodsFor:'documentation'! |
|
23 |
||
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1996 by Claus Gittinger |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
||
37 |
||
38 |
! |
|
39 |
||
40 |
documentation |
|
41 |
" |
|
42 |
a wrapper for a geometric object, which is to be drawn filled. |
|
43 |
This allows any geometric thingy to be used as a filled component in a view. |
|
44 |
||
254 | 45 |
(background info: geometrics are mathematical objects - they do not |
46 |
keep any color or lineStyle attributes. Wrappers add this information |
|
47 |
and can also be used as components of a view) |
|
48 |
||
265 | 49 |
Notice: |
50 |
this class was implemented using protocol information |
|
51 |
from alpha testers and from the Hopkins/Horan book. |
|
52 |
- it may not be complete or compatible to the corresponding ST-80 class. |
|
53 |
If you encounter any incompatibilities, please forward a note |
|
54 |
describing the incompatibility verbal (i.e. no code) to the ST/X team. |
|
55 |
||
248 | 56 |
[see also:] |
57 |
StrokingWrapper Geometric GraphicsContext |
|
58 |
||
245 | 59 |
[author:] |
60 |
Claus Gittinger |
|
61 |
" |
|
62 |
||
63 |
||
64 |
! |
|
65 |
||
66 |
examples |
|
67 |
" |
|
254 | 68 |
wrap an ellipticArc and display it |
69 |
(notice, that no automatic redraw is performed): |
|
245 | 70 |
[exBegin] |
254 | 71 |
|v e component| |
72 |
||
73 |
v := (View extent:250@250) openAndWait. |
|
74 |
||
75 |
e := EllipticalArc boundingBox:(10@10 corner:90@90) |
|
76 |
startAngle:0 |
|
77 |
sweepAngle:270. |
|
78 |
component := FillingWrapper on:e. |
|
245 | 79 |
|
254 | 80 |
component displayOn:v. |
81 |
[exEnd] |
|
82 |
wrap an spline and display it |
|
83 |
(notice, that no automatic redraw is performed): |
|
84 |
[exBegin] |
|
85 |
|v s component| |
|
86 |
||
87 |
v := (View extent:250@250) openAndWait. |
|
245 | 88 |
|
254 | 89 |
s := Spline controlPoints: |
90 |
(Array with:(20@20) |
|
91 |
with:(80@80) |
|
92 |
with:(20@80) |
|
93 |
with:(20@20)). |
|
94 |
component := FillingWrapper on:s. |
|
95 |
component foregroundColor:(Color green darkened). |
|
96 |
component displayOn:v. |
|
97 |
[exEnd] |
|
98 |
wrap ellipticArcs |
|
99 |
and add them as components to a View |
|
100 |
(notice, that doing so makes the redraw automatic): |
|
101 |
[exBegin] |
|
102 |
|v e component| |
|
245 | 103 |
|
254 | 104 |
v := View extent:250@250. |
105 |
||
106 |
e := EllipticalArc boundingBox:(10@10 corner:90@90) |
|
107 |
startAngle:0 |
|
108 |
sweepAngle:270. |
|
109 |
v addComponent:(StrokingWrapper on:e). |
|
110 |
||
111 |
e := EllipticalArc boundingBox:(110@110 corner:190@190) |
|
112 |
startAngle:0 |
|
113 |
sweepAngle:270. |
|
114 |
v addComponent:(FillingWrapper on:e). |
|
115 |
v open |
|
245 | 116 |
[exEnd] |
117 |
||
118 |
||
254 | 119 |
wrap a rectangle and an ellipticArc, |
120 |
and add them as components to a View |
|
121 |
(notice, that doing so makes the redraw automatic): |
|
245 | 122 |
[exBegin] |
254 | 123 |
|v e component| |
245 | 124 |
|
254 | 125 |
v := View new. |
126 |
v extent:250@250. |
|
245 | 127 |
|
254 | 128 |
e := Rectangle origin:10@10 corner:90@90. |
129 |
component := FillingWrapper on:e. |
|
130 |
component foregroundColor:Color red. |
|
245 | 131 |
|
254 | 132 |
v addComponent:component. |
245 | 133 |
|
254 | 134 |
e := EllipticalArc boundingBox:(10@10 corner:90@90) |
135 |
startAngle:0 sweepAngle:270. |
|
136 |
component := StrokingWrapper on:e. |
|
137 |
component lineWidth:5. |
|
245 | 138 |
|
254 | 139 |
v addComponent:component. |
245 | 140 |
|
254 | 141 |
v addComponent:(Button label:'hello'). |
245 | 142 |
|
254 | 143 |
v open |
245 | 144 |
[exEnd] |
266
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
145 |
|
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
146 |
spline as a Buttons-label (hugh ?): |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
147 |
[exBegin] |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
148 |
|a b| |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
149 |
|
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
150 |
a := ArrowedSpline controlPoints: |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
151 |
(Array with:(00@00) |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
152 |
with:(60@60) |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
153 |
with:(00@60)). |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
154 |
|
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
155 |
b := Button label:(((StrokingWrapper on:a) |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
156 |
foregroundColor:Color red; |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
157 |
lineWidth:3; |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
158 |
lineStyle:#dashed)). |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
159 |
b open. |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
160 |
[exEnd] |
245 | 161 |
" |
162 |
! ! |
|
163 |
||
164 |
!FillingWrapper methodsFor:'displaying'! |
|
165 |
||
166 |
displayOn:aGC |
|
246 | 167 |
"display myself - here, display the geometric object asFilled" |
168 |
||
245 | 169 |
|prevFg| |
170 |
||
171 |
prevFg := aGC paint. |
|
172 |
||
173 |
aGC paint:fgColor. |
|
174 |
||
175 |
component displayFilledOn:aGC. |
|
176 |
||
177 |
aGC paint:prevFg. |
|
178 |
||
179 |
"Created: 8.5.1996 / 23:54:06 / cg" |
|
246 | 180 |
"Modified: 9.5.1996 / 00:11:27 / cg" |
245 | 181 |
! ! |
182 |
||
183 |
!FillingWrapper class methodsFor:'documentation'! |
|
184 |
||
185 |
version |
|
266
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
186 |
^ '$Header: /cvs/stx/stx/libview2/FillingWrapper.st,v 1.7 1996-05-13 09:34:19 cg Exp $' |
245 | 187 |
! ! |