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