author | Claus Gittinger <cg@exept.de> |
Tue, 05 Sep 2000 14:44:17 +0200 | |
changeset 1403 | 94f9ec117aa5 |
parent 1220 | 39e5e28042da |
child 1789 | f52f0a0d8448 |
permissions | -rw-r--r-- |
278 | 1 |
BoundedWrapper subclass:#BorderedWrapper |
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
2 |
instanceVariableNames:'border inset insideColor borderWidth borderColor level' |
278 | 3 |
classVariableNames:'' |
4 |
poolDictionaries:'' |
|
5 |
category:'Graphics-Display Objects' |
|
6 |
! |
|
7 |
||
365 | 8 |
!BorderedWrapper class methodsFor:'documentation'! |
278 | 9 |
|
283 | 10 |
documentation |
11 |
" |
|
12 |
a wrapper which controls the layout (origin & extent) |
|
13 |
of its wrapped component and also draws a border around. |
|
14 |
||
15 |
If insideColor is nonNil, the area is cleared to that color, |
|
16 |
making the overall look be opaque. |
|
17 |
||
18 |
Notice: |
|
19 |
this class was implemented using protocol information |
|
365 | 20 |
from alpha testers, from reading PD programs and |
21 |
from the Hopkins/Horan book. |
|
283 | 22 |
- it may not be complete or compatible to the corresponding ST-80 class. |
23 |
If you encounter any incompatibilities, please forward a note |
|
24 |
describing the incompatibility verbal (i.e. no code) to the ST/X team. |
|
25 |
||
26 |
[see also:] |
|
27 |
Wrapper TranslatingWrapper GeometricWrapper |
|
28 |
||
29 |
[author:] |
|
30 |
Claus Gittinger |
|
31 |
" |
|
32 |
||
33 |
! |
|
34 |
||
278 | 35 |
examples |
36 |
" |
|
319 | 37 |
a 'no-border' border |
278 | 38 |
[exBegin] |
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
39 |
|t component| |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
40 |
|
319 | 41 |
t := StandardSystemView extent:250@250. |
42 |
||
43 |
component := ClockView new. |
|
44 |
||
45 |
t addComponent:((BorderedWrapper |
|
46 |
on:component in:(0.1@0.1 corner:0.9@0.9) |
|
47 |
) |
|
48 |
). |
|
49 |
||
50 |
t open |
|
51 |
[exEnd] |
|
52 |
||
53 |
a '2D' border |
|
54 |
[exBegin] |
|
55 |
|t component| |
|
56 |
||
57 |
t := StandardSystemView extent:250@250. |
|
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
58 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
59 |
component := ClockView new. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
60 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
61 |
t addComponent:((BorderedWrapper |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
62 |
on:component in:(0.1@0.1 corner:0.9@0.9)) |
319 | 63 |
borderColor:Color red; |
64 |
borderWidth:2). |
|
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
65 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
66 |
t open |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
67 |
[exEnd] |
319 | 68 |
|
69 |
a '3D' border |
|
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
70 |
[exBegin] |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
71 |
|t component| |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
72 |
|
319 | 73 |
t := StandardSystemView extent:250@250. |
74 |
||
75 |
component := ClockView new. |
|
76 |
||
77 |
t addComponent:((BorderedWrapper |
|
78 |
on:component in:(0.1@0.1 corner:0.9@0.9)) |
|
79 |
level:2). |
|
80 |
||
81 |
t open |
|
82 |
[exEnd] |
|
83 |
||
84 |
multiple components (absolute & relative sizes): |
|
85 |
[exBegin] |
|
86 |
|t component| |
|
87 |
||
88 |
t := StandardSystemView extent:250@250. |
|
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
89 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
90 |
component := ClockView new. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
91 |
t addComponent:((BorderedWrapper |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
92 |
on:component in:(10@10 corner:100@100)) |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
93 |
borderWidth:1; borderColor:Color blue). |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
94 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
95 |
component := ClockView new. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
96 |
t addComponent:((BorderedWrapper |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
97 |
on:component in:(0.5@0.5 corner:1.0@1.0)) |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
98 |
borderWidth:1; borderColor:Color red). |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
99 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
100 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
101 |
t openAndWait. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
102 |
[exEnd] |
319 | 103 |
|
104 |
multiple components (absolute & relative layouts): |
|
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
105 |
[exBegin] |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
106 |
|t component| |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
107 |
|
319 | 108 |
t := StandardSystemView extent:250@250. |
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
109 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
110 |
component := ClockView new. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
111 |
component borderWidth:1; borderColor:Color blue. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
112 |
component layout:((10@10 corner:100@100) asLayout). |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
113 |
t addComponent:component. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
114 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
115 |
component := ClockView new. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
116 |
component borderWidth:1; borderColor:Color red. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
117 |
component layout:((0.5@0.5 corner:1.0@1.0) asLayout). |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
118 |
t addComponent:component. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
119 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
120 |
t openAndWait. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
121 |
[exEnd] |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
122 |
|
1220
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
123 |
non-view components (scrollable, both with & without insideColor): |
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
124 |
[exBegin] |
278 | 125 |
|t s v e component| |
126 |
||
127 |
t := StandardSystemView extent:250@200. |
|
128 |
s := HVScrollableView for:View miniScroller:true in:t. |
|
129 |
s origin:0.0@0.0 corner:1.0@1.0. |
|
130 |
v := s scrolledView. |
|
131 |
||
132 |
e := Rectangle origin:0@0 corner:80@80. |
|
133 |
component := FillingWrapper on:e. |
|
134 |
component foregroundColor:Color red. |
|
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
135 |
v addComponent:((BorderedWrapper on:component at:10@10) |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
136 |
borderWidth:3; borderColor:Color green darkened). |
278 | 137 |
|
138 |
e := EllipticalArc boundingBox:(0@0 corner:80@80) |
|
139 |
startAngle:0 sweepAngle:360. |
|
140 |
component := StrokingWrapper on:e. |
|
283 | 141 |
component lineWidth:5; foregroundColor:Color yellow. |
142 |
v addComponent:((BorderedWrapper on:component at:50@50) |
|
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
143 |
insideColor:Color blue; |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
144 |
level:1). |
278 | 145 |
|
146 |
e := Arrow from:0@0 to:50@150. |
|
147 |
component := StrokingWrapper on:e. |
|
148 |
component lineWidth:2. |
|
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
149 |
v addComponent:((BorderedWrapper on:component at:100@100) level:2). |
278 | 150 |
|
151 |
t open |
|
152 |
[exEnd] |
|
153 |
" |
|
154 |
! ! |
|
155 |
||
365 | 156 |
!BorderedWrapper class methodsFor:'instance creation'! |
278 | 157 |
|
158 |
on:aComponent in:aLayout border:aBorder |
|
159 |
^ (super on:aComponent in:aLayout) border:aBorder |
|
160 |
||
161 |
"Created: 28.5.1996 / 23:15:00 / cg" |
|
386 | 162 |
! |
163 |
||
164 |
on:aComponent in:aLayout level:threeDLevel |
|
165 |
^ (super on:aComponent in:aLayout) level:threeDLevel |
|
166 |
||
167 |
"Created: 25.1.1997 / 16:56:51 / cg" |
|
278 | 168 |
! ! |
169 |
||
170 |
!BorderedWrapper methodsFor:'accessing'! |
|
171 |
||
172 |
border |
|
173 |
"return border" |
|
174 |
||
175 |
^ border |
|
176 |
||
177 |
"Created: 28.5.1996 / 23:15:15 / cg" |
|
178 |
! |
|
179 |
||
180 |
border:something |
|
181 |
"set border" |
|
182 |
||
183 |
border := something. |
|
184 |
||
185 |
"Created: 28.5.1996 / 23:15:15 / cg" |
|
283 | 186 |
! |
187 |
||
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
188 |
borderColor:aColor |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
189 |
"set the 2D borderColor" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
190 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
191 |
|v| |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
192 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
193 |
borderColor := aColor. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
194 |
(v := self view) notNil ifTrue:[v invalidate] |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
195 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
196 |
"Modified: 5.6.1996 / 01:20:37 / cg" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
197 |
"Created: 5.6.1996 / 01:34:17 / cg" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
198 |
! |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
199 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
200 |
borderWidth |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
201 |
"return the 2D borderWidth" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
202 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
203 |
^ borderWidth |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
204 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
205 |
"Modified: 5.6.1996 / 01:52:41 / cg" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
206 |
"Created: 5.6.1996 / 14:27:28 / cg" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
207 |
! |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
208 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
209 |
borderWidth:aNumber |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
210 |
"set the 2D borderWidth" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
211 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
212 |
|v| |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
213 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
214 |
borderWidth ~~ aNumber ifTrue:[ |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
215 |
borderWidth := aNumber. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
216 |
bounds notNil ifTrue:[self bounds:bounds]. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
217 |
(v := self view) notNil ifTrue:[v invalidate] |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
218 |
] |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
219 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
220 |
"Created: 5.6.1996 / 01:33:56 / cg" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
221 |
"Modified: 5.6.1996 / 01:52:41 / cg" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
222 |
! |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
223 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
224 |
inset |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
225 |
|i| |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
226 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
227 |
borderWidth notNil ifTrue:[ |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
228 |
i := borderWidth |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
229 |
] ifFalse:[ |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
230 |
i := 0 |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
231 |
]. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
232 |
level notNil ifTrue:[ |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
233 |
i := i + level abs. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
234 |
]. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
235 |
^ i |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
236 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
237 |
"Created: 5.6.1996 / 01:03:25 / cg" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
238 |
"Modified: 5.6.1996 / 01:03:47 / cg" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
239 |
! |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
240 |
|
283 | 241 |
insideColor |
242 |
"return the insideColor" |
|
243 |
||
244 |
^ insideColor |
|
245 |
||
246 |
"Created: 29.5.1996 / 11:09:58 / cg" |
|
247 |
! |
|
248 |
||
249 |
insideColor:aColorOrPixmap |
|
250 |
"set the insideColor" |
|
251 |
||
252 |
insideColor := aColorOrPixmap |
|
253 |
||
254 |
"Created: 29.5.1996 / 11:10:16 / cg" |
|
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
255 |
! |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
256 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
257 |
level |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
258 |
"return the 3D level" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
259 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
260 |
^ level |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
261 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
262 |
"Created: 5.6.1996 / 14:27:47 / cg" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
263 |
! |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
264 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
265 |
level:aNumber |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
266 |
"set the 3D level" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
267 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
268 |
|v| |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
269 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
270 |
level ~~ aNumber ifTrue:[ |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
271 |
level := aNumber. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
272 |
bounds notNil ifTrue:[self bounds:bounds]. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
273 |
(v := self view) notNil ifTrue:[v invalidate] |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
274 |
] |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
275 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
276 |
"Created: 5.6.1996 / 01:19:41 / cg" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
277 |
"Modified: 5.6.1996 / 01:53:00 / cg" |
283 | 278 |
! ! |
279 |
||
278 | 280 |
!BorderedWrapper methodsFor:'displaying'! |
281 |
||
282 |
displayOn:aGC |
|
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
283 |
|bounds x y w h r b tX tY bw| |
278 | 284 |
|
285 |
bounds := self bounds. |
|
386 | 286 |
|
278 | 287 |
x := bounds left rounded. |
288 |
y := bounds top rounded. |
|
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
289 |
r := bounds right rounded. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
290 |
b := bounds bottom rounded. |
278 | 291 |
|
283 | 292 |
insideColor notNil ifTrue:[ |
293 |
aGC paint:insideColor. |
|
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
294 |
aGC fillRectangleX:x y:y width:(r-x) height:(b-y) |
283 | 295 |
]. |
296 |
||
297 |
super displayOn:aGC. |
|
298 |
||
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
299 |
bw := 0. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
300 |
borderColor notNil ifTrue:[ |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
301 |
(borderWidth notNil |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
302 |
and:[borderWidth ~~ 0]) ifTrue:[ |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
303 |
bw := borderWidth. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
304 |
aGC paint:borderColor. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
305 |
0 to:(borderWidth-1) do:[:i | |
386 | 306 |
aGC displayRectangleX:x+i y:y+i width:(r-x-i-i) height:(b-y-i-i). |
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
307 |
]. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
308 |
] |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
309 |
]. |
283 | 310 |
|
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
311 |
level notNil ifTrue:[ |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
312 |
"/ drawEdgesForX: draws in deviceCoordinates - have to translate here. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
313 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
314 |
tX := aGC translation x. |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
315 |
tY := aGC translation y. |
278 | 316 |
|
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
317 |
aGC drawEdgesForX:x+tX+bw |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
318 |
y:y+tY+bw |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
319 |
width:(r-x+1-bw-bw) |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
320 |
height:(b-y+1-bw-bw) |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
321 |
level:level |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
322 |
shadow:Color black |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
323 |
light:Color white |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
324 |
halfShadow:Color grey |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
325 |
halfLight:Color grey |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
326 |
style:#iris |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
327 |
]. |
278 | 328 |
|
386 | 329 |
"Modified: 27.1.1997 / 11:45:28 / cg" |
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
330 |
! ! |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
331 |
|
320 | 332 |
!BorderedWrapper methodsFor:'initialization'! |
333 |
||
334 |
initialize |
|
335 |
super initialize. |
|
336 |
||
337 |
inset := 0. |
|
338 |
insideColor := Color white. |
|
339 |
borderWidth := 0. |
|
340 |
insideColor := Color black. |
|
341 |
level := 0. |
|
342 |
||
343 |
"Created: 19.7.1996 / 17:22:33 / cg" |
|
344 |
! ! |
|
345 |
||
323 | 346 |
!BorderedWrapper methodsFor:'private'! |
347 |
||
348 |
layoutChanged |
|
349 |
|subBounds b| |
|
350 |
||
351 |
component notNil ifTrue:[ |
|
352 |
b := bounds insetBy:self inset. |
|
353 |
||
354 |
layout notNil ifTrue:[ |
|
355 |
subBounds := (layout |
|
356 |
rectangleRelativeTo:b |
|
357 |
preferred:b) rounded. |
|
358 |
] ifFalse:[ |
|
359 |
subBounds := b |
|
360 |
]. |
|
361 |
||
362 |
origin := b origin. |
|
363 |
"/ Transcript show:layout displayString; show:'subbounds: '; showCR:subBounds. |
|
364 |
component bounds:subBounds. |
|
365 |
] |
|
366 |
||
367 |
"Created: 19.7.1996 / 21:25:02 / cg" |
|
368 |
! ! |
|
369 |
||
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
370 |
!BorderedWrapper methodsFor:'queries'! |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
371 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
372 |
hasBorder |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
373 |
^ true |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
374 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
375 |
"Created: 5.6.1996 / 14:28:38 / cg" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
376 |
! |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
377 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
378 |
isBorderedWrapper |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
379 |
^ true |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
380 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
381 |
"Created: 5.6.1996 / 14:11:03 / cg" |
278 | 382 |
! ! |
383 |
||
365 | 384 |
!BorderedWrapper class methodsFor:'documentation'! |
278 | 385 |
|
386 |
version |
|
1220
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
387 |
^ '$Header: /cvs/stx/stx/libview2/BorderedWrapper.st,v 1.9 1999-08-18 19:50:05 cg Exp $' |
278 | 388 |
! ! |