author | mawalch |
Mon, 22 May 2017 12:19:24 +0200 | |
changeset 3955 | 23fc9de7f301 |
parent 3928 | bf6f6f75212f |
child 4024 | 54beadcf89bb |
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 |
" |
|
1789 | 12 |
"{ Package: 'stx:libview2' }" |
13 |
||
3438 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
2659 | 16 |
DisplayObject subclass:#VisualComponent |
17 |
instanceVariableNames:'' |
|
245 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
1789 | 20 |
category:'Compatibility-ST80-Graphics-Display Objects' |
245 | 21 |
! |
22 |
||
365 | 23 |
!VisualComponent class methodsFor:'documentation'! |
245 | 24 |
|
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1996 by Claus Gittinger |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
||
38 |
||
39 |
! |
|
40 |
||
41 |
documentation |
|
42 |
" |
|
246 | 43 |
abstract superclass for all kinds of visual components. |
265 | 44 |
This class and its subclasses (currently) exist mostly for |
45 |
ST-80 compatibility - to provide a home for ported PD classes, |
|
46 |
which depend on the VisualComponent hierarchy. |
|
47 |
||
48 |
Notice: |
|
49 |
this class was implemented using protocol information |
|
365 | 50 |
from alpha testers, from reading PD programs and |
51 |
from the Hopkins/Horan book. |
|
265 | 52 |
- it may not be complete or compatible to the corresponding ST-80 class. |
53 |
If you encounter any incompatibilities, please forward a note |
|
54 |
describing the incompatibility verbal (i.e. no code) to the ST/X team. |
|
55 |
This is still being constructed - not yet finished. |
|
245 | 56 |
|
57 |
[author:] |
|
58 |
Claus Gittinger |
|
265 | 59 |
|
60 |
[see also:] |
|
61 |
GeometricWrapper |
|
245 | 62 |
" |
63 |
||
64 |
! ! |
|
65 |
||
365 | 66 |
!VisualComponent class methodsFor:'instance creation'! |
245 | 67 |
|
68 |
new |
|
69 |
^ self basicNew initialize |
|
70 |
! ! |
|
71 |
||
962
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
72 |
!VisualComponent class methodsFor:'queries'! |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
73 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
74 |
defaultFont |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
75 |
^ SimpleView defaultFont |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
76 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
77 |
"Created: / 18.6.1998 / 16:14:22 / cg" |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
78 |
! |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
79 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
80 |
defaultViewBackgroundColor |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
81 |
^ SimpleView defaultViewBackgroundColor |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
82 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
83 |
"Created: / 18.6.1998 / 16:15:17 / cg" |
3879 | 84 |
! |
85 |
||
86 |
isAbstract |
|
87 |
"Return if this class is an abstract class. |
|
88 |
True is returned here for myself only; false for subclasses. |
|
89 |
Abstract subclasses must redefine this again." |
|
90 |
||
91 |
^ self == VisualComponent. |
|
962
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
92 |
! ! |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
93 |
|
245 | 94 |
!VisualComponent methodsFor:'accessing'! |
95 |
||
962
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
96 |
backgroundColor |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
97 |
^ Color white |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
98 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
99 |
"Created: / 18.6.1998 / 16:01:00 / cg" |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
100 |
! |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
101 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
102 |
backgroundColor:aColor |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
103 |
"ignored here" |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
104 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
105 |
"Created: / 18.6.1998 / 16:15:28 / cg" |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
106 |
! |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
107 |
|
274 | 108 |
container:someContainer |
109 |
"ignored here" |
|
110 |
||
111 |
"Created: 9.5.1996 / 00:48:54 / cg" |
|
112 |
! |
|
113 |
||
962
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
114 |
defaultFont |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
115 |
^ SimpleView defaultFont |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
116 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
117 |
"Created: / 18.6.1998 / 16:13:56 / cg" |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
118 |
! |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
119 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
120 |
font:aFont |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
121 |
"ignored here" |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
122 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
123 |
"Created: / 18.6.1998 / 16:14:39 / cg" |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
124 |
! |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
125 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
126 |
foregroundColor |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
127 |
^ Color black |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
128 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
129 |
"Created: / 18.6.1998 / 16:01:07 / cg" |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
130 |
! |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
131 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
132 |
foregroundColor:aColor |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
133 |
"ignored here" |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
134 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
135 |
"Created: / 18.6.1998 / 16:14:53 / cg" |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
136 |
! |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
137 |
|
2659 | 138 |
geometryLayout |
139 |
"ignored here" |
|
140 |
||
141 |
^ nil |
|
142 |
! |
|
143 |
||
962
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
144 |
geometryLayout:aLayout |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
145 |
"ignored here" |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
146 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
147 |
"Created: / 18.6.1998 / 16:15:39 / cg" |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
148 |
! |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
149 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
150 |
hiddenOnRealize:aBoolean |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
151 |
"ignored here" |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
152 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
153 |
"Created: / 18.6.1998 / 16:13:19 / cg" |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
154 |
! |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
155 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
156 |
id |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
157 |
"ignored here" |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
158 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
159 |
^ nil |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
160 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
161 |
"Created: / 18.6.1998 / 16:13:34 / cg" |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
162 |
! |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
163 |
|
274 | 164 |
setParentViewIn:aView |
165 |
"ignored here - for now" |
|
166 |
||
167 |
"Created: 9.5.1996 / 00:19:39 / cg" |
|
962
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
168 |
! |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
169 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
170 |
superView |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
171 |
^ self container |
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
172 |
|
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
173 |
"Created: / 18.6.1998 / 16:16:07 / cg" |
274 | 174 |
! ! |
175 |
||
994 | 176 |
!VisualComponent methodsFor:'accessing-STX-attributes'! |
177 |
||
1270 | 178 |
application |
179 |
^ self container application |
|
180 |
||
181 |
"Created: / 19.11.1999 / 17:44:38 / cg" |
|
182 |
! |
|
183 |
||
994 | 184 |
borderWidth |
185 |
^ 0 |
|
186 |
||
187 |
"Modified: / 6.7.1998 / 13:47:28 / cg" |
|
188 |
! |
|
189 |
||
1789 | 190 |
borderWidth:aNumber |
191 |
^ 0 |
|
192 |
||
193 |
"Modified: / 6.7.1998 / 13:47:28 / cg" |
|
194 |
! |
|
195 |
||
196 |
canTab:aBoolean |
|
197 |
||
198 |
"Modified: / 6.7.1998 / 13:46:17 / cg" |
|
199 |
"Created: / 6.7.1998 / 13:48:35 / cg" |
|
200 |
! |
|
201 |
||
2659 | 202 |
layout |
203 |
^ self geometryLayout |
|
204 |
! |
|
994 | 205 |
|
2659 | 206 |
layout:newLayout |
207 |
self geometryLayout:newLayout |
|
994 | 208 |
! |
209 |
||
210 |
level |
|
211 |
^ 0 |
|
212 |
||
213 |
"Modified: / 6.7.1998 / 13:46:17 / cg" |
|
214 |
"Created: / 6.7.1998 / 13:46:50 / cg" |
|
215 |
! |
|
216 |
||
217 |
level:newLevel |
|
218 |
||
219 |
"Modified: / 6.7.1998 / 13:46:17 / cg" |
|
220 |
"Created: / 6.7.1998 / 13:47:43 / cg" |
|
2659 | 221 |
! |
222 |
||
223 |
name |
|
224 |
^ self printString |
|
225 |
! |
|
226 |
||
227 |
realized |
|
3281 | 228 |
"return true, if the receiver is realized. |
229 |
Realized means that it has been mapped (i.e. made visible) on |
|
230 |
the display (as opposed to being only created and possibly invisible)" |
|
231 |
||
2659 | 232 |
^ true |
233 |
! |
|
234 |
||
235 |
viewBackground |
|
236 |
^ self backgroundColor |
|
994 | 237 |
! ! |
238 |
||
239 |
!VisualComponent methodsFor:'accessing-dimensions'! |
|
274 | 240 |
|
241 |
bottom |
|
242 |
"return my bottom y coordinate" |
|
243 |
||
244 |
^ self bounds bottom |
|
245 |
||
246 |
"Modified: 9.5.1996 / 00:13:12 / cg" |
|
247 |
"Created: 26.5.1996 / 12:56:12 / cg" |
|
248 |
! |
|
249 |
||
245 | 250 |
bounds |
246 | 251 |
"return my bounds" |
252 |
||
2659 | 253 |
frame isNil ifTrue:[ |
254 |
self computeBoundingBox. |
|
255 |
]. |
|
256 |
^ frame |
|
962
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
257 |
! |
245 | 258 |
|
246 | 259 |
bounds:aRectangle |
260 |
"set my bounds" |
|
261 |
||
2664 | 262 |
self assert:aRectangle notNil. |
2659 | 263 |
frame := aRectangle |
264 |
! |
|
245 | 265 |
|
2682 | 266 |
defaultExtent |
267 |
^ 50@50 |
|
268 |
! |
|
269 |
||
2659 | 270 |
extent:anExtent |
271 |
"set my extent" |
|
272 |
||
2669 | 273 |
frame := self frame copy extent:anExtent |
962
e6ccfc7fb22e
added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents:
406
diff
changeset
|
274 |
! |
245 | 275 |
|
274 | 276 |
left |
277 |
"return my left x coordinate" |
|
250 | 278 |
|
274 | 279 |
^ self bounds left |
280 |
||
281 |
"Created: 8.5.1996 / 23:36:07 / cg" |
|
282 |
"Modified: 26.5.1996 / 12:56:22 / cg" |
|
250 | 283 |
! |
284 |
||
2233 | 285 |
origin:newOrigin |
2669 | 286 |
"move my origin" |
2233 | 287 |
|
2682 | 288 |
|oldFrame| |
289 |
||
290 |
oldFrame := self frame. |
|
291 |
oldFrame isNil ifTrue:[ |
|
292 |
oldFrame := 0@0 extent:(self defaultExtent). |
|
293 |
]. |
|
294 |
||
295 |
frame := newOrigin copy extent:(oldFrame extent). |
|
2233 | 296 |
|
297 |
"Created: 8.5.1996 / 23:36:07 / cg" |
|
298 |
"Modified: 9.5.1996 / 00:13:12 / cg" |
|
299 |
! |
|
300 |
||
245 | 301 |
preferredBounds |
246 | 302 |
"return my preferredBounds" |
303 |
||
323 | 304 |
^ 0@0 extent:100@100 |
245 | 305 |
|
306 |
"Created: 8.5.1996 / 23:36:29 / cg" |
|
323 | 307 |
"Modified: 19.7.1996 / 20:06:28 / cg" |
308 |
! |
|
309 |
||
310 |
preferredExtent |
|
311 |
^ self preferredBounds extent |
|
312 |
||
246 | 313 |
"Modified: 9.5.1996 / 00:13:22 / cg" |
323 | 314 |
"Created: 19.7.1996 / 20:06:19 / cg" |
247 | 315 |
! |
316 |
||
274 | 317 |
right |
318 |
"return my right x coordinate" |
|
319 |
||
320 |
^ self bounds right |
|
247 | 321 |
|
274 | 322 |
"Modified: 9.5.1996 / 00:13:12 / cg" |
323 |
"Created: 26.5.1996 / 12:56:25 / cg" |
|
324 |
! |
|
325 |
||
326 |
top |
|
327 |
"return my top y coordinate" |
|
328 |
||
329 |
^ self bounds top |
|
330 |
||
331 |
"Modified: 9.5.1996 / 00:13:12 / cg" |
|
332 |
"Created: 26.5.1996 / 12:56:15 / cg" |
|
321 | 333 |
! |
334 |
||
335 |
viewRectangle |
|
336 |
^ self bounds |
|
337 |
||
338 |
"Created: 19.7.1996 / 17:24:58 / cg" |
|
245 | 339 |
! ! |
340 |
||
293
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
341 |
!VisualComponent methodsFor:'accessing-mvc'! |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
342 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
343 |
model |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
344 |
"return nil - generic components have no model" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
345 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
346 |
^ nil |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
347 |
|
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
348 |
"Created: 5.6.1996 / 14:18:16 / cg" |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
349 |
! ! |
d10ad10d23fa
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
350 |
|
2127 | 351 |
!VisualComponent methodsFor:'change & update'! |
352 |
||
353 |
changedPreferredBounds: oldPreferredBoundsOrNil |
|
354 |
"The receiver is notifying any dependents that its preferredBounds has changed." |
|
355 |
||
356 |
self changed: #preferredBounds with: oldPreferredBoundsOrNil |
|
357 |
! ! |
|
358 |
||
265 | 359 |
!VisualComponent methodsFor:'displaying'! |
360 |
||
2210 | 361 |
displayOn:aGCOrStream |
406 | 362 |
"display the receiver on some graphicsContext. |
363 |
The sender is repsonsible for restoring the GC's state |
|
364 |
(i.e. it may be left in any undefined state)" |
|
365 |
||
2210 | 366 |
"/ what a kludge - Dolphin and Squeak mean: printOn: a stream; |
3928 | 367 |
"/ old ST80 means: draw-yourself on a GC. |
3358 | 368 |
(aGCOrStream isStream) ifTrue:[ |
2210 | 369 |
self printOn:aGCOrStream. |
370 |
^ self |
|
371 |
]. |
|
406 | 372 |
self subclassResponsibility |
373 |
||
2210 | 374 |
"Modified: / 10-02-1997 / 13:53:03 / cg" |
375 |
"Modified: / 11-09-2006 / 15:01:06 / User" |
|
3928 | 376 |
"Modified (comment): / 22-02-2017 / 16:49:42 / cg" |
406 | 377 |
! |
378 |
||
379 |
displayOn:aGC at:aPoint |
|
380 |
"display the receiver translated by some amount on some graphicsContext" |
|
381 |
||
265 | 382 |
|oldTranslation| |
383 |
||
384 |
oldTranslation := aGC translation. |
|
406 | 385 |
aGC translateBy:aPoint. |
265 | 386 |
self displayOn:aGC. |
387 |
aGC translation:oldTranslation |
|
388 |
||
406 | 389 |
"Created: 10.2.1997 / 13:47:18 / cg" |
390 |
"Modified: 10.2.1997 / 13:52:53 / cg" |
|
391 |
! |
|
392 |
||
393 |
displayOn:aGC x:x y:y |
|
394 |
"display the receiver translated by some amount on some graphicsContext" |
|
395 |
||
396 |
^ self displayOn:aGC at:(x @ y). |
|
397 |
||
398 |
"Modified: 10.2.1997 / 13:52:57 / cg" |
|
265 | 399 |
! ! |
400 |
||
245 | 401 |
!VisualComponent methodsFor:'event handling'! |
402 |
||
403 |
buttonPress:button x:x y:y |
|
246 | 404 |
"button was pressed over me - ignored here" |
245 | 405 |
|
246 | 406 |
"Modified: 9.5.1996 / 00:14:08 / cg" |
245 | 407 |
! |
408 |
||
409 |
buttonRelease:button x:x y:y |
|
246 | 410 |
"button was released over me - ignored here" |
245 | 411 |
|
412 |
"Created: 8.5.1996 / 23:38:30 / cg" |
|
246 | 413 |
"Modified: 9.5.1996 / 00:14:04 / cg" |
245 | 414 |
! |
415 |
||
321 | 416 |
containerChangedSize |
417 |
||
418 |
"Created: 19.7.1996 / 17:32:19 / cg" |
|
419 |
! |
|
420 |
||
421 |
containerMapped |
|
422 |
||
423 |
"Created: 19.7.1996 / 17:39:27 / cg" |
|
424 |
! |
|
425 |
||
426 |
containerUnmapped |
|
427 |
||
428 |
"Created: 19.7.1996 / 17:44:52 / cg" |
|
429 |
! |
|
430 |
||
431 |
destroy |
|
432 |
||
433 |
"Created: 19.7.1996 / 17:25:46 / cg" |
|
434 |
! |
|
435 |
||
2127 | 436 |
hasKeyboardFocus:aBoolean |
437 |
"notification from the windowGroup that I got the keyboardFocus." |
|
438 |
||
439 |
^ self |
|
440 |
||
441 |
"Created: / 6.7.1998 / 13:49:12 / cg" |
|
442 |
! |
|
443 |
||
245 | 444 |
keyPress:key x:x y:y |
246 | 445 |
"key was pressed over me - ignored here" |
245 | 446 |
|
447 |
"Created: 8.5.1996 / 23:46:03 / cg" |
|
246 | 448 |
"Modified: 9.5.1996 / 00:14:14 / cg" |
245 | 449 |
! |
450 |
||
451 |
keyRelease:key x:x y:y |
|
246 | 452 |
"key was released over me - ignored here" |
245 | 453 |
|
454 |
"Created: 8.5.1996 / 23:46:07 / cg" |
|
246 | 455 |
"Modified: 9.5.1996 / 00:14:19 / cg" |
994 | 456 |
! |
457 |
||
458 |
mapped |
|
459 |
||
460 |
"Created: / 6.7.1998 / 13:48:46 / cg" |
|
461 |
! |
|
462 |
||
463 |
showFocus:explicit |
|
464 |
||
465 |
"Created: / 6.7.1998 / 13:49:05 / cg" |
|
466 |
! |
|
467 |
||
468 |
showNoFocus:explicit |
|
469 |
||
470 |
"Created: / 6.7.1998 / 13:49:12 / cg" |
|
245 | 471 |
! ! |
472 |
||
473 |
!VisualComponent methodsFor:'initialization'! |
|
474 |
||
475 |
initialize |
|
476 |
||
406 | 477 |
"Modified: 10.2.1997 / 19:28:11 / cg" |
2932 | 478 |
! |
479 |
||
480 |
resize |
|
481 |
self extent:(self preferredExtent) |
|
482 |
||
483 |
"Created: / 25-07-2011 / 17:24:08 / cg" |
|
245 | 484 |
! ! |
485 |
||
265 | 486 |
!VisualComponent methodsFor:'queries'! |
487 |
||
994 | 488 |
delegate |
489 |
^ nil |
|
490 |
||
491 |
"Created: / 6.7.1998 / 13:50:10 / cg" |
|
492 |
! |
|
493 |
||
265 | 494 |
heightOn:aGC |
495 |
"return my height, if displayed on aGC; |
|
496 |
I assume that my height is independent of the device, and return |
|
497 |
the bounds height" |
|
498 |
||
499 |
^ self bounds height |
|
500 |
||
501 |
"Modified: 13.5.1996 / 10:15:13 / cg" |
|
502 |
! |
|
503 |
||
290
d26dc55ac7e4
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
504 |
isBorderedWrapper |
d26dc55ac7e4
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
505 |
^ false |
d26dc55ac7e4
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
506 |
|
d26dc55ac7e4
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
507 |
"Created: 5.6.1996 / 14:11:18 / cg" |
d26dc55ac7e4
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
508 |
! |
d26dc55ac7e4
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
509 |
|
2127 | 510 |
isCursorKeyConsumer |
3438 | 511 |
"return true, if the receiver can be controlled by cursor keys; |
512 |
i.e. it can handle some keyboard input, |
|
513 |
isCursorKeyConsumer are potential candidates for getting the keyboard |
|
514 |
focus initially within dialogBoxes, or when the focus-follows-pointer |
|
515 |
mode is off." |
|
516 |
||
2127 | 517 |
^ false |
518 |
! |
|
519 |
||
1220
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
520 |
isExternalTopView |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
521 |
^ false |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
522 |
|
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
523 |
"Created: / 6.7.1998 / 13:50:01 / cg" |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
524 |
! |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
525 |
|
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
526 |
isInputField |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
527 |
^ false |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
528 |
|
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
529 |
"Created: 19.7.1996 / 17:50:59 / cg" |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
530 |
! |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
531 |
|
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
532 |
isKeyboardConsumer |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
533 |
^ false |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
534 |
|
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
535 |
"Created: 19.7.1996 / 17:50:59 / cg" |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
536 |
! |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
537 |
|
321 | 538 |
isLayoutWrapper |
539 |
^ false |
|
540 |
||
541 |
"Created: 19.7.1996 / 17:50:59 / cg" |
|
542 |
! |
|
543 |
||
994 | 544 |
isRootView |
545 |
^ false |
|
546 |
||
547 |
"Created: / 6.7.1998 / 13:50:01 / cg" |
|
548 |
! |
|
549 |
||
2667 | 550 |
isTransparentBox |
551 |
^ false |
|
552 |
||
553 |
"Created: 19.7.1996 / 17:50:59 / cg" |
|
554 |
! |
|
555 |
||
290
d26dc55ac7e4
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
556 |
isWrapper |
d26dc55ac7e4
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
557 |
^ false |
d26dc55ac7e4
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
558 |
|
d26dc55ac7e4
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
559 |
"Created: 5.6.1996 / 01:04:40 / cg" |
d26dc55ac7e4
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
560 |
! |
d26dc55ac7e4
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
561 |
|
265 | 562 |
widthOn:aGC |
563 |
"return my width, if displayed on aGC; |
|
564 |
I assume that my width is independent of the device, and return |
|
565 |
the bounds width" |
|
566 |
||
567 |
^ self bounds width |
|
568 |
||
569 |
"Created: 13.5.1996 / 10:14:44 / cg" |
|
570 |
"Modified: 13.5.1996 / 10:15:17 / cg" |
|
571 |
! ! |
|
572 |
||
247 | 573 |
!VisualComponent methodsFor:'testing'! |
574 |
||
575 |
containsPoint:aPoint |
|
576 |
"return true, if the receiver contains aPoint" |
|
577 |
||
578 |
^ self bounds containsPoint:aPoint |
|
579 |
||
580 |
"Created: 9.5.1996 / 00:21:44 / cg" |
|
581 |
"Modified: 9.5.1996 / 00:22:00 / cg" |
|
582 |
! |
|
583 |
||
584 |
hasBorder |
|
585 |
"return true, if the receiver shows a border" |
|
586 |
||
587 |
^ false |
|
588 |
||
589 |
"Modified: 9.5.1996 / 00:21:29 / cg" |
|
590 |
! |
|
591 |
||
592 |
intersects:aRectangle |
|
3617 | 593 |
"return true, if the receiver's bounds intersects aRectangle" |
247 | 594 |
|
595 |
^ self bounds intersects:aRectangle |
|
596 |
||
597 |
"Created: 9.5.1996 / 00:21:18 / cg" |
|
598 |
"Modified: 9.5.1996 / 00:22:04 / cg" |
|
599 |
! ! |
|
600 |
||
365 | 601 |
!VisualComponent class methodsFor:'documentation'! |
245 | 602 |
|
603 |
version |
|
3617 | 604 |
^ '$Header$' |
3660 | 605 |
! |
606 |
||
607 |
version_CVS |
|
608 |
^ '$Header$' |
|
245 | 609 |
! ! |
3281 | 610 |