author | Claus Gittinger <cg@exept.de> |
Wed, 29 May 1996 00:43:39 +0200 | |
changeset 278 | f2382bb48850 |
parent 274 | 434f1bc78362 |
child 290 | d26dc55ac7e4 |
permissions | -rw-r--r-- |
245 | 1 |
" |
2 |
COPYRIGHT (c) 1996 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
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 |
||
13 |
||
14 |
||
15 |
Object subclass:#VisualComponent |
|
16 |
instanceVariableNames:'bounds fgColor bgColor' |
|
17 |
classVariableNames:'' |
|
18 |
poolDictionaries:'' |
|
19 |
category:'Graphics-Display Objects' |
|
20 |
! |
|
21 |
||
22 |
!VisualComponent class methodsFor:'documentation'! |
|
23 |
||
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1996 by Claus Gittinger |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
||
37 |
||
38 |
! |
|
39 |
||
40 |
documentation |
|
41 |
" |
|
246 | 42 |
abstract superclass for all kinds of visual components. |
265 | 43 |
This class and its subclasses (currently) exist mostly for |
44 |
ST-80 compatibility - to provide a home for ported PD classes, |
|
45 |
which depend on the VisualComponent hierarchy. |
|
46 |
||
47 |
Notice: |
|
48 |
this class was implemented using protocol information |
|
49 |
from alpha testers and from the Hopkins/Horan book. |
|
50 |
- it may not be complete or compatible to the corresponding ST-80 class. |
|
51 |
If you encounter any incompatibilities, please forward a note |
|
52 |
describing the incompatibility verbal (i.e. no code) to the ST/X team. |
|
53 |
This is still being constructed - not yet finished. |
|
245 | 54 |
|
55 |
[author:] |
|
56 |
Claus Gittinger |
|
265 | 57 |
|
58 |
[see also:] |
|
59 |
GeometricWrapper |
|
245 | 60 |
" |
61 |
||
62 |
! ! |
|
63 |
||
64 |
!VisualComponent class methodsFor:'instance creation'! |
|
65 |
||
66 |
new |
|
67 |
^ self basicNew initialize |
|
68 |
! ! |
|
69 |
||
70 |
!VisualComponent methodsFor:'accessing'! |
|
71 |
||
274 | 72 |
container:someContainer |
73 |
"ignored here" |
|
74 |
||
75 |
"Created: 9.5.1996 / 00:48:54 / cg" |
|
76 |
! |
|
77 |
||
78 |
setParentViewIn:aView |
|
79 |
"ignored here - for now" |
|
80 |
||
81 |
"Created: 9.5.1996 / 00:19:39 / cg" |
|
82 |
! ! |
|
83 |
||
84 |
!VisualComponent methodsFor:'accessing - dimensions'! |
|
85 |
||
86 |
bottom |
|
87 |
"return my bottom y coordinate" |
|
88 |
||
89 |
^ self bounds bottom |
|
90 |
||
91 |
"Modified: 9.5.1996 / 00:13:12 / cg" |
|
92 |
"Created: 26.5.1996 / 12:56:12 / cg" |
|
93 |
! |
|
94 |
||
245 | 95 |
bounds |
246 | 96 |
"return my bounds" |
97 |
||
245 | 98 |
^ bounds |
99 |
||
100 |
"Created: 8.5.1996 / 23:35:19 / cg" |
|
246 | 101 |
"Modified: 9.5.1996 / 00:12:00 / cg" |
245 | 102 |
! |
103 |
||
246 | 104 |
bounds:aRectangle |
105 |
"set my bounds" |
|
106 |
||
107 |
bounds := aRectangle |
|
245 | 108 |
|
109 |
"Created: 8.5.1996 / 23:36:07 / cg" |
|
246 | 110 |
"Modified: 9.5.1996 / 00:13:12 / cg" |
245 | 111 |
! |
112 |
||
274 | 113 |
left |
114 |
"return my left x coordinate" |
|
250 | 115 |
|
274 | 116 |
^ self bounds left |
117 |
||
118 |
"Created: 8.5.1996 / 23:36:07 / cg" |
|
119 |
"Modified: 26.5.1996 / 12:56:22 / cg" |
|
250 | 120 |
! |
121 |
||
245 | 122 |
preferredBounds |
246 | 123 |
"return my preferredBounds" |
124 |
||
245 | 125 |
^ 100@100 |
126 |
||
127 |
"Created: 8.5.1996 / 23:36:29 / cg" |
|
246 | 128 |
"Modified: 9.5.1996 / 00:13:22 / cg" |
247 | 129 |
! |
130 |
||
274 | 131 |
right |
132 |
"return my right x coordinate" |
|
133 |
||
134 |
^ self bounds right |
|
247 | 135 |
|
274 | 136 |
"Modified: 9.5.1996 / 00:13:12 / cg" |
137 |
"Created: 26.5.1996 / 12:56:25 / cg" |
|
138 |
! |
|
139 |
||
140 |
top |
|
141 |
"return my top y coordinate" |
|
142 |
||
143 |
^ self bounds top |
|
144 |
||
145 |
"Modified: 9.5.1996 / 00:13:12 / cg" |
|
146 |
"Created: 26.5.1996 / 12:56:15 / cg" |
|
245 | 147 |
! ! |
148 |
||
149 |
!VisualComponent methodsFor:'accessing - look'! |
|
150 |
||
151 |
backgroundColor:aColor |
|
246 | 152 |
"set my backgroundColor" |
153 |
||
245 | 154 |
bgColor := aColor |
155 |
||
156 |
"Created: 8.5.1996 / 23:47:11 / cg" |
|
246 | 157 |
"Modified: 9.5.1996 / 00:13:33 / cg" |
245 | 158 |
! |
159 |
||
160 |
foregroundColor:aColor |
|
246 | 161 |
"set my foregroundColor" |
162 |
||
245 | 163 |
fgColor := aColor |
164 |
||
165 |
"Created: 8.5.1996 / 23:47:05 / cg" |
|
246 | 166 |
"Modified: 9.5.1996 / 00:13:39 / cg" |
245 | 167 |
! ! |
168 |
||
265 | 169 |
!VisualComponent methodsFor:'displaying'! |
170 |
||
171 |
displayOn:aGC x:x y:y |
|
172 |
|oldTranslation| |
|
173 |
||
174 |
oldTranslation := aGC translation. |
|
175 |
aGC translation:(x @ y). |
|
176 |
||
177 |
self displayOn:aGC. |
|
178 |
||
179 |
aGC translation:oldTranslation |
|
180 |
||
181 |
"Created: 13.5.1996 / 10:18:43 / cg" |
|
266
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
182 |
"Modified: 13.5.1996 / 11:18:24 / cg" |
265 | 183 |
! ! |
184 |
||
245 | 185 |
!VisualComponent methodsFor:'event handling'! |
186 |
||
187 |
buttonPress:button x:x y:y |
|
246 | 188 |
"button was pressed over me - ignored here" |
245 | 189 |
|
246 | 190 |
"Modified: 9.5.1996 / 00:14:08 / cg" |
245 | 191 |
! |
192 |
||
193 |
buttonRelease:button x:x y:y |
|
246 | 194 |
"button was released over me - ignored here" |
245 | 195 |
|
196 |
"Created: 8.5.1996 / 23:38:30 / cg" |
|
246 | 197 |
"Modified: 9.5.1996 / 00:14:04 / cg" |
245 | 198 |
! |
199 |
||
200 |
keyPress:key x:x y:y |
|
246 | 201 |
"key was pressed over me - ignored here" |
245 | 202 |
|
203 |
"Created: 8.5.1996 / 23:46:03 / cg" |
|
246 | 204 |
"Modified: 9.5.1996 / 00:14:14 / cg" |
245 | 205 |
! |
206 |
||
207 |
keyRelease:key x:x y:y |
|
246 | 208 |
"key was released over me - ignored here" |
245 | 209 |
|
210 |
"Created: 8.5.1996 / 23:46:07 / cg" |
|
246 | 211 |
"Modified: 9.5.1996 / 00:14:19 / cg" |
245 | 212 |
! ! |
213 |
||
214 |
!VisualComponent methodsFor:'initialization'! |
|
215 |
||
216 |
initialize |
|
217 |
fgColor := Color black. |
|
218 |
bgColor := Color white. |
|
219 |
||
220 |
"Created: 8.5.1996 / 23:49:54 / cg" |
|
221 |
! ! |
|
222 |
||
265 | 223 |
!VisualComponent methodsFor:'queries'! |
224 |
||
225 |
heightOn:aGC |
|
226 |
"return my height, if displayed on aGC; |
|
227 |
I assume that my height is independent of the device, and return |
|
228 |
the bounds height" |
|
229 |
||
230 |
^ self bounds height |
|
231 |
||
232 |
"Modified: 13.5.1996 / 10:15:13 / cg" |
|
233 |
! |
|
234 |
||
235 |
widthOn:aGC |
|
236 |
"return my width, if displayed on aGC; |
|
237 |
I assume that my width is independent of the device, and return |
|
238 |
the bounds width" |
|
239 |
||
240 |
^ self bounds width |
|
241 |
||
242 |
"Created: 13.5.1996 / 10:14:44 / cg" |
|
243 |
"Modified: 13.5.1996 / 10:15:17 / cg" |
|
244 |
! ! |
|
245 |
||
247 | 246 |
!VisualComponent methodsFor:'testing'! |
247 |
||
248 |
containsPoint:aPoint |
|
249 |
"return true, if the receiver contains aPoint" |
|
250 |
||
251 |
^ self bounds containsPoint:aPoint |
|
252 |
||
253 |
"Created: 9.5.1996 / 00:21:44 / cg" |
|
254 |
"Modified: 9.5.1996 / 00:22:00 / cg" |
|
255 |
! |
|
256 |
||
257 |
hasBorder |
|
258 |
"return true, if the receiver shows a border" |
|
259 |
||
260 |
^ false |
|
261 |
||
262 |
"Modified: 9.5.1996 / 00:21:29 / cg" |
|
263 |
! |
|
264 |
||
265 |
intersects:aRectangle |
|
266 |
"return true, if the receivers bounds intersects aRectangle" |
|
267 |
||
268 |
^ self bounds intersects:aRectangle |
|
269 |
||
270 |
"Created: 9.5.1996 / 00:21:18 / cg" |
|
271 |
"Modified: 9.5.1996 / 00:22:04 / cg" |
|
272 |
! ! |
|
273 |
||
245 | 274 |
!VisualComponent class methodsFor:'documentation'! |
275 |
||
276 |
version |
|
274 | 277 |
^ '$Header: /cvs/stx/stx/libview2/Attic/VComponent.st,v 1.7 1996-05-26 11:28:16 cg Exp $' |
245 | 278 |
! ! |