author | Claus Gittinger <cg@exept.de> |
Thu, 28 Sep 2000 20:37:23 +0200 | |
changeset 1856 | 8ecbdc69f11e |
parent 1846 | e90341acd040 |
child 1893 | 6456c11a1307 |
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 |
|
1856 | 270 |
"/ if the superView is not yet created, |
271 |
"/ we MUST delay building... (sigh) |
|
1584
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
272 |
superView isNil ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
273 |
lateBuild := true. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
274 |
^ self |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
275 |
]. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
276 |
|
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
277 |
clientView notNil ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
278 |
clientView destroySubViews |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
279 |
]. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
280 |
|
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
281 |
spec notNil ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
282 |
(subSpec := spec) isSymbol ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
283 |
client isNil ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
284 |
'SubCanvas [warning]: no client - cannot build spec' infoPrintCR. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
285 |
^ self |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
286 |
]. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
287 |
(subSpec := client class interfaceSpecFor:spec) isNil ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
288 |
"/ Transcript showCR:'SubCanvas: nil spec'. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
289 |
^ self |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
290 |
] |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
291 |
]. |
1662 | 292 |
subSpec isArray ifTrue:[ |
293 |
subSpec := subSpec decodeAsLiteralArray |
|
294 |
]. |
|
1584
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
295 |
|
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
296 |
builder isNil ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
297 |
client isNil ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
298 |
builderClass := UIBuilder |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
299 |
] ifFalse:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
300 |
builderClass := client builderClass |
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 |
builder := builderClass new. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
303 |
]. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
304 |
|
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
305 |
"/ old: |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
306 |
"/ builder buildFromSpec:subSpec in:clientView. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
307 |
|
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
308 |
"/ 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
|
309 |
"/ 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
|
310 |
|
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
311 |
savedView := builder window. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
312 |
builder window:clientView. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
313 |
[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
314 |
client buildSubCanvas:subSpec withBuilder:builder. |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
315 |
] valueNowOrOnUnwindDo:[ |
1662 | 316 |
savedView notNil ifTrue:[ |
317 |
builder window:savedView. |
|
318 |
] |
|
1584
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
319 |
]. |
1664 | 320 |
clientViewIsScrolled ifTrue:[ |
1584
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
321 |
clientView extent:((subSpec window layout) ? (subSpec window bounds)) extent. |
1664 | 322 |
]. |
1584
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
323 |
|
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
324 |
self realized ifTrue:[ |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
325 |
clientView realizeAllSubViews |
1662 | 326 |
]. |
1584
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
327 |
] |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
328 |
|
1662 | 329 |
"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
|
330 |
! |
f020416e00ae
LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents:
1577
diff
changeset
|
331 |
|
503 | 332 |
releaseAllComponents |
1412 | 333 |
clientView destroySubViews. |
503 | 334 |
builder := nil. |
335 |
spec := nil. |
|
336 |
client := nil. |
|
1662 | 337 |
|
338 |
"Modified: / 31.1.2000 / 16:56:14 / cg" |
|
503 | 339 |
! ! |
340 |
||
341 |
!SubCanvas methodsFor:'change & update'! |
|
342 |
||
343 |
update:something with:aParameter from:changedObject |
|
344 |
"one of my models changed its value |
|
345 |
" |
|
557 | 346 |
(changedObject == clientHolder or:[changedObject == specHolder]) ifTrue:[ |
347 |
self updateFromChannels |
|
348 |
] ifFalse:[ |
|
349 |
super update:something with:aParameter from:changedObject. |
|
350 |
] |
|
351 |
||
352 |
! |
|
353 |
||
354 |
updateFromChannels |
|
355 |
"update canvas from channel |
|
356 |
" |
|
357 |
|client spec| |
|
358 |
||
359 |
clientHolder isNil ifTrue:[ |
|
360 |
client := self application |
|
361 |
] ifFalse:[ |
|
362 |
client := clientHolder value |
|
554 | 363 |
]. |
503 | 364 |
|
557 | 365 |
specHolder isNil ifTrue:[ |
366 |
spec := #windowSpec |
|
367 |
] ifFalse:[ |
|
368 |
spec := specHolder value |
|
369 |
]. |
|
370 |
(client notNil and:[spec notNil]) ifTrue:[ |
|
371 |
self client:client spec:spec |
|
372 |
] ifFalse:[ |
|
1467 | 373 |
"/ spec notNil ifTrue:[ |
374 |
"/ self halt:'spec but no app'. |
|
375 |
"/ ]. |
|
557 | 376 |
self client:nil |
377 |
] |
|
503 | 378 |
|
1467 | 379 |
"Modified: / 5.8.1999 / 13:35:26 / cg" |
503 | 380 |
! ! |
381 |
||
382 |
!SubCanvas methodsFor:'initialization'! |
|
383 |
||
609 | 384 |
destroy |
1471
09a5803325e4
when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
385 |
client notNil ifTrue:[ |
1702 | 386 |
client == self application ifTrue:[ |
387 |
client releaseAsSubCanvas. |
|
388 |
] ifFalse:[ |
|
389 |
client release |
|
390 |
]. |
|
1471
09a5803325e4
when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
391 |
]. |
09a5803325e4
when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
392 |
|
609 | 393 |
clientHolder notNil ifTrue:[ |
394 |
clientHolder removeDependent:self. |
|
395 |
clientHolder := nil. |
|
396 |
]. |
|
397 |
specHolder notNil ifTrue:[ |
|
398 |
specHolder removeDependent:self. |
|
399 |
specHolder := nil. |
|
400 |
]. |
|
401 |
super destroy. |
|
1702 | 402 |
|
403 |
"Modified: / 13.2.2000 / 23:31:12 / cg" |
|
609 | 404 |
! |
405 |
||
503 | 406 |
initialize |
1412 | 407 |
|
503 | 408 |
super initialize. |
1412 | 409 |
self scrolledView:(clientView := View new). |
410 |
clientViewIsScrolled := false. |
|
411 |
||
503 | 412 |
spec := #windowSpec. |
1662 | 413 |
|
414 |
"Modified: / 31.1.2000 / 16:56:31 / cg" |
|
503 | 415 |
! ! |
416 |
||
1720
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
417 |
!SubCanvas methodsFor:'layout'! |
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
418 |
|
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
419 |
usedScrolledViewHMarginWhenHasV:hasV andHasH:hasH |
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
420 |
"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
|
421 |
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
|
422 |
|
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
423 |
^ (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
|
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 |
! |
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
427 |
|
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
428 |
usedScrolledViewVMarginWhenHasV:hasV andHasH:hasH |
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
429 |
"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
|
430 |
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
|
431 |
|
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
432 |
^ (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
|
433 |
|
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
434 |
|
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
435 |
! ! |
d855968ce342
redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
436 |
|
503 | 437 |
!SubCanvas methodsFor:'queries'! |
438 |
||
439 |
application |
|
440 |
"return the application, under which this view was opened, |
|
441 |
" |
|
442 |
||
443 |
client notNil ifTrue:[ |
|
444 |
^ client |
|
455 | 445 |
]. |
503 | 446 |
^ super application |
447 |
||
455 | 448 |
! ! |
449 |
||
450 |
!SubCanvas class methodsFor:'documentation'! |
|
451 |
||
452 |
version |
|
1856 | 453 |
^ '$Header: /cvs/stx/stx/libwidg2/SubCanvas.st,v 1.28 2000-09-28 18:37:23 cg Exp $' |
455 | 454 |
! ! |