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