author | Claus Gittinger <cg@exept.de> |
Mon, 13 May 1996 11:34:25 +0200 | |
changeset 266 | e9d35cd74f64 |
parent 265 | 45c83acd7562 |
child 274 | 434f1bc78362 |
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 |
||
72 |
bounds |
|
246 | 73 |
"return my bounds" |
74 |
||
245 | 75 |
^ bounds |
76 |
||
77 |
"Created: 8.5.1996 / 23:35:19 / cg" |
|
246 | 78 |
"Modified: 9.5.1996 / 00:12:00 / cg" |
245 | 79 |
! |
80 |
||
246 | 81 |
bounds:aRectangle |
82 |
"set my bounds" |
|
83 |
||
84 |
bounds := aRectangle |
|
245 | 85 |
|
86 |
"Created: 8.5.1996 / 23:36:07 / cg" |
|
246 | 87 |
"Modified: 9.5.1996 / 00:13:12 / cg" |
245 | 88 |
! |
89 |
||
250 | 90 |
container:someContainer |
91 |
"ignored here" |
|
92 |
||
93 |
"Created: 9.5.1996 / 00:48:54 / cg" |
|
94 |
! |
|
95 |
||
245 | 96 |
preferredBounds |
246 | 97 |
"return my preferredBounds" |
98 |
||
245 | 99 |
^ 100@100 |
100 |
||
101 |
"Created: 8.5.1996 / 23:36:29 / cg" |
|
246 | 102 |
"Modified: 9.5.1996 / 00:13:22 / cg" |
247 | 103 |
! |
104 |
||
105 |
setParentViewIn:aView |
|
106 |
"ignored here - for now" |
|
107 |
||
108 |
"Created: 9.5.1996 / 00:19:39 / cg" |
|
245 | 109 |
! ! |
110 |
||
111 |
!VisualComponent methodsFor:'accessing - look'! |
|
112 |
||
113 |
backgroundColor:aColor |
|
246 | 114 |
"set my backgroundColor" |
115 |
||
245 | 116 |
bgColor := aColor |
117 |
||
118 |
"Created: 8.5.1996 / 23:47:11 / cg" |
|
246 | 119 |
"Modified: 9.5.1996 / 00:13:33 / cg" |
245 | 120 |
! |
121 |
||
122 |
foregroundColor:aColor |
|
246 | 123 |
"set my foregroundColor" |
124 |
||
245 | 125 |
fgColor := aColor |
126 |
||
127 |
"Created: 8.5.1996 / 23:47:05 / cg" |
|
246 | 128 |
"Modified: 9.5.1996 / 00:13:39 / cg" |
245 | 129 |
! ! |
130 |
||
265 | 131 |
!VisualComponent methodsFor:'displaying'! |
132 |
||
133 |
displayOn:aGC x:x y:y |
|
134 |
|oldTranslation| |
|
135 |
||
136 |
oldTranslation := aGC translation. |
|
137 |
aGC translation:(x @ y). |
|
138 |
||
139 |
self displayOn:aGC. |
|
140 |
||
141 |
aGC translation:oldTranslation |
|
142 |
||
143 |
"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
|
144 |
"Modified: 13.5.1996 / 11:18:24 / cg" |
265 | 145 |
! ! |
146 |
||
245 | 147 |
!VisualComponent methodsFor:'event handling'! |
148 |
||
149 |
buttonPress:button x:x y:y |
|
246 | 150 |
"button was pressed over me - ignored here" |
245 | 151 |
|
246 | 152 |
"Modified: 9.5.1996 / 00:14:08 / cg" |
245 | 153 |
! |
154 |
||
155 |
buttonRelease:button x:x y:y |
|
246 | 156 |
"button was released over me - ignored here" |
245 | 157 |
|
158 |
"Created: 8.5.1996 / 23:38:30 / cg" |
|
246 | 159 |
"Modified: 9.5.1996 / 00:14:04 / cg" |
245 | 160 |
! |
161 |
||
162 |
keyPress:key x:x y:y |
|
246 | 163 |
"key was pressed over me - ignored here" |
245 | 164 |
|
165 |
"Created: 8.5.1996 / 23:46:03 / cg" |
|
246 | 166 |
"Modified: 9.5.1996 / 00:14:14 / cg" |
245 | 167 |
! |
168 |
||
169 |
keyRelease:key x:x y:y |
|
246 | 170 |
"key was released over me - ignored here" |
245 | 171 |
|
172 |
"Created: 8.5.1996 / 23:46:07 / cg" |
|
246 | 173 |
"Modified: 9.5.1996 / 00:14:19 / cg" |
245 | 174 |
! ! |
175 |
||
176 |
!VisualComponent methodsFor:'initialization'! |
|
177 |
||
178 |
initialize |
|
179 |
fgColor := Color black. |
|
180 |
bgColor := Color white. |
|
181 |
||
182 |
"Created: 8.5.1996 / 23:49:54 / cg" |
|
183 |
! ! |
|
184 |
||
265 | 185 |
!VisualComponent methodsFor:'queries'! |
186 |
||
187 |
heightOn:aGC |
|
188 |
"return my height, if displayed on aGC; |
|
189 |
I assume that my height is independent of the device, and return |
|
190 |
the bounds height" |
|
191 |
||
192 |
^ self bounds height |
|
193 |
||
194 |
"Modified: 13.5.1996 / 10:15:13 / cg" |
|
195 |
! |
|
196 |
||
197 |
widthOn:aGC |
|
198 |
"return my width, if displayed on aGC; |
|
199 |
I assume that my width is independent of the device, and return |
|
200 |
the bounds width" |
|
201 |
||
202 |
^ self bounds width |
|
203 |
||
204 |
"Created: 13.5.1996 / 10:14:44 / cg" |
|
205 |
"Modified: 13.5.1996 / 10:15:17 / cg" |
|
206 |
! ! |
|
207 |
||
247 | 208 |
!VisualComponent methodsFor:'testing'! |
209 |
||
210 |
containsPoint:aPoint |
|
211 |
"return true, if the receiver contains aPoint" |
|
212 |
||
213 |
^ self bounds containsPoint:aPoint |
|
214 |
||
215 |
"Created: 9.5.1996 / 00:21:44 / cg" |
|
216 |
"Modified: 9.5.1996 / 00:22:00 / cg" |
|
217 |
! |
|
218 |
||
219 |
hasBorder |
|
220 |
"return true, if the receiver shows a border" |
|
221 |
||
222 |
^ false |
|
223 |
||
224 |
"Modified: 9.5.1996 / 00:21:29 / cg" |
|
225 |
! |
|
226 |
||
227 |
intersects:aRectangle |
|
228 |
"return true, if the receivers bounds intersects aRectangle" |
|
229 |
||
230 |
^ self bounds intersects:aRectangle |
|
231 |
||
232 |
"Created: 9.5.1996 / 00:21:18 / cg" |
|
233 |
"Modified: 9.5.1996 / 00:22:04 / cg" |
|
234 |
! ! |
|
235 |
||
245 | 236 |
!VisualComponent class methodsFor:'documentation'! |
237 |
||
238 |
version |
|
266
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
239 |
^ '$Header: /cvs/stx/stx/libview2/VisualComponent.st,v 1.6 1996-05-13 09:34:25 cg Exp $' |
245 | 240 |
! ! |