12 "{ Package: 'stx:libview' }" |
14 "{ Package: 'stx:libview' }" |
13 |
15 |
14 "{ NameSpace: Smalltalk }" |
16 "{ NameSpace: Smalltalk }" |
15 |
17 |
16 AbstractBorder subclass:#Border |
18 AbstractBorder subclass:#Border |
17 instanceVariableNames:'leftColor rightColor topColor bottomColor' |
19 instanceVariableNames:'leftColor leftWidth rightColor rightWidth topColor topWidth |
|
20 bottomColor bottomWidth' |
18 classVariableNames:'' |
21 classVariableNames:'' |
19 poolDictionaries:'' |
22 poolDictionaries:'' |
20 category:'Graphics-Support' |
23 category:'Graphics-Support' |
21 ! |
24 ! |
22 |
25 |
57 |v b| |
60 |v b| |
58 |
61 |
59 v := StandardSystemView extent:100@100. |
62 v := StandardSystemView extent:100@100. |
60 v openAndWait. |
63 v openAndWait. |
61 |
64 |
|
65 b := Border width:1 color:Color red. |
|
66 v border:b |
|
67 [exEnd] |
|
68 |
|
69 [exBegin] |
|
70 |v b| |
|
71 |
|
72 v := StandardSystemView extent:100@100. |
|
73 v openAndWait. |
|
74 |
62 b := Border width:10 color:Color red. |
75 b := Border width:10 color:Color red. |
63 b displayOn:v forDisplayBox:(0@0 corner:90@90). |
76 b displayOn:v forDisplayBox:(0@0 corner:90@90). |
64 |
77 |
65 Delay waitForSeconds:1. |
78 Delay waitForSeconds:1. |
66 b leftColor:Color blue. |
79 b leftColor:Color blue. |
146 leftColor := aColor |
173 leftColor := aColor |
147 |
174 |
148 "Created: 10.2.1997 / 15:38:02 / cg" |
175 "Created: 10.2.1997 / 15:38:02 / cg" |
149 ! |
176 ! |
150 |
177 |
|
178 leftWidth |
|
179 ^ leftWidth |
|
180 ! |
|
181 |
|
182 leftWidth:something |
|
183 leftWidth := something. |
|
184 ! |
|
185 |
|
186 leftWidth:leftWidthArg rightWidth:rightWidthArg topWidth:topWidthArg bottomWidth:bottomWidthArg |
|
187 leftWidth := leftWidthArg. |
|
188 rightWidth := rightWidthArg. |
|
189 topWidth := topWidthArg. |
|
190 bottomWidth := bottomWidthArg. |
|
191 ! |
|
192 |
151 rightColor |
193 rightColor |
152 "return the value of the instance variable 'rightColor' (automatically generated)" |
194 "return the value of the instance variable 'rightColor' (automatically generated)" |
153 |
195 |
154 ^ rightColor |
196 ^ rightColor |
155 |
197 |
199 rH := aRectangle height. |
261 rH := aRectangle height. |
200 rW := aRectangle width. |
262 rW := aRectangle width. |
201 |
263 |
202 leftColor notNil ifTrue:[ |
264 leftColor notNil ifTrue:[ |
203 aGC paint:leftColor. |
265 aGC paint:leftColor. |
204 width == 1 ifTrue:[ |
266 leftWidth == 1 ifTrue:[ |
205 aGC displayLineFromX:rL y:rT toX:rL y:rB-1. |
267 aGC displayLineFromX:rL y:rT toX:rL y:rB-1. |
206 ] ifFalse:[ |
268 ] ifFalse:[ |
207 aGC fillRectangleX:rL y:rT width:width height:rH |
269 aGC fillRectangleX:rL y:rT width:leftWidth height:rH |
208 ]. |
270 ]. |
209 ]. |
271 ]. |
210 |
272 |
211 topColor notNil ifTrue:[ |
273 topColor notNil ifTrue:[ |
212 aGC paint:topColor. |
274 aGC paint:topColor. |
213 width == 1 ifTrue:[ |
275 topWidth == 1 ifTrue:[ |
214 aGC displayLineFromX:rL+1 y:rT toX:rR-1 y:rT. |
276 aGC displayLineFromX:rL+1 y:rT toX:rR-1 y:rT. |
215 ] ifFalse:[ |
277 ] ifFalse:[ |
216 aGC fillRectangleX:(rL + width) y:rT width:rW - width height:width |
278 aGC fillRectangleX:(rL + leftWidth) y:rT width:rW - leftWidth - rightWidth height:topWidth |
217 ]. |
279 ]. |
218 ]. |
280 ]. |
219 |
281 |
220 rightColor notNil ifTrue:[ |
282 rightColor notNil ifTrue:[ |
221 aGC paint:rightColor. |
283 aGC paint:rightColor. |
222 width == 1 ifTrue:[ |
284 rightWidth == 1 ifTrue:[ |
223 aGC displayLineFromX:rR-1 y:rT toX:rR-1 y:rB-1. |
285 aGC displayLineFromX:rR-1 y:rT toX:rR-1 y:rB-1. |
224 ] ifFalse:[ |
286 ] ifFalse:[ |
225 aGC fillRectangleX:(rR - width) y:(rT + width) width:width height:rH-width |
287 aGC fillRectangleX:(rR - rightWidth) y:rT width:rightWidth height:rH |
226 ]. |
288 ]. |
227 ]. |
289 ]. |
228 |
290 |
229 bottomColor notNil ifTrue:[ |
291 bottomColor notNil ifTrue:[ |
230 aGC paint:bottomColor. |
292 aGC paint:bottomColor. |
231 width == 1 ifTrue:[ |
293 bottomWidth == 1 ifTrue:[ |
232 aGC displayLineFromX:rL y:rB-1 toX:rR-1 y:rB-1. |
294 aGC displayLineFromX:rL+1 y:rB-1 toX:rR-2 y:rB-1. |
233 ] ifFalse:[ |
295 ] ifFalse:[ |
234 aGC fillRectangleX:rL y:(rB-width) width:rW - width height:width |
296 aGC fillRectangleX:rL+leftWidth y:(rB-bottomWidth) width:rW - leftWidth - rightWidth height:bottomWidth |
235 ]. |
297 ]. |
236 ]. |
298 ]. |
237 |
299 |
238 aGC paint: oldPaint |
300 aGC paint: oldPaint |
239 |
301 |
240 "Modified: 10.2.1997 / 15:55:04 / cg" |
302 "Modified: 10.2.1997 / 15:55:04 / cg" |
241 ! ! |
303 ! ! |
242 |
304 |
|
305 !Border methodsFor:'initialization'! |
|
306 |
|
307 initialize |
|
308 width := 1. |
|
309 leftWidth := rightWidth := topWidth := bottomWidth := 1. |
|
310 ! ! |
|
311 |
|
312 !Border methodsFor:'queries'! |
|
313 |
|
314 bottomMargin |
|
315 ^ bottomWidth |
|
316 ! |
|
317 |
|
318 leftMargin |
|
319 ^ leftWidth |
|
320 ! |
|
321 |
|
322 rightMargin |
|
323 ^ rightWidth |
|
324 ! |
|
325 |
|
326 topMargin |
|
327 ^ topWidth |
|
328 ! ! |
|
329 |
243 !Border class methodsFor:'documentation'! |
330 !Border class methodsFor:'documentation'! |
244 |
331 |
245 version |
332 version |
246 ^ '$Header: /cvs/stx/stx/libview/Border.st,v 1.10 2015-01-05 20:34:51 cg Exp $' |
333 ^ '$Header$' |
247 ! |
334 ! |
248 |
335 |
249 version_CVS |
336 version_CVS |
250 ^ '$Header: /cvs/stx/stx/libview/Border.st,v 1.10 2015-01-05 20:34:51 cg Exp $' |
337 ^ '$Header$' |
251 ! ! |
338 ! ! |
252 |
339 |