author | tm |
Thu, 17 Jun 1999 10:51:17 +0200 | |
changeset 1414 | faf0465c333b |
parent 1412 | b426fae6edcf |
child 1450 | 9994adae5c1c |
permissions | -rw-r--r-- |
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
1 |
" |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
2 |
COPYRIGHT (c) 1998 by eXept Software AG |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
3 |
All Rights Reserved |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
4 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
5 |
This software is furnished under a license and may be used |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
6 |
only in accordance with the terms of that license and with the |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
7 |
inclusion of the above copyright notice. This software may not |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
8 |
be provided or otherwise made available to, or used by, any |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
9 |
other person. No title to or ownership of the software is |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
10 |
hereby transferred. |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
11 |
" |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
12 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
13 |
|
455 | 14 |
ScrollableView subclass:#SubCanvas |
1412 | 15 |
instanceVariableNames:'builder spec client clientHolder specHolder clientView |
16 |
clientViewIsScrolled' |
|
455 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
19 |
category:'Views-Basic' |
|
20 |
! |
|
21 |
||
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
22 |
!SubCanvas class methodsFor:'documentation'! |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
23 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
24 |
copyright |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
25 |
" |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
26 |
COPYRIGHT (c) 1998 by eXept Software AG |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
27 |
All Rights Reserved |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
28 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
29 |
This software is furnished under a license and may be used |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
30 |
only in accordance with the terms of that license and with the |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
31 |
inclusion of the above copyright notice. This software may not |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
32 |
be provided or otherwise made available to, or used by, any |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
33 |
other person. No title to or ownership of the software is |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
34 |
hereby transferred. |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
35 |
" |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
36 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
37 |
! |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
38 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
39 |
documentation |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
40 |
" |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
41 |
a view for a subApplication. |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
42 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
43 |
[author:] |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
44 |
Claus Atzkern |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
45 |
" |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
46 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
47 |
! ! |
455 | 48 |
|
1414
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
49 |
!SubCanvas class methodsFor:'defaults'! |
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
50 |
|
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
51 |
defaultHorizontalScrollable |
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
52 |
^ false |
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
53 |
|
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
54 |
|
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
55 |
! |
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
56 |
|
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
57 |
defaultVerticalScrollable |
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
58 |
^ false |
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
59 |
|
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
60 |
|
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
61 |
! ! |
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
62 |
|
455 | 63 |
!SubCanvas methodsFor:'accessing'! |
64 |
||
503 | 65 |
builder |
66 |
"return the value of the instance variable 'builder' (automatically generated)" |
|
455 | 67 |
|
503 | 68 |
^ builder! |
455 | 69 |
|
503 | 70 |
client |
71 |
"return the value of the instance variable 'client' (automatically generated)" |
|
455 | 72 |
|
503 | 73 |
^ client! |
455 | 74 |
|
75 |
client:anApplicationModel |
|
76 |
"release existing components and generate new components from |
|
77 |
the applications windowSpec." |
|
78 |
||
79 |
^ self client:anApplicationModel spec:#windowSpec |
|
80 |
! |
|
81 |
||
503 | 82 |
client:anApplication spec:aWindowSpecOrSelector |
455 | 83 |
"release existing components and generate new components from |
84 |
the applications windowSpec." |
|
85 |
||
503 | 86 |
|aBuilder| |
455 | 87 |
|
503 | 88 |
(anApplication notNil and:[anApplication respondsTo:#builder]) ifTrue:[ |
89 |
aBuilder := anApplication builder |
|
455 | 90 |
] ifFalse:[ |
503 | 91 |
aBuilder := UIBuilder new |
455 | 92 |
]. |
503 | 93 |
^ self client:anApplication spec:aWindowSpecOrSelector builder:aBuilder |
455 | 94 |
! |
95 |
||
503 | 96 |
client:anApplication spec:aWindowSpecOrSpecSymbol builder:aBuilder |
455 | 97 |
"release existing components and generate new components from |
98 |
the given windowSpec, using the given builder." |
|
99 |
||
503 | 100 |
builder := aBuilder. |
101 |
spec := aWindowSpecOrSpecSymbol. |
|
102 |
||
103 |
"/ check for master application |
|
104 |
(anApplication notNil and:[anApplication masterApplication isNil]) ifTrue:[ |
|
105 |
client := nil. |
|
106 |
client := self application. |
|
107 |
client ~~ anApplication ifTrue:[ |
|
108 |
anApplication masterApplication:client |
|
109 |
] |
|
110 |
]. |
|
111 |
client := anApplication. |
|
112 |
self rebuild. |
|
113 |
^ builder |
|
114 |
! |
|
115 |
||
1412 | 116 |
makeClientViewScrollable:aBoolean |
117 |
|vs| |
|
118 |
||
119 |
aBoolean ~~ clientViewIsScrolled ifTrue:[ |
|
120 |
clientView := View new. |
|
121 |
||
122 |
aBoolean ifTrue:[ |
|
123 |
self scrolledView:(vs := ViewScroller new). |
|
124 |
vs scrolledView:clientView. |
|
125 |
] ifFalse:[ |
|
126 |
self scrolledView:clientView. |
|
127 |
]. |
|
128 |
clientViewIsScrolled := aBoolean. |
|
129 |
] |
|
130 |
||
131 |
! |
|
132 |
||
503 | 133 |
spec |
134 |
"return the value of the instance variable 'spec' (automatically generated)" |
|
135 |
||
136 |
^ spec! |
|
137 |
||
138 |
spec:something |
|
139 |
"set the value of the instance variable 'spec' (automatically generated)" |
|
140 |
||
141 |
spec := something. |
|
142 |
self rebuild. |
|
819 | 143 |
! |
144 |
||
145 |
widget |
|
146 |
"ST80 compatibility. |
|
147 |
I am my own widget" |
|
148 |
||
149 |
^ self |
|
150 |
||
151 |
"Created: / 10.3.1998 / 16:20:52 / stefan" |
|
503 | 152 |
! ! |
153 |
||
154 |
!SubCanvas methodsFor:'accessing channels'! |
|
155 |
||
156 |
clientHolder |
|
157 |
^ clientHolder |
|
158 |
! |
|
159 |
||
160 |
clientHolder:aValueHolder |
|
161 |
||
162 |
clientHolder notNil ifTrue:[ |
|
163 |
clientHolder removeDependent:self |
|
164 |
]. |
|
165 |
(clientHolder := aValueHolder) notNil ifTrue:[ |
|
166 |
clientHolder addDependent:self |
|
167 |
]. |
|
557 | 168 |
self updateFromChannels |
503 | 169 |
! |
170 |
||
171 |
specHolder |
|
172 |
^ specHolder |
|
173 |
! |
|
174 |
||
175 |
specHolder:aValueHolder |
|
176 |
||
177 |
specHolder notNil ifTrue:[ |
|
178 |
specHolder removeDependent:self |
|
179 |
]. |
|
180 |
(specHolder := aValueHolder) notNil ifTrue:[ |
|
181 |
specHolder addDependent:self |
|
182 |
]. |
|
557 | 183 |
self updateFromChannels |
503 | 184 |
! ! |
185 |
||
186 |
!SubCanvas methodsFor:'building'! |
|
187 |
||
188 |
rebuild |
|
189 |
"rebuild |
|
190 |
" |
|
1412 | 191 |
|v subSpec savedView builderClass| |
455 | 192 |
|
1412 | 193 |
clientView notNil ifTrue:[ |
194 |
clientView destroySubViews |
|
455 | 195 |
]. |
196 |
||
197 |
spec notNil ifTrue:[ |
|
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
198 |
(subSpec := spec) isSymbol ifTrue:[ |
554 | 199 |
client isNil ifTrue:[ |
1216
c9f8253a9e7c
give a warning with nil client
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
200 |
'SubCanvas [warning]: no client - cannot build spec' infoPrintCR. |
554 | 201 |
^ self |
553 | 202 |
]. |
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
203 |
(subSpec := client class interfaceSpecFor:spec) isNil ifTrue:[ |
1216
c9f8253a9e7c
give a warning with nil client
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
204 |
"/ Transcript showCR:'SubCanvas: nil spec'. |
503 | 205 |
^ self |
206 |
] |
|
207 |
]. |
|
973 | 208 |
|
554 | 209 |
builder isNil ifTrue:[ |
1383 | 210 |
client isNil ifTrue:[ |
211 |
builderClass := UIBuilder |
|
212 |
] ifFalse:[ |
|
213 |
builderClass := client builderClass |
|
214 |
]. |
|
215 |
builder := builderClass new. |
|
554 | 216 |
]. |
973 | 217 |
|
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
218 |
"/ old: |
1412 | 219 |
"/ builder buildFromSpec:subSpec in:clientView. |
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
220 |
|
973 | 221 |
"/ new (let app know (somehow) that this is a build |
222 |
"/ for a subcanvas (i.e. it can redefine the buildSubCanvase-method |
|
223 |
"/: |
|
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
224 |
savedView := builder window. |
1412 | 225 |
builder window:clientView. |
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
226 |
client buildSubCanvas:subSpec withBuilder:builder. |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
227 |
builder window:savedView. |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
228 |
|
1412 | 229 |
clientViewIsScrolled ifTrue:[ |
230 |
clientView |
|
231 |
extent:(builder spec window layout rectangleRelativeTo:self bounds preferred:nil) extent. |
|
232 |
]. |
|
233 |
||
503 | 234 |
self realized ifTrue:[ |
1412 | 235 |
clientView realizeAllSubViews |
503 | 236 |
] |
237 |
] |
|
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
238 |
|
973 | 239 |
"Modified: / 20.6.1998 / 14:29:00 / cg" |
503 | 240 |
! |
241 |
||
242 |
releaseAllComponents |
|
1412 | 243 |
clientView destroySubViews. |
503 | 244 |
builder := nil. |
245 |
spec := nil. |
|
246 |
client := nil. |
|
247 |
! ! |
|
248 |
||
249 |
!SubCanvas methodsFor:'change & update'! |
|
250 |
||
251 |
update:something with:aParameter from:changedObject |
|
252 |
"one of my models changed its value |
|
253 |
" |
|
557 | 254 |
(changedObject == clientHolder or:[changedObject == specHolder]) ifTrue:[ |
255 |
self updateFromChannels |
|
256 |
] ifFalse:[ |
|
257 |
super update:something with:aParameter from:changedObject. |
|
258 |
] |
|
259 |
||
260 |
! |
|
261 |
||
262 |
updateFromChannels |
|
263 |
"update canvas from channel |
|
264 |
" |
|
265 |
|client spec| |
|
266 |
||
267 |
clientHolder isNil ifTrue:[ |
|
268 |
client := self application |
|
269 |
] ifFalse:[ |
|
270 |
client := clientHolder value |
|
554 | 271 |
]. |
503 | 272 |
|
557 | 273 |
specHolder isNil ifTrue:[ |
274 |
spec := #windowSpec |
|
275 |
] ifFalse:[ |
|
276 |
spec := specHolder value |
|
277 |
]. |
|
278 |
(client notNil and:[spec notNil]) ifTrue:[ |
|
279 |
self client:client spec:spec |
|
280 |
] ifFalse:[ |
|
281 |
self client:nil |
|
282 |
] |
|
503 | 283 |
|
284 |
||
285 |
! ! |
|
286 |
||
287 |
!SubCanvas methodsFor:'initialization'! |
|
288 |
||
609 | 289 |
destroy |
290 |
clientHolder notNil ifTrue:[ |
|
291 |
clientHolder removeDependent:self. |
|
292 |
clientHolder := nil. |
|
293 |
]. |
|
294 |
specHolder notNil ifTrue:[ |
|
295 |
specHolder removeDependent:self. |
|
296 |
specHolder := nil. |
|
297 |
]. |
|
298 |
super destroy. |
|
299 |
! |
|
300 |
||
503 | 301 |
initialize |
1412 | 302 |
|
503 | 303 |
super initialize. |
1412 | 304 |
|
305 |
self scrolledView:(clientView := View new). |
|
306 |
clientViewIsScrolled := false. |
|
307 |
||
503 | 308 |
spec := #windowSpec. |
309 |
! ! |
|
310 |
||
311 |
!SubCanvas methodsFor:'queries'! |
|
312 |
||
313 |
application |
|
314 |
"return the application, under which this view was opened, |
|
315 |
" |
|
316 |
||
317 |
client notNil ifTrue:[ |
|
318 |
^ client |
|
455 | 319 |
]. |
503 | 320 |
^ super application |
321 |
||
455 | 322 |
! ! |
323 |
||
324 |
!SubCanvas class methodsFor:'documentation'! |
|
325 |
||
326 |
version |
|
1414
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
327 |
^ '$Header: /cvs/stx/stx/libwidg2/SubCanvas.st,v 1.13 1999-06-17 08:51:17 tm Exp $' |
455 | 328 |
! ! |