author | Claus Gittinger <cg@exept.de> |
Tue, 19 Sep 2000 13:47:17 +0200 | |
changeset 1846 | e90341acd040 |
parent 1818 | fe99c5c721e9 |
child 1856 | 8ecbdc69f11e |
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 |
|
1818 | 14 |
"{ Package: 'stx:libwidg2' }" |
15 |
||
455 | 16 |
ScrollableView subclass:#SubCanvas |
1412 | 17 |
instanceVariableNames:'builder spec client clientHolder specHolder clientView |
1548
299e14135d2d
Late building if subcanvas does not have a superView. (cg)
Stefan Vogel <sv@exept.de>
parents:
1546
diff
changeset
|
18 |
clientViewIsScrolled lateBuild' |
455 | 19 |
classVariableNames:'' |
20 |
poolDictionaries:'' |
|
21 |
category:'Views-Basic' |
|
22 |
! |
|
23 |
||
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
24 |
!SubCanvas class methodsFor:'documentation'! |
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 |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
27 |
" |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
28 |
COPYRIGHT (c) 1998 by eXept Software AG |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
29 |
All Rights Reserved |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
30 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
31 |
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
|
32 |
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
|
33 |
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
|
34 |
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
|
35 |
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
|
36 |
hereby transferred. |
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 |
! |
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 |
documentation |
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 |
a view for a subApplication. |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
44 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
45 |
[author:] |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
46 |
Claus Atzkern |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
47 |
" |
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
48 |
|
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
49 |
! ! |
455 | 50 |
|
1414
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
51 |
!SubCanvas class methodsFor:'defaults'! |
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
52 |
|
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
53 |
defaultHorizontalScrollable |
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
54 |
^ false |
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 |
! |
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
58 |
|
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
59 |
defaultVerticalScrollable |
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
60 |
^ false |
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 |
|
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
63 |
! ! |
faf0465c333b
defaults for hasHVScrollbar now defined in a class method.
tm
parents:
1412
diff
changeset
|
64 |
|
455 | 65 |
!SubCanvas methodsFor:'accessing'! |
66 |
||
503 | 67 |
builder |
68 |
"return the value of the instance variable 'builder' (automatically generated)" |
|
455 | 69 |
|
503 | 70 |
^ builder! |
455 | 71 |
|
503 | 72 |
client |
73 |
"return the value of the instance variable 'client' (automatically generated)" |
|
455 | 74 |
|
503 | 75 |
^ client! |
455 | 76 |
|
503 | 77 |
client:anApplication spec:aWindowSpecOrSpecSymbol builder:aBuilder |
455 | 78 |
"release existing components and generate new components from |
79 |
the given windowSpec, using the given builder." |
|
80 |
||
1471
09a5803325e4
when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
81 |
|myApp| |
09a5803325e4
when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
82 |
|
1686 | 83 |
(client notNil and:[client ~~ anApplication]) ifTrue:[ |
84 |
client releaseAsSubCanvas. |
|
85 |
client := nil. |
|
86 |
]. |
|
87 |
||
1546
452132649648
Moved #client: and #client:spec: to SimpleView.
Stefan Vogel <sv@exept.de>
parents:
1471
diff
changeset
|
88 |
(builder := aBuilder) isNil ifTrue:[ |
1846 | 89 |
builder := anApplication perform:#builder ifNotUnderstood:[UIBuilder new] |
1546
452132649648
Moved #client: and #client:spec: to SimpleView.
Stefan Vogel <sv@exept.de>
parents:
1471
diff
changeset
|
90 |
]. |
452132649648
Moved #client: and #client:spec: to SimpleView.
Stefan Vogel <sv@exept.de>
parents:
1471
diff
changeset
|
91 |
|
452132649648
Moved #client: and #client:spec: to SimpleView.
Stefan Vogel <sv@exept.de>
parents:
1471
diff
changeset
|
92 |
spec := aWindowSpecOrSpecSymbol. |
503 | 93 |
|
94 |
"/ check for master application |
|
95 |
(anApplication notNil and:[anApplication masterApplication isNil]) ifTrue:[ |
|
1471
09a5803325e4
when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
96 |
myApp := self application. |
09a5803325e4
when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
97 |
myApp ~~ anApplication ifTrue:[ |
09a5803325e4
when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
98 |
anApplication masterApplication:myApp |
503 | 99 |
] |
100 |
]. |
|
1471
09a5803325e4
when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
101 |
|
503 | 102 |
client := anApplication. |
103 |
self rebuild. |
|
1471
09a5803325e4
when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
104 |
^ builder |
503 | 105 |
! |
106 |
||
1412 | 107 |
makeClientViewScrollable:aBoolean |
108 |
|vs| |
|
109 |
||
110 |
aBoolean ~~ clientViewIsScrolled ifTrue:[ |
|
1662 | 111 |
clientView isNil ifTrue:[ |
112 |
clientView := View new. |
|
113 |
]. |
|
1412 | 114 |
aBoolean ifTrue:[ |
115 |
self scrolledView:(vs := ViewScroller new). |
|
116 |
vs scrolledView:clientView. |
|
117 |
] ifFalse:[ |
|
118 |
self scrolledView:clientView. |
|
119 |
]. |
|
120 |
clientViewIsScrolled := aBoolean. |
|
121 |
] |
|
122 |
||
1662 | 123 |
"Modified: / 30.1.2000 / 21:36:29 / cg" |
1412 | 124 |
! |
125 |
||
1450 | 126 |
setClient:anApplicationModel |
127 |
"set the client - do NOT rebuild" |
|
128 |
||
129 |
client := anApplicationModel |
|
130 |
! |
|
131 |
||
503 | 132 |
spec |
133 |
"return the value of the instance variable 'spec' (automatically generated)" |
|
134 |
||
135 |
^ spec! |
|
136 |
||
137 |
spec:something |
|
138 |
"set the value of the instance variable 'spec' (automatically generated)" |
|
139 |
||
140 |
spec := something. |
|
141 |
self rebuild. |
|
819 | 142 |
! |
143 |
||
144 |
widget |
|
145 |
"ST80 compatibility. |
|
146 |
I am my own widget" |
|
147 |
||
148 |
^ self |
|
149 |
||
150 |
"Created: / 10.3.1998 / 16:20:52 / stefan" |
|
503 | 151 |
! ! |
152 |
||
1818 | 153 |
!SubCanvas methodsFor:'accessing-channels'! |
503 | 154 |
|
155 |
clientHolder |
|
156 |
^ clientHolder |
|
157 |
! |
|
158 |
||
159 |
clientHolder:aValueHolder |
|
160 |
||
161 |
clientHolder notNil ifTrue:[ |
|
162 |
clientHolder removeDependent:self |
|
163 |
]. |
|
164 |
(clientHolder := aValueHolder) notNil ifTrue:[ |
|
165 |
clientHolder addDependent:self |
|
166 |
]. |
|
557 | 167 |
self updateFromChannels |
503 | 168 |
! |
169 |
||
170 |
specHolder |
|
171 |
^ specHolder |
|
172 |
! |
|
173 |
||
174 |
specHolder:aValueHolder |
|
175 |
||
176 |
specHolder notNil ifTrue:[ |
|
177 |
specHolder removeDependent:self |
|
178 |
]. |
|
179 |
(specHolder := aValueHolder) notNil ifTrue:[ |
|
180 |
specHolder addDependent:self |
|
181 |
]. |
|
557 | 182 |
self updateFromChannels |
503 | 183 |
! ! |
184 |
||
185 |
!SubCanvas methodsFor:'building'! |
|
186 |
||
1584
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
187 |
XXrebuild |
503 | 188 |
"rebuild |
189 |
" |
|
1577 | 190 |
|v subSpec savedView builderClass boundsOrLayout| |
455 | 191 |
|
1548
299e14135d2d
Late building if subcanvas does not have a superView. (cg)
Stefan Vogel <sv@exept.de>
parents:
1546
diff
changeset
|
192 |
superView isNil ifTrue:[ |
299e14135d2d
Late building if subcanvas does not have a superView. (cg)
Stefan Vogel <sv@exept.de>
parents:
1546
diff
changeset
|
193 |
lateBuild := true. |
299e14135d2d
Late building if subcanvas does not have a superView. (cg)
Stefan Vogel <sv@exept.de>
parents:
1546
diff
changeset
|
194 |
^ self |
299e14135d2d
Late building if subcanvas does not have a superView. (cg)
Stefan Vogel <sv@exept.de>
parents:
1546
diff
changeset
|
195 |
]. |
299e14135d2d
Late building if subcanvas does not have a superView. (cg)
Stefan Vogel <sv@exept.de>
parents:
1546
diff
changeset
|
196 |
|
1412 | 197 |
clientView notNil ifTrue:[ |
198 |
clientView destroySubViews |
|
455 | 199 |
]. |
200 |
||
201 |
spec notNil ifTrue:[ |
|
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
202 |
(subSpec := spec) isSymbol ifTrue:[ |
554 | 203 |
client isNil ifTrue:[ |
1216
c9f8253a9e7c
give a warning with nil client
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
204 |
'SubCanvas [warning]: no client - cannot build spec' infoPrintCR. |
554 | 205 |
^ self |
553 | 206 |
]. |
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
207 |
(subSpec := client class interfaceSpecFor:spec) isNil ifTrue:[ |
1216
c9f8253a9e7c
give a warning with nil client
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
208 |
"/ Transcript showCR:'SubCanvas: nil spec'. |
503 | 209 |
^ self |
210 |
] |
|
211 |
]. |
|
973 | 212 |
|
554 | 213 |
builder isNil ifTrue:[ |
1383 | 214 |
client isNil ifTrue:[ |
215 |
builderClass := UIBuilder |
|
216 |
] ifFalse:[ |
|
217 |
builderClass := client builderClass |
|
218 |
]. |
|
219 |
builder := builderClass new. |
|
554 | 220 |
]. |
973 | 221 |
|
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
222 |
"/ old: |
1412 | 223 |
"/ builder buildFromSpec:subSpec in:clientView. |
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
224 |
|
973 | 225 |
"/ new (let app know (somehow) that this is a build |
226 |
"/ for a subcanvas (i.e. it can redefine the buildSubCanvase-method |
|
227 |
"/: |
|
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
228 |
savedView := builder window. |
1412 | 229 |
builder window:clientView. |
1450 | 230 |
[ |
231 |
client buildSubCanvas:subSpec withBuilder:builder. |
|
232 |
] valueNowOrOnUnwindDo:[ |
|
233 |
builder window:savedView. |
|
234 |
]. |
|
1412 | 235 |
clientViewIsScrolled ifTrue:[ |
1577 | 236 |
boundsOrLayout := builder spec window layout. |
237 |
boundsOrLayout isNil ifTrue:[ |
|
238 |
boundsOrLayout := builder spec window bounds |
|
239 |
]. |
|
1412 | 240 |
clientView |
1577 | 241 |
extent:(boundsOrLayout rectangleRelativeTo:self bounds preferred:nil) extent. |
1412 | 242 |
]. |
243 |
||
503 | 244 |
self realized ifTrue:[ |
1412 | 245 |
clientView realizeAllSubViews |
503 | 246 |
] |
247 |
] |
|
970
8cbadf2b9825
also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
248 |
|
973 | 249 |
"Modified: / 20.6.1998 / 14:29:00 / cg" |
503 | 250 |
! |
251 |
||
1584
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
252 |
container:aView |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
253 |
super container:aView. |
1846 | 254 |
|
255 |
"/ my builder can only build the components, when I have a container |
|
256 |
"/ lateBuild is set, if the spec was set some time ago, when I had no container |
|
257 |
"/ Now, we know where to build the GUI ... |
|
258 |
"/ ... and must hurry up to create the widgets. |
|
1584
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
259 |
lateBuild == true ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
260 |
lateBuild := false. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
261 |
self rebuild |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
262 |
]. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
263 |
! |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
264 |
|
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
265 |
rebuild |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
266 |
"rebuild |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
267 |
" |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
268 |
|v subSpec savedView builderClass| |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
269 |
|
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
270 |
superView isNil ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
271 |
lateBuild := true. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
272 |
^ self |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
273 |
]. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
274 |
|
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
275 |
clientView notNil ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
276 |
clientView destroySubViews |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
277 |
]. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
278 |
|
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
279 |
spec notNil ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
280 |
(subSpec := spec) isSymbol ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
281 |
client isNil ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
282 |
'SubCanvas [warning]: no client - cannot build spec' infoPrintCR. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
283 |
^ self |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
284 |
]. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
285 |
(subSpec := client class interfaceSpecFor:spec) isNil ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
286 |
"/ Transcript showCR:'SubCanvas: nil spec'. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
287 |
^ self |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
288 |
] |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
289 |
]. |
1662 | 290 |
subSpec isArray ifTrue:[ |
291 |
subSpec := subSpec decodeAsLiteralArray |
|
292 |
]. |
|
1584
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
293 |
|
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
294 |
builder isNil ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
295 |
client isNil ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
296 |
builderClass := UIBuilder |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
297 |
] ifFalse:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
298 |
builderClass := client builderClass |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
299 |
]. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
300 |
builder := builderClass new. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
301 |
]. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
302 |
|
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
303 |
"/ old: |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
304 |
"/ builder buildFromSpec:subSpec in:clientView. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
305 |
|
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
306 |
"/ new (let app know (somehow) that this is a build |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
307 |
"/ for a subcanvas (i.e. it can redefine the buildSubCanvas-method): |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
308 |
|
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
309 |
savedView := builder window. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
310 |
builder window:clientView. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
311 |
[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
312 |
client buildSubCanvas:subSpec withBuilder:builder. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
313 |
] valueNowOrOnUnwindDo:[ |
1662 | 314 |
savedView notNil ifTrue:[ |
315 |
builder window:savedView. |
|
316 |
] |
|
1584
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
317 |
]. |
1664 | 318 |
clientViewIsScrolled ifTrue:[ |
1584
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
319 |
clientView extent:((subSpec window layout) ? (subSpec window bounds)) extent. |
1664 | 320 |
]. |
1584
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
321 |
|
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
322 |
self realized ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
323 |
clientView realizeAllSubViews |
1662 | 324 |
]. |
1584
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
325 |
] |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
326 |
|
1662 | 327 |
"Modified: / 30.1.2000 / 21:36:40 / cg" |
1584
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
328 |
! |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
329 |
|
503 | 330 |
releaseAllComponents |
1412 | 331 |
clientView destroySubViews. |
503 | 332 |
builder := nil. |
333 |
spec := nil. |
|
334 |
client := nil. |
|
1662 | 335 |
|
336 |
"Modified: / 31.1.2000 / 16:56:14 / cg" |
|
503 | 337 |
! ! |
338 |
||
339 |
!SubCanvas methodsFor:'change & update'! |
|
340 |
||
341 |
update:something with:aParameter from:changedObject |
|
342 |
"one of my models changed its value |
|
343 |
" |
|
557 | 344 |
(changedObject == clientHolder or:[changedObject == specHolder]) ifTrue:[ |
345 |
self updateFromChannels |
|
346 |
] ifFalse:[ |
|
347 |
super update:something with:aParameter from:changedObject. |
|
348 |
] |
|
349 |
||
350 |
! |
|
351 |
||
352 |
updateFromChannels |
|
353 |
"update canvas from channel |
|
354 |
" |
|
355 |
|client spec| |
|
356 |
||
357 |
clientHolder isNil ifTrue:[ |
|
358 |
client := self application |
|
359 |
] ifFalse:[ |
|
360 |
client := clientHolder value |
|
554 | 361 |
]. |
503 | 362 |
|
557 | 363 |
specHolder isNil ifTrue:[ |
364 |
spec := #windowSpec |
|
365 |
] ifFalse:[ |
|
366 |
spec := specHolder value |
|
367 |
]. |
|
368 |
(client notNil and:[spec notNil]) ifTrue:[ |
|
369 |
self client:client spec:spec |
|
370 |
] ifFalse:[ |
|
1467 | 371 |
"/ spec notNil ifTrue:[ |
372 |
"/ self halt:'spec but no app'. |
|
373 |
"/ ]. |
|
557 | 374 |
self client:nil |
375 |
] |
|
503 | 376 |
|
1467 | 377 |
"Modified: / 5.8.1999 / 13:35:26 / cg" |
503 | 378 |
! ! |
379 |
||
380 |
!SubCanvas methodsFor:'initialization'! |
|
381 |
||
609 | 382 |
destroy |
1471
09a5803325e4
when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
383 |
client notNil ifTrue:[ |
1702 | 384 |
client == self application ifTrue:[ |
385 |
client releaseAsSubCanvas. |
|
386 |
] ifFalse:[ |
|
387 |
client release |
|
388 |
]. |
|
1471
09a5803325e4
when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
389 |
]. |
09a5803325e4
when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
390 |
|
609 | 391 |
clientHolder notNil ifTrue:[ |
392 |
clientHolder removeDependent:self. |
|
393 |
clientHolder := nil. |
|
394 |
]. |
|
395 |
specHolder notNil ifTrue:[ |
|
396 |
specHolder removeDependent:self. |
|
397 |
specHolder := nil. |
|
398 |
]. |
|
399 |
super destroy. |
|
1702 | 400 |
|
401 |
"Modified: / 13.2.2000 / 23:31:12 / cg" |
|
609 | 402 |
! |
403 |
||
503 | 404 |
initialize |
1412 | 405 |
|
503 | 406 |
super initialize. |
1412 | 407 |
self scrolledView:(clientView := View new). |
408 |
clientViewIsScrolled := false. |
|
409 |
||
503 | 410 |
spec := #windowSpec. |
1662 | 411 |
|
412 |
"Modified: / 31.1.2000 / 16:56:31 / cg" |
|
503 | 413 |
! ! |
414 |
||
1720
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
415 |
!SubCanvas methodsFor:'layout'! |
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
416 |
|
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
417 |
usedScrolledViewHMarginWhenHasV:hasV andHasH:hasH |
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
418 |
"return the horizontal margin around (outer margin). |
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
419 |
Redefined to avoid margin when no scrollers are present" |
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
420 |
|
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
421 |
^ (hasV or:[hasH]) ifTrue:[scrolledViewHMargin] ifFalse:[0] |
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
422 |
|
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
423 |
|
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
424 |
! |
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
425 |
|
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
426 |
usedScrolledViewVMarginWhenHasV:hasV andHasH:hasH |
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
427 |
"return the horizontal margin around (outer margin). |
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
428 |
Redefined to avoid margin when no scrollers are present" |
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
429 |
|
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
430 |
^ (hasV or:[hasH]) ifTrue:[scrolledViewVMargin] ifFalse:[0] |
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
431 |
|
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
432 |
|
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
433 |
! ! |
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
434 |
|
503 | 435 |
!SubCanvas methodsFor:'queries'! |
436 |
||
437 |
application |
|
438 |
"return the application, under which this view was opened, |
|
439 |
" |
|
440 |
||
441 |
client notNil ifTrue:[ |
|
442 |
^ client |
|
455 | 443 |
]. |
503 | 444 |
^ super application |
445 |
||
455 | 446 |
! ! |
447 |
||
448 |
!SubCanvas class methodsFor:'documentation'! |
|
449 |
||
450 |
version |
|
1846 | 451 |
^ '$Header: /cvs/stx/stx/libwidg2/SubCanvas.st,v 1.27 2000-09-19 11:47:17 cg Exp $' |
455 | 452 |
! ! |