author | ca |
Tue, 20 May 1997 09:08:02 +0200 | |
changeset 578 | 7e0f62d9bc47 |
parent 577 | 818d08c9aef1 |
child 586 | 8889c3e9a226 |
permissions | -rw-r--r-- |
89 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
434 | 3 |
All Rights Reserved |
89 | 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 |
" |
|
12 |
||
100 | 13 |
Object subclass:#WindowBuilder |
480 | 14 |
instanceVariableNames:'window windowView application bindings visuals focusSequence |
15 |
namedComponents componentCreationHook applicationClass |
|
502 | 16 |
keyboardProcessor subCanvasSpecs' |
436 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
19 |
category:'Interface-Support-UI' |
|
66 | 20 |
! |
21 |
||
22 |
!WindowBuilder class methodsFor:'documentation'! |
|
23 |
||
89 | 24 |
copyright |
25 |
" |
|
26 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
434 | 27 |
All Rights Reserved |
89 | 28 |
|
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
66 | 38 |
documentation |
39 |
" |
|
69 | 40 |
a no-op class, for systems which do not use the UIBuilder. |
66 | 41 |
Concrete subclasses know how to create a view (with components) from |
42 |
some interface spec. Currently, an experimantal version of UIBuilder exists, |
|
43 |
and more may be added in the future (for example, to parse different UI |
|
44 |
specs - thinking of motifs UIL specs etc). |
|
223 | 45 |
|
46 |
[author:] |
|
47 |
Claus Gittinger |
|
66 | 48 |
" |
49 |
! ! |
|
50 |
||
51 |
!WindowBuilder methodsFor:'accessing'! |
|
52 |
||
463 | 53 |
addBindings:moreBindings |
54 |
"used with subDialogs, which provide local bindings. |
|
55 |
All bindings from moreBindings overwrite any local bindings." |
|
56 |
||
57 |
moreBindings notNil ifTrue:[ |
|
58 |
moreBindings keysAndValuesDo:[:aKey :aValue | |
|
59 |
bindings at:aKey put:aValue |
|
60 |
] |
|
61 |
] |
|
62 |
||
63 |
"Created: 28.2.1997 / 14:14:33 / cg" |
|
64 |
! |
|
65 |
||
100 | 66 |
application |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
67 |
"return the application (an ApplicationModel), |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
68 |
for which the view is built. |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
69 |
This one is supposed to provide the aspects, menus etc." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
70 |
|
100 | 71 |
^ application |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
72 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
73 |
"Modified: 17.1.1997 / 19:04:40 / cg" |
66 | 74 |
! |
75 |
||
125 | 76 |
application:anApplicationModel |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
77 |
"set the application (an ApplicationModel), |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
78 |
for which the view is built. |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
79 |
This one is supposed to provide the aspects, menus etc." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
80 |
|
125 | 81 |
application := anApplicationModel |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
82 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
83 |
"Modified: 17.1.1997 / 19:04:47 / cg" |
66 | 84 |
! |
85 |
||
422 | 86 |
applicationClass:something |
87 |
"set the value of the instance variable 'applicationClass' (automatically generated)" |
|
88 |
||
89 |
applicationClass := something.! |
|
90 |
||
66 | 91 |
aspectAt:aSymbol |
433 | 92 |
|b| |
93 |
||
473 | 94 |
aSymbol notNil ifTrue:[ |
95 |
bindings notNil ifTrue:[ |
|
96 |
b := bindings at:aSymbol ifAbsent:nil. |
|
97 |
b notNil ifTrue:[^ b]. |
|
98 |
]. |
|
434 | 99 |
|
473 | 100 |
application notNil ifTrue:[ |
577 | 101 |
Object messageNotUnderstoodSignal handle:[:ex | |
102 |
Transcript showCR:'not understood: ' , aSymbol. |
|
103 |
] do:[ |
|
473 | 104 |
^ application aspectFor:aSymbol |
105 |
] |
|
450 | 106 |
] |
433 | 107 |
]. |
108 |
^ nil |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
109 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
110 |
"Modified: 17.1.1997 / 19:28:32 / cg" |
66 | 111 |
! |
112 |
||
125 | 113 |
aspectAt:aSymbol put:aModel |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
114 |
bindings isNil ifTrue:[ |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
115 |
bindings := IdentityDictionary new |
125 | 116 |
]. |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
117 |
^ bindings at:aSymbol put:aModel |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
118 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
119 |
"Modified: 17.1.1997 / 19:28:37 / cg" |
100 | 120 |
! |
121 |
||
450 | 122 |
bindingAt:aSymbol |
123 |
bindings notNil ifTrue:[ |
|
124 |
^ bindings at:aSymbol ifAbsent:nil. |
|
125 |
]. |
|
126 |
^ nil |
|
127 |
! |
|
128 |
||
100 | 129 |
bindings |
130 |
^ bindings |
|
131 |
! |
|
132 |
||
133 |
bindings:aDictionary |
|
134 |
bindings := aDictionary |
|
135 |
! |
|
136 |
||
125 | 137 |
componentAt:name |
450 | 138 |
namedComponents isNil ifTrue:[^ nil]. |
139 |
^ namedComponents at:name asSymbol ifAbsent:nil |
|
125 | 140 |
! |
141 |
||
100 | 142 |
componentAt:name put:aComponent |
450 | 143 |
namedComponents isNil ifTrue:[ |
144 |
namedComponents := IdentityDictionary new. |
|
100 | 145 |
]. |
450 | 146 |
namedComponents at:name asSymbol put:aComponent |
100 | 147 |
! |
148 |
||
410 | 149 |
componentCreationHook:something |
150 |
"set the value of the instance variable 'componentCreationHook' (automatically generated)" |
|
151 |
||
152 |
componentCreationHook := something.! |
|
153 |
||
125 | 154 |
focusSequence |
155 |
^ focusSequence |
|
66 | 156 |
! |
157 |
||
477 | 158 |
keyboardProcessor |
159 |
keyboardProcessor isNil ifTrue:[ |
|
160 |
keyboardProcessor := KeyboardProcessor new |
|
161 |
]. |
|
162 |
^ keyboardProcessor |
|
163 |
||
164 |
"Created: 3.3.1997 / 18:31:37 / cg" |
|
165 |
"Modified: 3.3.1997 / 18:32:27 / cg" |
|
166 |
! |
|
167 |
||
86 | 168 |
namedComponents |
450 | 169 |
^ namedComponents |
86 | 170 |
! |
171 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
172 |
source |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
173 |
"same as #application, for ST-80 compatibility" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
174 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
175 |
^ application |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
176 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
177 |
"Created: 17.1.1997 / 19:03:51 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
178 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
179 |
|
125 | 180 |
source:anApplicationModel |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
181 |
"same as #application:, for ST-80 compatibility" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
182 |
|
125 | 183 |
application := anApplicationModel |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
184 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
185 |
"Modified: 17.1.1997 / 19:03:57 / cg" |
125 | 186 |
! |
187 |
||
502 | 188 |
subCanvasAt:majorKey at:minorKey |
189 |
|majorDict spec cls k| |
|
190 |
||
191 |
k := majorKey ? #NoMajorKey. |
|
192 |
subCanvasSpecs notNil ifTrue:[ |
|
193 |
majorDict := subCanvasSpecs at:k ifAbsent:nil. |
|
194 |
majorDict notNil ifTrue:[ |
|
195 |
spec := majorDict at:minorKey ifAbsent:nil. |
|
196 |
spec notNil ifTrue:[^ spec]. |
|
197 |
]. |
|
198 |
]. |
|
199 |
majorKey isNil ifTrue:[ |
|
200 |
"/ I provide the spec |
|
201 |
application isNil ifTrue:[ |
|
202 |
^ nil |
|
203 |
]. |
|
204 |
spec := application specificationFor:minorKey |
|
205 |
] ifFalse:[ |
|
206 |
cls := Smalltalk at:majorKey ifAbsent:nil. |
|
207 |
cls notNil ifTrue:[ |
|
208 |
spec := cls perform:minorKey |
|
209 |
] |
|
210 |
]. |
|
211 |
^ spec |
|
212 |
! |
|
213 |
||
214 |
subCanvasAt:majorKey at:minorKey put:aSpec |
|
215 |
|dict key| |
|
216 |
||
217 |
key := majorKey ? #NoMajorKey. |
|
218 |
dict := subCanvasSpecs at:key ifAbsent:nil. |
|
219 |
dict isNil ifTrue:[ |
|
220 |
dict := IdentityDictionary new. |
|
221 |
subCanvasSpecs at:key put:dict |
|
222 |
]. |
|
223 |
dict at:minorKey put:aSpec |
|
224 |
||
225 |
! |
|
226 |
||
475
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
227 |
visualAt:name |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
228 |
visuals isNil ifTrue:[^ nil]. |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
229 |
^ visuals at:name asSymbol ifAbsent:nil |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
230 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
231 |
"Created: 3.3.1997 / 16:24:17 / cg" |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
232 |
! |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
233 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
234 |
visualAt:name put:aVisual |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
235 |
visuals isNil ifTrue:[ |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
236 |
visuals := IdentityDictionary new. |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
237 |
]. |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
238 |
visuals at:name asSymbol put:aVisual |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
239 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
240 |
"Created: 3.3.1997 / 16:24:41 / cg" |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
241 |
! |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
242 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
243 |
visuals |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
244 |
^ visuals |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
245 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
246 |
"Created: 3.3.1997 / 16:24:00 / cg" |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
247 |
! |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
248 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
249 |
visuals:aDictionary |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
250 |
visuals := aDictionary |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
251 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
252 |
"Created: 3.3.1997 / 16:24:06 / cg" |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
253 |
! |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
254 |
|
125 | 255 |
window |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
256 |
"return the top window (view), for which an interface |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
257 |
is (being) built" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
258 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
259 |
^ window |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
260 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
261 |
"Modified: 17.1.1997 / 19:30:00 / cg" |
125 | 262 |
! |
263 |
||
264 |
window:aView |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
265 |
"set the top window (view), for which an interface |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
266 |
is (being) built" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
267 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
268 |
window := aView |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
269 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
270 |
"Modified: 17.1.1997 / 19:30:22 / cg" |
66 | 271 |
! |
272 |
||
273 |
windowGroup |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
274 |
self halt. |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
275 |
^ window windowGroup |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
276 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
277 |
"Modified: 17.1.1997 / 19:30:26 / cg" |
66 | 278 |
! ! |
279 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
280 |
!WindowBuilder methodsFor:'building'! |
66 | 281 |
|
125 | 282 |
buildFromSpec:aSpec |
176 | 283 |
^ self subclassResponsibility |
408 | 284 |
! |
285 |
||
286 |
makeTabable:aComponent |
|
287 |
focusSequence isNil ifTrue:[ |
|
288 |
focusSequence := OrderedCollection new. |
|
289 |
]. |
|
290 |
focusSequence add:aComponent |
|
66 | 291 |
! ! |
100 | 292 |
|
422 | 293 |
!WindowBuilder methodsFor:'spec creation aspect fetch'! |
100 | 294 |
|
374 | 295 |
actionFor:aKey |
450 | 296 |
"return an action for aKey. This is invoked during window building |
297 |
(by the builder) to ask for an ActionButtons actionBlock. |
|
298 |
Here, first the local bindings are searched, then the application and |
|
299 |
finally the applications class is asked for a corresponding action. |
|
300 |
The returned object is typically a block." |
|
301 |
||
434 | 302 |
|b| |
303 |
||
304 |
bindings notNil ifTrue:[ |
|
305 |
b := bindings at:aKey ifAbsent:nil. |
|
306 |
b notNil ifTrue:[^ b]. |
|
307 |
]. |
|
308 |
||
374 | 309 |
application notNil ifTrue:[ |
577 | 310 |
Object messageNotUnderstoodSignal handle:[:ex | |
311 |
Transcript showCR:'not understood: ' , aKey. |
|
312 |
] do:[ |
|
450 | 313 |
^ application actionFor:aKey |
314 |
] |
|
374 | 315 |
]. |
422 | 316 |
applicationClass notNil ifTrue:[ |
424 | 317 |
(applicationClass respondsTo:#actionFor:) ifTrue:[ |
318 |
^ applicationClass actionFor:aKey |
|
319 |
] |
|
422 | 320 |
]. |
321 |
^ [] |
|
374 | 322 |
|
323 |
"Created: 17.1.1997 / 21:08:22 / cg" |
|
324 |
! |
|
325 |
||
326 |
aspectFor:aKey |
|
450 | 327 |
"return a model for aKey. This is invoked during window building |
328 |
(by the builder) to ask for an Editfields, a Toggles etc. model. |
|
329 |
Here, first the local bindings are searched, then the application and |
|
330 |
finally the applications class is asked for a corresponding action. |
|
331 |
The returned object is typically a valueHolder." |
|
332 |
||
434 | 333 |
|b| |
334 |
||
335 |
bindings notNil ifTrue:[ |
|
336 |
b := bindings at:aKey ifAbsent:nil. |
|
337 |
b notNil ifTrue:[^ b]. |
|
338 |
]. |
|
339 |
||
374 | 340 |
application notNil ifTrue:[ |
577 | 341 |
Object messageNotUnderstoodSignal handle:[:ex | |
342 |
Transcript showCR:'not understood: ' , aKey. |
|
343 |
] do:[ |
|
450 | 344 |
^ application aspectFor:aKey |
345 |
] |
|
374 | 346 |
]. |
422 | 347 |
applicationClass notNil ifTrue:[ |
424 | 348 |
(applicationClass respondsTo:#aspectFor:) ifTrue:[ |
349 |
^ applicationClass aspectFor:aKey |
|
350 |
] |
|
422 | 351 |
]. |
374 | 352 |
^ self aspectAt:aKey |
353 |
||
354 |
"Created: 17.1.1997 / 21:06:16 / cg" |
|
355 |
! |
|
356 |
||
423 | 357 |
componentFor:aKey |
450 | 358 |
"return a component for aKey. This is invoked during window building |
359 |
(by the builder) to ask for an ArbitraryComponents view. |
|
360 |
Here, first the local bindings are searched, then the application and |
|
361 |
finally the applications class is asked for a corresponding action. |
|
362 |
The returned object is typically a view." |
|
363 |
||
423 | 364 |
|cls| |
365 |
||
366 |
application notNil ifTrue:[ |
|
577 | 367 |
Object messageNotUnderstoodSignal handle:[:ex | |
368 |
Transcript showCR:'not understood: ' , aKey. |
|
369 |
] do:[ |
|
450 | 370 |
^ application componentFor:aKey |
371 |
] |
|
423 | 372 |
]. |
373 |
applicationClass notNil ifTrue:[ |
|
424 | 374 |
(applicationClass respondsTo:#componentFor:) ifTrue:[ |
375 |
^ applicationClass componentFor:aKey |
|
376 |
] |
|
423 | 377 |
]. |
378 |
^ self aspectAt:aKey |
|
379 |
||
380 |
! |
|
381 |
||
422 | 382 |
labelFor:aKey |
450 | 383 |
"return a label for aKey. This is invoked during window building |
384 |
(by the builder) to ask for a ???'s label. |
|
385 |
Here, first the local bindings are searched, then the application and |
|
386 |
finally the applications class is asked for a corresponding action. |
|
387 |
The returned object is typically a string." |
|
388 |
||
422 | 389 |
|cls| |
390 |
||
391 |
application notNil ifTrue:[ |
|
577 | 392 |
Object messageNotUnderstoodSignal handle:[:ex | |
393 |
Transcript showCR:'not understood: ' , aKey. |
|
394 |
] do:[ |
|
450 | 395 |
^ application labelFor:aKey |
396 |
] |
|
422 | 397 |
]. |
398 |
applicationClass notNil ifTrue:[ |
|
424 | 399 |
(applicationClass respondsTo:#labelFor:) ifTrue:[ |
400 |
^ applicationClass labelFor:aKey |
|
401 |
] |
|
422 | 402 |
]. |
403 |
^ self aspectAt:aKey |
|
404 |
||
405 |
! |
|
406 |
||
407 |
listFor:aKey |
|
450 | 408 |
"return a list for aKey. This is invoked during window building |
409 |
(by the builder) to ask for a ???'s label. |
|
410 |
Here, first the local bindings are searched, then the application and |
|
411 |
finally the applications class is asked for a corresponding action. |
|
412 |
The returned object is typically a list." |
|
413 |
||
422 | 414 |
application notNil ifTrue:[ |
577 | 415 |
Object messageNotUnderstoodSignal handle:[:ex | |
416 |
Transcript showCR:'not understood: ' , aKey. |
|
417 |
] do:[ |
|
450 | 418 |
^ application listFor:aKey |
419 |
] |
|
422 | 420 |
]. |
421 |
applicationClass notNil ifTrue:[ |
|
424 | 422 |
(applicationClass respondsTo:#listFor:) ifTrue:[ |
423 |
^ applicationClass listFor:aKey |
|
424 |
] |
|
422 | 425 |
]. |
426 |
^ self aspectAt:aKey |
|
427 |
||
428 |
"Created: 17.1.1997 / 21:08:45 / cg" |
|
429 |
! ! |
|
430 |
||
431 |
!WindowBuilder methodsFor:'spec creation callbacks'! |
|
432 |
||
100 | 433 |
createdComponent:aView forSpec:spec |
410 | 434 |
componentCreationHook notNil ifTrue:[ |
435 |
componentCreationHook value:aView value:spec value:self |
|
436 |
] |
|
100 | 437 |
|
438 |
"Modified: 5.9.1995 / 21:42:54 / claus" |
|
439 |
! ! |
|
440 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
441 |
!WindowBuilder methodsFor:'startup'! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
442 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
443 |
closeRequest |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
444 |
window destroy |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
445 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
446 |
"Modified: 17.1.1997 / 19:30:32 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
447 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
448 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
449 |
open |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
450 |
"open my topView, as previously created" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
451 |
|
477 | 452 |
|type| |
453 |
||
454 |
application isNil ifTrue:[ |
|
455 |
type := #normal |
|
456 |
] ifFalse:[ |
|
457 |
type := application defaultWindowType |
|
458 |
]. |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
459 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
460 |
openWithExtent:nil |
477 | 461 |
andType:type |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
462 |
|
477 | 463 |
"Modified: 3.3.1997 / 19:43:57 / cg" |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
464 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
465 |
|
428 | 466 |
openAt:aPoint |
467 |
"open my topView at some location" |
|
468 |
||
469 |
self |
|
467 | 470 |
openAt:aPoint |
471 |
withExtent:nil |
|
428 | 472 |
andType:(application defaultWindowType) |
473 |
||
474 |
"Created: 14.2.1997 / 20:21:57 / cg" |
|
467 | 475 |
"Modified: 28.2.1997 / 22:50:29 / cg" |
428 | 476 |
! |
477 |
||
436 | 478 |
openAt:origin withExtent:ext andType:type |
428 | 479 |
"open my window, as previously created, optionally defining the |
480 |
windows origin and/or extent. |
|
481 |
The type argument may be #dialog or #normal, and specifies if the view |
|
482 |
should be opened as a modal view, blocking interaction to the currently |
|
483 |
active view, or as a normal view." |
|
484 |
||
480 | 485 |
|mainSubView| |
486 |
||
428 | 487 |
origin notNil ifTrue:[ |
488 |
window origin:origin |
|
489 |
]. |
|
490 |
ext notNil ifTrue:[ |
|
480 | 491 |
window extent:ext. |
492 |
] ifFalse:[ |
|
493 |
type == #dialog ifTrue:[ |
|
494 |
window fixSize |
|
495 |
] |
|
496 |
]. |
|
497 |
||
498 |
(windowView notNil and:[windowView ~~ window]) ifTrue:[ |
|
499 |
windowView extent:(window extent). |
|
428 | 500 |
]. |
501 |
||
502 |
type == #dialog ifTrue:[ |
|
467 | 503 |
window fixPosition:(window device pointerPosition - window positionOffset). |
428 | 504 |
window openModal. |
505 |
^ self |
|
506 |
]. |
|
507 |
||
508 |
type == #normal ifTrue:[ |
|
480 | 509 |
window isNil ifTrue:[ |
510 |
self setupWindowFor:(StandardSystemView new). |
|
511 |
]. |
|
512 |
||
428 | 513 |
window open. |
514 |
^ self |
|
515 |
]. |
|
516 |
||
517 |
type == #popUp ifTrue:[ |
|
467 | 518 |
window fixPosition:(window device pointerPosition). |
519 |
window openAsPopUp. |
|
428 | 520 |
^ self |
521 |
]. |
|
522 |
||
523 |
" |
|
524 |
if ST-80 supports more types - these may be added later |
|
525 |
" |
|
526 |
self halt:'unimplemented' |
|
527 |
||
528 |
"Created: 14.2.1997 / 20:22:24 / cg" |
|
480 | 529 |
"Modified: 3.3.1997 / 22:27:52 / cg" |
428 | 530 |
! |
531 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
532 |
openDialog |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
533 |
"open my topView, as previously created as a modal view, |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
534 |
blocking interaction to the currently active view." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
535 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
536 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
537 |
openWithExtent:nil |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
538 |
andType:#dialog |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
539 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
540 |
"Modified: 17.1.1997 / 19:59:29 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
541 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
542 |
|
428 | 543 |
openDialogAt:aPoint withExtent:ext |
544 |
"open my topView, as previously created as a modal view, |
|
545 |
blocking interaction to the currently active view." |
|
546 |
||
547 |
self |
|
548 |
openAt:aPoint withExtent:ext |
|
549 |
andType:#dialog |
|
550 |
||
551 |
"Modified: 17.1.1997 / 19:59:36 / cg" |
|
552 |
"Created: 14.2.1997 / 20:24:19 / cg" |
|
553 |
! |
|
554 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
555 |
openDialogWithExtent:ext |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
556 |
"open my topView, as previously created as a modal view, |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
557 |
blocking interaction to the currently active view." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
558 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
559 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
560 |
openWithExtent:ext |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
561 |
andType:#dialog |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
562 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
563 |
"Modified: 17.1.1997 / 19:59:36 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
564 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
565 |
|
428 | 566 |
openPopUpAt:aPoint |
567 |
"open my topView, as previously created as a popUp view, |
|
568 |
blocking interaction to the currently active view." |
|
569 |
||
570 |
self |
|
571 |
openAt:aPoint withExtent:nil |
|
572 |
andType:#popUp |
|
573 |
||
574 |
"Modified: 17.1.1997 / 19:59:29 / cg" |
|
575 |
"Created: 14.2.1997 / 20:24:38 / cg" |
|
576 |
! |
|
577 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
578 |
openPopUpIn:aRectangle |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
579 |
"open my topView, as previously created as a popUp view, |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
580 |
blocking interaction to the currently active view." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
581 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
582 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
583 |
openWithExtent:nil |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
584 |
andType:#popUp |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
585 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
586 |
"Modified: 17.1.1997 / 19:59:29 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
587 |
"Created: 17.1.1997 / 20:01:24 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
588 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
589 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
590 |
openWithExtent:aPoint |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
591 |
"open my topView, as previously created, but override |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
592 |
the extent." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
593 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
594 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
595 |
openWithExtent:aPoint |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
596 |
andType:(application defaultWindowType) |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
597 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
598 |
"Modified: 17.1.1997 / 19:58:48 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
599 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
600 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
601 |
openWithExtent:ext andType:type |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
602 |
"open my window, as previously created. The type argument |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
603 |
may be #dialog or #normal, and specifies if the view should |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
604 |
be opened as a modal view, blocking interaction to the currently |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
605 |
active view, or as a normal view." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
606 |
|
428 | 607 |
^ self openAt:nil withExtent:ext andType:type |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
608 |
|
428 | 609 |
"Modified: 14.2.1997 / 20:22:47 / cg" |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
610 |
! ! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
611 |
|
132 | 612 |
!WindowBuilder class methodsFor:'documentation'! |
613 |
||
614 |
version |
|
577 | 615 |
^ '$Header: /cvs/stx/stx/libview2/Attic/WinBuilder.st,v 1.34 1997-05-20 07:06:17 ca Exp $' |
132 | 616 |
! ! |