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