author | Claus Gittinger <cg@exept.de> |
Tue, 17 Jun 1997 18:09:03 +0200 | |
changeset 608 | 1cd72d2d7e3b |
parent 600 | 885bd39df8df |
child 611 | 10d6eccf083c |
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 |
600 | 15 |
namedComponents helpKeys 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 |
||
600 | 158 |
helpKeyFor:aComponent |
159 |
|v key| |
|
160 |
||
161 |
helpKeys isNil ifTrue:[^ nil]. |
|
595 | 162 |
|
600 | 163 |
v := aComponent. |
164 |
[v notNil] whileTrue:[ |
|
165 |
(key := helpKeys at:v ifAbsent:nil) notNil ifTrue:[ |
|
166 |
^ key |
|
167 |
]. |
|
168 |
v := v superView |
|
169 |
]. |
|
595 | 170 |
^ nil |
600 | 171 |
! |
595 | 172 |
|
600 | 173 |
helpKeyFor:aComponent put:aKey |
595 | 174 |
|
600 | 175 |
aKey isNil ifTrue:[ |
176 |
helpKeys isNil ifFalse:[ |
|
177 |
helpKeys removeKey:aComponent ifAbsent:nil |
|
178 |
] |
|
179 |
] ifFalse:[ |
|
180 |
helpKeys isNil ifTrue:[ |
|
181 |
helpKeys := IdentityDictionary new |
|
182 |
]. |
|
183 |
helpKeys at:aComponent put:aKey |
|
184 |
] |
|
595 | 185 |
|
186 |
! |
|
187 |
||
477 | 188 |
keyboardProcessor |
189 |
keyboardProcessor isNil ifTrue:[ |
|
190 |
keyboardProcessor := KeyboardProcessor new |
|
191 |
]. |
|
192 |
^ keyboardProcessor |
|
193 |
||
194 |
"Created: 3.3.1997 / 18:31:37 / cg" |
|
195 |
"Modified: 3.3.1997 / 18:32:27 / cg" |
|
196 |
! |
|
197 |
||
86 | 198 |
namedComponents |
450 | 199 |
^ namedComponents |
86 | 200 |
! |
201 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
202 |
source |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
203 |
"same as #application, for ST-80 compatibility" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
204 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
205 |
^ application |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
206 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
207 |
"Created: 17.1.1997 / 19:03:51 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
208 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
209 |
|
125 | 210 |
source:anApplicationModel |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
211 |
"same as #application:, for ST-80 compatibility" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
212 |
|
125 | 213 |
application := anApplicationModel |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
214 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
215 |
"Modified: 17.1.1997 / 19:03:57 / cg" |
125 | 216 |
! |
217 |
||
502 | 218 |
subCanvasAt:majorKey at:minorKey |
586 | 219 |
"get the subCanvas specification from major and minor key |
220 |
" |
|
221 |
|spec cls dict dkey| |
|
502 | 222 |
|
223 |
subCanvasSpecs notNil ifTrue:[ |
|
586 | 224 |
dkey := majorKey ? #NoMajorKey. |
225 |
dict := subCanvasSpecs at:dkey ifAbsent:nil. |
|
226 |
||
227 |
dict notNil ifTrue:[ |
|
228 |
spec := dict at:minorKey ifAbsent:nil. |
|
502 | 229 |
spec notNil ifTrue:[^ spec]. |
230 |
]. |
|
231 |
]. |
|
586 | 232 |
|
502 | 233 |
majorKey isNil ifTrue:[ |
586 | 234 |
spec := self safelyPerform:#specificationFor: with:minorKey. |
235 |
||
236 |
spec isNil ifTrue:[ |
|
237 |
spec := self safelyPerform:minorKey |
|
238 |
] |
|
502 | 239 |
] ifFalse:[ |
240 |
cls := Smalltalk at:majorKey ifAbsent:nil. |
|
586 | 241 |
(cls notNil and:[cls respondsTo:minorKey]) ifTrue:[ |
502 | 242 |
spec := cls perform:minorKey |
243 |
] |
|
244 |
]. |
|
586 | 245 |
^ spec |
246 |
||
502 | 247 |
! |
248 |
||
249 |
subCanvasAt:majorKey at:minorKey put:aSpec |
|
250 |
|dict key| |
|
251 |
||
252 |
key := majorKey ? #NoMajorKey. |
|
253 |
dict := subCanvasSpecs at:key ifAbsent:nil. |
|
254 |
dict isNil ifTrue:[ |
|
255 |
dict := IdentityDictionary new. |
|
256 |
subCanvasSpecs at:key put:dict |
|
257 |
]. |
|
258 |
dict at:minorKey put:aSpec |
|
259 |
||
260 |
! |
|
261 |
||
475
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
262 |
visualAt:name |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
263 |
visuals isNil ifTrue:[^ nil]. |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
264 |
^ visuals at:name asSymbol ifAbsent:nil |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
265 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
266 |
"Created: 3.3.1997 / 16:24:17 / cg" |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
267 |
! |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
268 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
269 |
visualAt:name put:aVisual |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
270 |
visuals isNil ifTrue:[ |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
271 |
visuals := IdentityDictionary new. |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
272 |
]. |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
273 |
visuals at:name asSymbol put:aVisual |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
274 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
275 |
"Created: 3.3.1997 / 16:24:41 / cg" |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
276 |
! |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
277 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
278 |
visuals |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
279 |
^ visuals |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
280 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
281 |
"Created: 3.3.1997 / 16:24:00 / cg" |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
282 |
! |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
283 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
284 |
visuals:aDictionary |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
285 |
visuals := aDictionary |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
286 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
287 |
"Created: 3.3.1997 / 16:24:06 / cg" |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
288 |
! |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
289 |
|
125 | 290 |
window |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
291 |
"return the top window (view), for which an interface |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
292 |
is (being) built" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
293 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
294 |
^ window |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
295 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
296 |
"Modified: 17.1.1997 / 19:30:00 / cg" |
125 | 297 |
! |
298 |
||
299 |
window:aView |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
300 |
"set the top window (view), for which an interface |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
301 |
is (being) built" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
302 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
303 |
window := aView |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
304 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
305 |
"Modified: 17.1.1997 / 19:30:22 / cg" |
66 | 306 |
! |
307 |
||
308 |
windowGroup |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
309 |
^ window windowGroup |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
310 |
|
608 | 311 |
"Modified: 17.6.1997 / 18:04:01 / cg" |
66 | 312 |
! ! |
313 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
314 |
!WindowBuilder methodsFor:'building'! |
66 | 315 |
|
125 | 316 |
buildFromSpec:aSpec |
176 | 317 |
^ self subclassResponsibility |
408 | 318 |
! |
319 |
||
320 |
makeTabable:aComponent |
|
321 |
focusSequence isNil ifTrue:[ |
|
322 |
focusSequence := OrderedCollection new. |
|
323 |
]. |
|
324 |
focusSequence add:aComponent |
|
66 | 325 |
! ! |
100 | 326 |
|
586 | 327 |
!WindowBuilder methodsFor:'message sending'! |
328 |
||
329 |
safelyPerform:aSelector |
|
330 |
"send the message aSelector to the receiver self or application; |
|
331 |
the result returned from the send or nil is returned |
|
332 |
" |
|
333 |
|res| |
|
334 |
||
595 | 335 |
aSelector isSymbol ifTrue:[ |
336 |
Object messageNotUnderstoodSignal handle:[:ex | |
|
337 |
] do:[ |
|
338 |
(res := self perform:aSelector) notNil ifTrue:[^ res] |
|
339 |
]. |
|
340 |
||
341 |
application notNil ifTrue:[ |
|
342 |
Object messageNotUnderstoodSignal handle:[:ex | |
|
343 |
] do:[ |
|
344 |
(res := application perform:aSelector) notNil ifTrue:[^ res] |
|
345 |
] |
|
586 | 346 |
] |
347 |
]. |
|
595 | 348 |
^ nil |
586 | 349 |
! |
350 |
||
351 |
safelyPerform:aSelector with:anArgument |
|
352 |
"send the one-arg-message aSelector to the receiver self or application; |
|
353 |
the result returned from the send or nil is returned |
|
354 |
" |
|
355 |
|res| |
|
356 |
||
595 | 357 |
aSelector isSymbol ifTrue:[ |
358 |
Object messageNotUnderstoodSignal handle:[:ex | |
|
359 |
] do:[ |
|
360 |
(res := self perform:aSelector with:anArgument) notNil ifTrue:[^ res] |
|
361 |
]. |
|
362 |
||
363 |
application notNil ifTrue:[ |
|
364 |
Object messageNotUnderstoodSignal handle:[:ex | |
|
365 |
] do:[ |
|
366 |
(res := application perform:aSelector with:anArgument) notNil ifTrue:[^ res] |
|
367 |
] |
|
586 | 368 |
] |
369 |
]. |
|
595 | 370 |
^ nil |
586 | 371 |
! ! |
372 |
||
422 | 373 |
!WindowBuilder methodsFor:'spec creation aspect fetch'! |
100 | 374 |
|
374 | 375 |
actionFor:aKey |
450 | 376 |
"return an action for aKey. This is invoked during window building |
377 |
(by the builder) to ask for an ActionButtons actionBlock. |
|
378 |
Here, first the local bindings are searched, then the application and |
|
379 |
finally the applications class is asked for a corresponding action. |
|
380 |
The returned object is typically a block." |
|
381 |
||
434 | 382 |
|b| |
383 |
||
384 |
bindings notNil ifTrue:[ |
|
385 |
b := bindings at:aKey ifAbsent:nil. |
|
386 |
b notNil ifTrue:[^ b]. |
|
387 |
]. |
|
388 |
||
374 | 389 |
application notNil ifTrue:[ |
577 | 390 |
Object messageNotUnderstoodSignal handle:[:ex | |
391 |
Transcript showCR:'not understood: ' , aKey. |
|
392 |
] do:[ |
|
450 | 393 |
^ application actionFor:aKey |
394 |
] |
|
374 | 395 |
]. |
422 | 396 |
applicationClass notNil ifTrue:[ |
424 | 397 |
(applicationClass respondsTo:#actionFor:) ifTrue:[ |
398 |
^ applicationClass actionFor:aKey |
|
399 |
] |
|
422 | 400 |
]. |
401 |
^ [] |
|
374 | 402 |
|
403 |
"Created: 17.1.1997 / 21:08:22 / cg" |
|
404 |
! |
|
405 |
||
406 |
aspectFor:aKey |
|
450 | 407 |
"return a model for aKey. This is invoked during window building |
408 |
(by the builder) to ask for an Editfields, a Toggles etc. model. |
|
409 |
Here, first the local bindings are searched, then the application and |
|
410 |
finally the applications class is asked for a corresponding action. |
|
411 |
The returned object is typically a valueHolder." |
|
412 |
||
434 | 413 |
|b| |
414 |
||
415 |
bindings notNil ifTrue:[ |
|
416 |
b := bindings at:aKey ifAbsent:nil. |
|
417 |
b notNil ifTrue:[^ b]. |
|
418 |
]. |
|
419 |
||
374 | 420 |
application notNil ifTrue:[ |
577 | 421 |
Object messageNotUnderstoodSignal handle:[:ex | |
422 |
Transcript showCR:'not understood: ' , aKey. |
|
423 |
] do:[ |
|
450 | 424 |
^ application aspectFor:aKey |
425 |
] |
|
374 | 426 |
]. |
422 | 427 |
applicationClass notNil ifTrue:[ |
424 | 428 |
(applicationClass respondsTo:#aspectFor:) ifTrue:[ |
429 |
^ applicationClass aspectFor:aKey |
|
430 |
] |
|
422 | 431 |
]. |
374 | 432 |
^ self aspectAt:aKey |
433 |
||
434 |
"Created: 17.1.1997 / 21:06:16 / cg" |
|
435 |
! |
|
436 |
||
423 | 437 |
componentFor:aKey |
450 | 438 |
"return a component for aKey. This is invoked during window building |
439 |
(by the builder) to ask for an ArbitraryComponents view. |
|
440 |
Here, first the local bindings are searched, then the application and |
|
441 |
finally the applications class is asked for a corresponding action. |
|
442 |
The returned object is typically a view." |
|
443 |
||
423 | 444 |
|cls| |
445 |
||
446 |
application notNil ifTrue:[ |
|
577 | 447 |
Object messageNotUnderstoodSignal handle:[:ex | |
448 |
Transcript showCR:'not understood: ' , aKey. |
|
449 |
] do:[ |
|
450 | 450 |
^ application componentFor:aKey |
451 |
] |
|
423 | 452 |
]. |
453 |
applicationClass notNil ifTrue:[ |
|
424 | 454 |
(applicationClass respondsTo:#componentFor:) ifTrue:[ |
455 |
^ applicationClass componentFor:aKey |
|
456 |
] |
|
423 | 457 |
]. |
458 |
^ self aspectAt:aKey |
|
459 |
||
460 |
! |
|
461 |
||
422 | 462 |
labelFor:aKey |
450 | 463 |
"return a label for aKey. This is invoked during window building |
464 |
(by the builder) to ask for a ???'s label. |
|
465 |
Here, first the local bindings are searched, then the application and |
|
466 |
finally the applications class is asked for a corresponding action. |
|
467 |
The returned object is typically a string." |
|
468 |
||
422 | 469 |
|cls| |
470 |
||
471 |
application notNil ifTrue:[ |
|
577 | 472 |
Object messageNotUnderstoodSignal handle:[:ex | |
473 |
Transcript showCR:'not understood: ' , aKey. |
|
474 |
] do:[ |
|
450 | 475 |
^ application labelFor:aKey |
476 |
] |
|
422 | 477 |
]. |
478 |
applicationClass notNil ifTrue:[ |
|
424 | 479 |
(applicationClass respondsTo:#labelFor:) ifTrue:[ |
480 |
^ applicationClass labelFor:aKey |
|
481 |
] |
|
422 | 482 |
]. |
483 |
^ self aspectAt:aKey |
|
484 |
||
485 |
! |
|
486 |
||
487 |
listFor:aKey |
|
450 | 488 |
"return a list for aKey. This is invoked during window building |
489 |
(by the builder) to ask for a ???'s label. |
|
490 |
Here, first the local bindings are searched, then the application and |
|
491 |
finally the applications class is asked for a corresponding action. |
|
492 |
The returned object is typically a list." |
|
493 |
||
422 | 494 |
application notNil ifTrue:[ |
577 | 495 |
Object messageNotUnderstoodSignal handle:[:ex | |
496 |
Transcript showCR:'not understood: ' , aKey. |
|
497 |
] do:[ |
|
450 | 498 |
^ application listFor:aKey |
499 |
] |
|
422 | 500 |
]. |
501 |
applicationClass notNil ifTrue:[ |
|
424 | 502 |
(applicationClass respondsTo:#listFor:) ifTrue:[ |
503 |
^ applicationClass listFor:aKey |
|
504 |
] |
|
422 | 505 |
]. |
506 |
^ self aspectAt:aKey |
|
507 |
||
508 |
"Created: 17.1.1997 / 21:08:45 / cg" |
|
509 |
! ! |
|
510 |
||
511 |
!WindowBuilder methodsFor:'spec creation callbacks'! |
|
512 |
||
100 | 513 |
createdComponent:aView forSpec:spec |
410 | 514 |
componentCreationHook notNil ifTrue:[ |
515 |
componentCreationHook value:aView value:spec value:self |
|
516 |
] |
|
100 | 517 |
|
518 |
"Modified: 5.9.1995 / 21:42:54 / claus" |
|
519 |
! ! |
|
520 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
521 |
!WindowBuilder methodsFor:'startup'! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
522 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
523 |
closeRequest |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
524 |
window destroy |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
525 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
526 |
"Modified: 17.1.1997 / 19:30:32 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
527 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
528 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
529 |
open |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
530 |
"open my topView, as previously created" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
531 |
|
477 | 532 |
|type| |
533 |
||
534 |
application isNil ifTrue:[ |
|
535 |
type := #normal |
|
536 |
] ifFalse:[ |
|
537 |
type := application defaultWindowType |
|
538 |
]. |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
539 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
540 |
openWithExtent:nil |
477 | 541 |
andType:type |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
542 |
|
477 | 543 |
"Modified: 3.3.1997 / 19:43:57 / cg" |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
544 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
545 |
|
428 | 546 |
openAt:aPoint |
547 |
"open my topView at some location" |
|
548 |
||
549 |
self |
|
467 | 550 |
openAt:aPoint |
551 |
withExtent:nil |
|
428 | 552 |
andType:(application defaultWindowType) |
553 |
||
554 |
"Created: 14.2.1997 / 20:21:57 / cg" |
|
467 | 555 |
"Modified: 28.2.1997 / 22:50:29 / cg" |
428 | 556 |
! |
557 |
||
436 | 558 |
openAt:origin withExtent:ext andType:type |
428 | 559 |
"open my window, as previously created, optionally defining the |
560 |
windows origin and/or extent. |
|
561 |
The type argument may be #dialog or #normal, and specifies if the view |
|
562 |
should be opened as a modal view, blocking interaction to the currently |
|
563 |
active view, or as a normal view." |
|
564 |
||
480 | 565 |
|mainSubView| |
566 |
||
428 | 567 |
origin notNil ifTrue:[ |
568 |
window origin:origin |
|
569 |
]. |
|
570 |
ext notNil ifTrue:[ |
|
480 | 571 |
window extent:ext. |
572 |
] ifFalse:[ |
|
573 |
type == #dialog ifTrue:[ |
|
574 |
window fixSize |
|
575 |
] |
|
576 |
]. |
|
577 |
||
578 |
(windowView notNil and:[windowView ~~ window]) ifTrue:[ |
|
579 |
windowView extent:(window extent). |
|
428 | 580 |
]. |
581 |
||
582 |
type == #dialog ifTrue:[ |
|
467 | 583 |
window fixPosition:(window device pointerPosition - window positionOffset). |
428 | 584 |
window openModal. |
585 |
^ self |
|
586 |
]. |
|
587 |
||
588 |
type == #normal ifTrue:[ |
|
480 | 589 |
window isNil ifTrue:[ |
590 |
self setupWindowFor:(StandardSystemView new). |
|
591 |
]. |
|
592 |
||
428 | 593 |
window open. |
594 |
^ self |
|
595 |
]. |
|
596 |
||
597 |
type == #popUp ifTrue:[ |
|
467 | 598 |
window fixPosition:(window device pointerPosition). |
599 |
window openAsPopUp. |
|
428 | 600 |
^ self |
601 |
]. |
|
602 |
||
603 |
" |
|
604 |
if ST-80 supports more types - these may be added later |
|
605 |
" |
|
606 |
self halt:'unimplemented' |
|
607 |
||
608 |
"Created: 14.2.1997 / 20:22:24 / cg" |
|
480 | 609 |
"Modified: 3.3.1997 / 22:27:52 / cg" |
428 | 610 |
! |
611 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
612 |
openDialog |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
613 |
"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
|
614 |
blocking interaction to the currently active view." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
615 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
616 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
617 |
openWithExtent:nil |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
618 |
andType:#dialog |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
619 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
620 |
"Modified: 17.1.1997 / 19:59:29 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
621 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
622 |
|
428 | 623 |
openDialogAt:aPoint withExtent:ext |
624 |
"open my topView, as previously created as a modal view, |
|
625 |
blocking interaction to the currently active view." |
|
626 |
||
627 |
self |
|
628 |
openAt:aPoint withExtent:ext |
|
629 |
andType:#dialog |
|
630 |
||
631 |
"Modified: 17.1.1997 / 19:59:36 / cg" |
|
632 |
"Created: 14.2.1997 / 20:24:19 / cg" |
|
633 |
! |
|
634 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
635 |
openDialogWithExtent:ext |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
636 |
"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
|
637 |
blocking interaction to the currently active view." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
638 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
639 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
640 |
openWithExtent:ext |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
641 |
andType:#dialog |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
642 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
643 |
"Modified: 17.1.1997 / 19:59:36 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
644 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
645 |
|
428 | 646 |
openPopUpAt:aPoint |
647 |
"open my topView, as previously created as a popUp view, |
|
648 |
blocking interaction to the currently active view." |
|
649 |
||
650 |
self |
|
651 |
openAt:aPoint withExtent:nil |
|
652 |
andType:#popUp |
|
653 |
||
654 |
"Modified: 17.1.1997 / 19:59:29 / cg" |
|
655 |
"Created: 14.2.1997 / 20:24:38 / cg" |
|
656 |
! |
|
657 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
658 |
openPopUpIn:aRectangle |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
659 |
"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
|
660 |
blocking interaction to the currently active view." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
661 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
662 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
663 |
openWithExtent:nil |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
664 |
andType:#popUp |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
665 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
666 |
"Modified: 17.1.1997 / 19:59:29 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
667 |
"Created: 17.1.1997 / 20:01:24 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
668 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
669 |
|
587 | 670 |
openWindowAt:aPoint |
671 |
"open my topView at some location" |
|
672 |
||
673 |
self openAt:aPoint |
|
674 |
! |
|
675 |
||
676 |
openWindowAt:origin withExtent:ext andType:type |
|
677 |
"open my window, as previously created, optionally defining the |
|
678 |
windows origin and/or extent. |
|
679 |
The type argument may be #dialog or #normal, and specifies if the view |
|
680 |
should be opened as a modal view, blocking interaction to the currently |
|
681 |
active view, or as a normal view." |
|
682 |
||
683 |
^ self openAt:origin withExtent:ext andType:type |
|
684 |
! |
|
685 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
686 |
openWithExtent:aPoint |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
687 |
"open my topView, as previously created, but override |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
688 |
the extent." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
689 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
690 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
691 |
openWithExtent:aPoint |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
692 |
andType:(application defaultWindowType) |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
693 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
694 |
"Modified: 17.1.1997 / 19:58:48 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
695 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
696 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
697 |
openWithExtent:ext andType:type |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
698 |
"open my window, as previously created. The type argument |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
699 |
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
|
700 |
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
|
701 |
active view, or as a normal view." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
702 |
|
428 | 703 |
^ self openAt:nil withExtent:ext andType:type |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
704 |
|
428 | 705 |
"Modified: 14.2.1997 / 20:22:47 / cg" |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
706 |
! ! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
707 |
|
132 | 708 |
!WindowBuilder class methodsFor:'documentation'! |
709 |
||
710 |
version |
|
608 | 711 |
^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.40 1997-06-17 16:09:03 cg Exp $' |
132 | 712 |
! ! |