5353
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1997 by eXept Software AG
|
5408
|
3 |
All Rights Reserved
|
5353
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
"{ Package: 'stx:libview' }"
|
|
13 |
|
5373
|
14 |
AbstractBorder subclass:#Border
|
5408
|
15 |
instanceVariableNames:'leftColor rightColor topColor bottomColor'
|
1321
|
16 |
classVariableNames:''
|
|
17 |
poolDictionaries:''
|
5391
|
18 |
category:'Graphics-Support'
|
1321
|
19 |
!
|
|
20 |
|
|
21 |
!Border class methodsFor:'documentation'!
|
|
22 |
|
5353
|
23 |
copyright
|
|
24 |
"
|
|
25 |
COPYRIGHT (c) 1997 by eXept Software AG
|
5408
|
26 |
All Rights Reserved
|
5353
|
27 |
|
|
28 |
This software is furnished under a license and may be used
|
|
29 |
only in accordance with the terms of that license and with the
|
|
30 |
inclusion of the above copyright notice. This software may not
|
|
31 |
be provided or otherwise made available to, or used by, any
|
|
32 |
other person. No title to or ownership of the software is
|
|
33 |
hereby transferred.
|
|
34 |
"
|
|
35 |
!
|
|
36 |
|
1321
|
37 |
documentation
|
|
38 |
"
|
5373
|
39 |
a border holds the values of a view's (or component's) border.
|
5457
|
40 |
We have only recently started to change the system to use borders instead of separate
|
|
41 |
borderWidth, borderColor, level, shadow- and lightColors.
|
|
42 |
Expect more changes here in the near future..
|
1321
|
43 |
|
|
44 |
[see also:]
|
5457
|
45 |
SimpleView
|
1321
|
46 |
|
|
47 |
[author:]
|
5457
|
48 |
Claus Gittinger
|
1321
|
49 |
"
|
1324
|
50 |
!
|
|
51 |
|
|
52 |
examples
|
|
53 |
"
|
5408
|
54 |
[exBegin]
|
1324
|
55 |
|v b|
|
|
56 |
|
|
57 |
v := StandardSystemView extent:10@10.
|
|
58 |
v openAndWait.
|
|
59 |
|
|
60 |
b := Border width:2 color:Color red.
|
|
61 |
b displayOn:v forDisplayBox:(0@0 corner:9@9).
|
|
62 |
|
|
63 |
Delay waitForSeconds:1.
|
|
64 |
b setLeftColor:Color blue.
|
|
65 |
b displayOn:v forDisplayBox:(0@0 corner:9@9).
|
|
66 |
Delay waitForSeconds:1.
|
|
67 |
b setTopColor:Color green.
|
|
68 |
b displayOn:v forDisplayBox:(0@0 corner:9@9).
|
|
69 |
Delay waitForSeconds:1.
|
|
70 |
b setRightColor:Color magenta.
|
|
71 |
b displayOn:v forDisplayBox:(0@0 corner:9@9).
|
5408
|
72 |
[exEnd]
|
1324
|
73 |
|
5408
|
74 |
[exBegin]
|
1324
|
75 |
|v b|
|
|
76 |
|
|
77 |
v := StandardSystemView extent:100@100.
|
|
78 |
v openAndWait.
|
|
79 |
|
|
80 |
b := Border width:2 color:Color red.
|
|
81 |
b displayOn:v forDisplayBox:(0@0 corner:99@99).
|
|
82 |
|
|
83 |
Delay waitForSeconds:1.
|
|
84 |
b setLeft:5.
|
5408
|
85 |
v clear.
|
1324
|
86 |
b displayOn:v forDisplayBox:(0@0 corner:99@99).
|
|
87 |
Delay waitForSeconds:1.
|
|
88 |
b setTop:3.
|
5408
|
89 |
v clear.
|
1324
|
90 |
b displayOn:v forDisplayBox:(0@0 corner:99@99).
|
|
91 |
Delay waitForSeconds:1.
|
|
92 |
b setRight:1.
|
5408
|
93 |
v clear.
|
1324
|
94 |
b displayOn:v forDisplayBox:(0@0 corner:99@99).
|
5408
|
95 |
[exEnd]
|
1321
|
96 |
|
5408
|
97 |
[exBegin]
|
5373
|
98 |
|v sub1 sub2 sub3|
|
1321
|
99 |
|
5373
|
100 |
v := StandardSystemView extent:200@200.
|
|
101 |
v openAndWait.
|
1321
|
102 |
|
5373
|
103 |
sub1 := (View in:v) origin:10@10; corner:90@90.
|
|
104 |
sub1 border:(SimpleBorder width:1 color:Color red ).
|
|
105 |
sub2 := (View in:v) origin:110@10; corner:190@90.
|
|
106 |
sub2 border:(Border new width:1; color:Color blue; leftColor:Color red rightColor:Color red ).
|
|
107 |
sub3 := (View in:v) origin:110@110; corner:190@190.
|
|
108 |
sub3 border:(SimpleBorder width:1 color:Color green ).
|
1321
|
109 |
|
5373
|
110 |
v open.
|
5408
|
111 |
[exEnd]
|
5373
|
112 |
"
|
1321
|
113 |
! !
|
|
114 |
|
|
115 |
!Border methodsFor:'accessing'!
|
|
116 |
|
|
117 |
bottomColor
|
|
118 |
"return the value of the instance variable 'bottomColor' (automatically generated)"
|
|
119 |
|
|
120 |
^ bottomColor
|
|
121 |
|
|
122 |
"Created: 10.2.1997 / 14:51:34 / cg"
|
|
123 |
!
|
|
124 |
|
5408
|
125 |
bottomColor:aColor
|
|
126 |
"set the bottomColor"
|
|
127 |
|
|
128 |
bottomColor := aColor
|
|
129 |
|
|
130 |
"Created: 10.2.1997 / 15:37:51 / cg"
|
|
131 |
!
|
|
132 |
|
1321
|
133 |
color:newColor
|
|
134 |
"set all four colors"
|
|
135 |
|
5408
|
136 |
leftColor := rightColor := topColor := bottomColor := newColor
|
1321
|
137 |
|
|
138 |
"Created: 10.2.1997 / 15:27:01 / cg"
|
|
139 |
!
|
|
140 |
|
|
141 |
leftColor
|
|
142 |
"return the value of the instance variable 'leftColor' (automatically generated)"
|
|
143 |
|
|
144 |
^ leftColor
|
|
145 |
|
|
146 |
"Created: 10.2.1997 / 14:51:34 / cg"
|
|
147 |
!
|
|
148 |
|
5408
|
149 |
leftColor:aColor
|
|
150 |
"set the leftColor"
|
1321
|
151 |
|
5408
|
152 |
leftColor := aColor
|
1321
|
153 |
|
5408
|
154 |
"Created: 10.2.1997 / 15:38:02 / cg"
|
1321
|
155 |
!
|
|
156 |
|
|
157 |
rightColor
|
|
158 |
"return the value of the instance variable 'rightColor' (automatically generated)"
|
|
159 |
|
|
160 |
^ rightColor
|
|
161 |
|
|
162 |
"Created: 10.2.1997 / 14:51:34 / cg"
|
|
163 |
!
|
|
164 |
|
5408
|
165 |
rightColor:aColor
|
1321
|
166 |
"set the rightColor"
|
|
167 |
|
|
168 |
rightColor := aColor
|
|
169 |
|
|
170 |
"Created: 10.2.1997 / 15:38:08 / cg"
|
|
171 |
!
|
|
172 |
|
|
173 |
topColor
|
|
174 |
"return the value of the instance variable 'topColor' (automatically generated)"
|
|
175 |
|
|
176 |
^ topColor
|
|
177 |
|
|
178 |
"Created: 10.2.1997 / 14:51:34 / cg"
|
5373
|
179 |
!
|
|
180 |
|
5408
|
181 |
topColor:aColor
|
|
182 |
"set the topColor"
|
5373
|
183 |
|
5408
|
184 |
topColor := aColor
|
|
185 |
|
|
186 |
"Created: 10.2.1997 / 15:38:17 / cg"
|
1321
|
187 |
! !
|
|
188 |
|
|
189 |
!Border methodsFor:'displaying'!
|
|
190 |
|
5408
|
191 |
displayOn:aGC forDisplayBox:aRectangle
|
5373
|
192 |
"display the border represented by the receiver in the given rectangle.
|
1321
|
193 |
colorSource is ignored here, but subclasses (i.e. 3D-borders) may use
|
|
194 |
it to ask for shadow/lightColors.
|
|
195 |
The gc's state is restored after the drawing."
|
|
196 |
|
5408
|
197 |
|paint oldPaint
|
1321
|
198 |
t r l b rL rR rT rB rW rH|
|
|
199 |
|
5408
|
200 |
width == 0 ifTrue:[ ^ self ].
|
1321
|
201 |
|
|
202 |
oldPaint := aGC paint.
|
|
203 |
r := aRectangle copy.
|
|
204 |
|
|
205 |
rL := aRectangle left.
|
|
206 |
rT := aRectangle top.
|
|
207 |
rR := aRectangle right.
|
|
208 |
rB := aRectangle bottom.
|
|
209 |
rH := aRectangle height.
|
|
210 |
rW := aRectangle width.
|
|
211 |
|
5408
|
212 |
leftColor notNil ifTrue:[
|
|
213 |
aGC paint:leftColor.
|
|
214 |
aGC fillRectangleX:rL y:rT width:width height:rH + 1 - b
|
1321
|
215 |
].
|
|
216 |
|
5408
|
217 |
topColor notNil ifTrue:[
|
|
218 |
aGC paint:topColor.
|
|
219 |
aGC fillRectangleX:(rL + l) y:rT width:rW - l height:width
|
1321
|
220 |
].
|
|
221 |
|
5408
|
222 |
rightColor notNil ifTrue:[
|
|
223 |
aGC paint:rightColor.
|
|
224 |
aGC fillRectangleX:(rR - r) y:(rT + t) width:width height:rH + 1 - t
|
1321
|
225 |
].
|
|
226 |
|
5408
|
227 |
bottomColor notNil ifTrue:[
|
1321
|
228 |
aGC paint:paint.
|
5408
|
229 |
aGC fillRectangleX:(rL) y:(rB + 1 - b) width:rW - r height:width
|
1321
|
230 |
].
|
|
231 |
|
|
232 |
aGC paint: oldPaint
|
|
233 |
|
1324
|
234 |
"Modified: 10.2.1997 / 15:55:04 / cg"
|
1321
|
235 |
! !
|
|
236 |
|
|
237 |
!Border class methodsFor:'documentation'!
|
|
238 |
|
|
239 |
version
|
5457
|
240 |
^ '$Header: /cvs/stx/stx/libview/Border.st,v 1.9 2009-11-04 11:23:14 cg Exp $'
|
5353
|
241 |
!
|
|
242 |
|
|
243 |
version_CVS
|
5457
|
244 |
^ '$Header: /cvs/stx/stx/libview/Border.st,v 1.9 2009-11-04 11:23:14 cg Exp $'
|
1321
|
245 |
! !
|