author | Claus Gittinger <cg@exept.de> |
Wed, 08 Feb 2017 00:50:25 +0100 | |
changeset 3864 | 37f4e48a35e7 |
parent 2662 | c8338281bc33 |
child 3855 | 1db7742d33ad |
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 |
||
279 | 14 |
VisualPart subclass:#Wrapper |
245 | 15 |
instanceVariableNames:'component' |
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
1789 | 18 |
category:'Compatibility-ST80-Graphics-Display Objects' |
245 | 19 |
! |
20 |
||
365 | 21 |
!Wrapper class methodsFor:'documentation'! |
245 | 22 |
|
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1996 by Claus Gittinger |
|
26 |
All Rights Reserved |
|
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 |
||
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
41 |
abstract superclass for all kinds of wrapping components |
|
42 |
||
365 | 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 VisualPart hierarchy. |
|
46 |
||
47 |
Notice: |
|
48 |
this class was implemented using protocol information |
|
49 |
from alpha testers, from reading PD programs and |
|
50 |
from the Hopkins/Horan book. |
|
51 |
- it may not be complete or compatible to the corresponding ST-80 class. |
|
52 |
If you encounter any incompatibilities, please forward a note |
|
53 |
describing the incompatibility verbal (i.e. no code) to the ST/X team. |
|
54 |
This is still being constructed - not yet finished. |
|
55 |
||
245 | 56 |
[author:] |
57 |
Claus Gittinger |
|
58 |
" |
|
59 |
||
60 |
! ! |
|
61 |
||
365 | 62 |
!Wrapper class methodsFor:'instance creation'! |
245 | 63 |
|
64 |
on:aComponent |
|
65 |
^ self new component:aComponent |
|
66 |
||
67 |
"Created: 8.5.1996 / 23:20:46 / cg" |
|
68 |
! ! |
|
69 |
||
70 |
!Wrapper methodsFor:'accessing'! |
|
71 |
||
72 |
component |
|
247 | 73 |
"return the wrappers component" |
74 |
||
245 | 75 |
^ component |
76 |
||
77 |
"Created: 8.5.1996 / 23:17:30 / cg" |
|
247 | 78 |
"Modified: 9.5.1996 / 00:19:58 / cg" |
245 | 79 |
! |
80 |
||
81 |
component:someComponent |
|
247 | 82 |
"set the wrappers component" |
83 |
||
279 | 84 |
component := someComponent. |
85 |
component notNil ifTrue:[ |
|
283 | 86 |
"/ temporary kludge - images are (currently) not |
87 |
"/ inheriting from visualComponent ... |
|
292
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
88 |
"/ (someComponent respondsTo:#container:) ifTrue:[ |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
89 |
someComponent container:self. |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
90 |
"/ ]. |
2662 | 91 |
frame isNil ifTrue:[ |
292
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
92 |
component bounds notNil ifTrue:[ |
2662 | 93 |
frame := component bounds |
292
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
94 |
] |
283 | 95 |
] |
279 | 96 |
] |
245 | 97 |
|
98 |
"Created: 8.5.1996 / 23:17:46 / cg" |
|
292
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
99 |
"Modified: 5.6.1996 / 02:31:40 / cg" |
245 | 100 |
! ! |
101 |
||
102 |
!Wrapper methodsFor:'accessing - bounds'! |
|
103 |
||
104 |
bounds:newBounds |
|
246 | 105 |
"set my bounds - forwarded to the wrapped object" |
106 |
||
2662 | 107 |
newBounds ~= frame ifTrue:[ |
108 |
frame := newBounds. |
|
321 | 109 |
component bounds:newBounds |
110 |
]. |
|
245 | 111 |
|
112 |
"Created: 8.5.1996 / 23:18:12 / cg" |
|
321 | 113 |
"Modified: 19.7.1996 / 17:47:34 / cg" |
245 | 114 |
! |
115 |
||
279 | 116 |
newBounds:newBounds containingBounds:containingBounds |
117 |
self bounds:newBounds |
|
118 |
||
119 |
"Created: 26.5.1996 / 16:50:49 / cg" |
|
120 |
! |
|
121 |
||
245 | 122 |
preferredBounds |
246 | 123 |
"return my preferredBounds as the components preferredBounds" |
124 |
||
245 | 125 |
^ component preferredBounds |
126 |
||
127 |
"Created: 8.5.1996 / 23:18:53 / cg" |
|
246 | 128 |
"Modified: 9.5.1996 / 00:10:32 / cg" |
245 | 129 |
! ! |
130 |
||
131 |
!Wrapper methodsFor:'displaying'! |
|
132 |
||
2209 | 133 |
displayOn:aGCOrStream |
246 | 134 |
"display myself - forwarded to the wrapped object" |
135 |
||
2209 | 136 |
"/ what a kludge - Dolphin and Squeak mean: printOn: a stream; |
137 |
"/ ST/X (and some old ST80's) mean: draw-yourself on a GC. |
|
138 |
(aGCOrStream isStream or:[aGCOrStream == Transcript]) ifTrue:[ |
|
139 |
self printOn:aGCOrStream. |
|
140 |
^ self |
|
141 |
]. |
|
142 |
component displayOn:aGCOrStream |
|
245 | 143 |
|
2209 | 144 |
"Created: / 08-05-1996 / 23:19:24 / cg" |
145 |
"Modified: / 11-09-2006 / 15:01:24 / User" |
|
245 | 146 |
! ! |
147 |
||
292
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
148 |
!Wrapper methodsFor:'queries'! |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
149 |
|
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
150 |
hasBorder |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
151 |
^ false |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
152 |
|
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
153 |
"Created: 26.5.1996 / 16:47:37 / cg" |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
154 |
! |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
155 |
|
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
156 |
isWrapper |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
157 |
^ true |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
158 |
|
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
159 |
"Created: 5.6.1996 / 01:04:30 / cg" |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
160 |
! ! |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
161 |
|
279 | 162 |
!Wrapper methodsFor:'testing'! |
163 |
||
164 |
containsPoint:aPoint |
|
165 |
^ component containsPoint:aPoint |
|
166 |
||
167 |
"Created: 26.5.1996 / 16:48:00 / cg" |
|
168 |
! |
|
169 |
||
170 |
intersects:aRectangle |
|
171 |
^ component intersects:aRectangle |
|
172 |
||
173 |
"Created: 26.5.1996 / 16:48:52 / cg" |
|
174 |
! ! |
|
175 |
||
292
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
176 |
!Wrapper methodsFor:'view protocol mimicri'! |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
177 |
|
321 | 178 |
containerMapped |
179 |
component containerMapped |
|
180 |
||
181 |
"Created: 19.7.1996 / 17:41:31 / cg" |
|
182 |
! |
|
183 |
||
184 |
containerUnmapped |
|
185 |
component containerUnmapped |
|
186 |
||
187 |
"Created: 19.7.1996 / 17:45:10 / cg" |
|
188 |
! |
|
189 |
||
190 |
destroy |
|
2662 | 191 |
self destroyComponent. |
192 |
super destroy. |
|
321 | 193 |
|
194 |
"Created: 19.7.1996 / 17:26:02 / cg" |
|
195 |
! |
|
196 |
||
2662 | 197 |
destroyComponent |
198 |
component destroy |
|
199 |
! |
|
200 |
||
292
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
201 |
realize |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
202 |
"my container realized itself. Forward this to my component" |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
203 |
|
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
204 |
component realize. |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
205 |
|
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
206 |
"Created: 4.6.1996 / 21:29:27 / cg" |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
207 |
! |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
208 |
|
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
209 |
removeSubView:aView |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
210 |
component := nil |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
211 |
|
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
212 |
"Created: 4.6.1996 / 21:39:50 / cg" |
1220
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
365
diff
changeset
|
213 |
! |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
365
diff
changeset
|
214 |
|
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
365
diff
changeset
|
215 |
withAllSubViewsDo:aBlock |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
365
diff
changeset
|
216 |
aBlock value:self. |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
365
diff
changeset
|
217 |
component notNil ifTrue:[ |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
365
diff
changeset
|
218 |
component withAllSubViewsDo:aBlock |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
365
diff
changeset
|
219 |
]. |
39e5e28042da
protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents:
365
diff
changeset
|
220 |
|
292
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
221 |
! ! |
60fbf13dfc8c
prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
222 |
|
365 | 223 |
!Wrapper class methodsFor:'documentation'! |
245 | 224 |
|
225 |
version |
|
2662 | 226 |
^ '$Header: /cvs/stx/stx/libview2/Wrapper.st,v 1.13 2009-05-08 11:54:52 cg Exp $' |
245 | 227 |
! ! |