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