author | Claus Gittinger <cg@exept.de> |
Fri, 04 Apr 1997 15:02:02 +0200 | |
changeset 509 | df395b9c70c8 |
parent 502 | 43ca81bcde49 |
child 577 | 818d08c9aef1 |
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:[ |
101 |
Object messageNotUnderstoodSignal catch:[ |
|
102 |
^ application aspectFor:aSymbol |
|
103 |
] |
|
450 | 104 |
] |
433 | 105 |
]. |
106 |
^ nil |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
107 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
108 |
"Modified: 17.1.1997 / 19:28:32 / cg" |
66 | 109 |
! |
110 |
||
125 | 111 |
aspectAt:aSymbol put:aModel |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
112 |
bindings isNil ifTrue:[ |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
113 |
bindings := IdentityDictionary new |
125 | 114 |
]. |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
115 |
^ bindings at:aSymbol put:aModel |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
116 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
117 |
"Modified: 17.1.1997 / 19:28:37 / cg" |
100 | 118 |
! |
119 |
||
450 | 120 |
bindingAt:aSymbol |
121 |
bindings notNil ifTrue:[ |
|
122 |
^ bindings at:aSymbol ifAbsent:nil. |
|
123 |
]. |
|
124 |
^ nil |
|
125 |
! |
|
126 |
||
100 | 127 |
bindings |
128 |
^ bindings |
|
129 |
! |
|
130 |
||
131 |
bindings:aDictionary |
|
132 |
bindings := aDictionary |
|
133 |
! |
|
134 |
||
125 | 135 |
componentAt:name |
450 | 136 |
namedComponents isNil ifTrue:[^ nil]. |
137 |
^ namedComponents at:name asSymbol ifAbsent:nil |
|
125 | 138 |
! |
139 |
||
100 | 140 |
componentAt:name put:aComponent |
450 | 141 |
namedComponents isNil ifTrue:[ |
142 |
namedComponents := IdentityDictionary new. |
|
100 | 143 |
]. |
450 | 144 |
namedComponents at:name asSymbol put:aComponent |
100 | 145 |
! |
146 |
||
410 | 147 |
componentCreationHook:something |
148 |
"set the value of the instance variable 'componentCreationHook' (automatically generated)" |
|
149 |
||
150 |
componentCreationHook := something.! |
|
151 |
||
125 | 152 |
focusSequence |
153 |
^ focusSequence |
|
66 | 154 |
! |
155 |
||
477 | 156 |
keyboardProcessor |
157 |
keyboardProcessor isNil ifTrue:[ |
|
158 |
keyboardProcessor := KeyboardProcessor new |
|
159 |
]. |
|
160 |
^ keyboardProcessor |
|
161 |
||
162 |
"Created: 3.3.1997 / 18:31:37 / cg" |
|
163 |
"Modified: 3.3.1997 / 18:32:27 / cg" |
|
164 |
! |
|
165 |
||
86 | 166 |
namedComponents |
450 | 167 |
^ namedComponents |
86 | 168 |
! |
169 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
170 |
source |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
171 |
"same as #application, for ST-80 compatibility" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
172 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
173 |
^ application |
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 |
"Created: 17.1.1997 / 19:03:51 / cg" |
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 |
|
125 | 178 |
source:anApplicationModel |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
179 |
"same as #application:, for ST-80 compatibility" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
180 |
|
125 | 181 |
application := anApplicationModel |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
182 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
183 |
"Modified: 17.1.1997 / 19:03:57 / cg" |
125 | 184 |
! |
185 |
||
502 | 186 |
subCanvasAt:majorKey at:minorKey |
187 |
|majorDict spec cls k| |
|
188 |
||
189 |
k := majorKey ? #NoMajorKey. |
|
190 |
subCanvasSpecs notNil ifTrue:[ |
|
191 |
majorDict := subCanvasSpecs at:k ifAbsent:nil. |
|
192 |
majorDict notNil ifTrue:[ |
|
193 |
spec := majorDict at:minorKey ifAbsent:nil. |
|
194 |
spec notNil ifTrue:[^ spec]. |
|
195 |
]. |
|
196 |
]. |
|
197 |
majorKey isNil ifTrue:[ |
|
198 |
"/ I provide the spec |
|
199 |
application isNil ifTrue:[ |
|
200 |
^ nil |
|
201 |
]. |
|
202 |
spec := application specificationFor:minorKey |
|
203 |
] ifFalse:[ |
|
204 |
cls := Smalltalk at:majorKey ifAbsent:nil. |
|
205 |
cls notNil ifTrue:[ |
|
206 |
spec := cls perform:minorKey |
|
207 |
] |
|
208 |
]. |
|
209 |
^ spec |
|
210 |
! |
|
211 |
||
212 |
subCanvasAt:majorKey at:minorKey put:aSpec |
|
213 |
|dict key| |
|
214 |
||
215 |
key := majorKey ? #NoMajorKey. |
|
216 |
dict := subCanvasSpecs at:key ifAbsent:nil. |
|
217 |
dict isNil ifTrue:[ |
|
218 |
dict := IdentityDictionary new. |
|
219 |
subCanvasSpecs at:key put:dict |
|
220 |
]. |
|
221 |
dict at:minorKey put:aSpec |
|
222 |
||
223 |
! |
|
224 |
||
475
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
225 |
visualAt:name |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
226 |
visuals isNil ifTrue:[^ nil]. |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
227 |
^ visuals at:name asSymbol ifAbsent:nil |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
228 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
229 |
"Created: 3.3.1997 / 16:24:17 / cg" |
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 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
232 |
visualAt:name put:aVisual |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
233 |
visuals isNil ifTrue:[ |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
234 |
visuals := IdentityDictionary new. |
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 |
visuals at:name asSymbol put:aVisual |
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 |
"Created: 3.3.1997 / 16:24:41 / cg" |
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 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
241 |
visuals |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
242 |
^ visuals |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
243 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
244 |
"Created: 3.3.1997 / 16:24:00 / cg" |
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 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
247 |
visuals:aDictionary |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
248 |
visuals := aDictionary |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
249 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
250 |
"Created: 3.3.1997 / 16:24:06 / cg" |
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 |
|
125 | 253 |
window |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
254 |
"return the top window (view), for which an interface |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
255 |
is (being) built" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
256 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
257 |
^ window |
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 |
"Modified: 17.1.1997 / 19:30:00 / cg" |
125 | 260 |
! |
261 |
||
262 |
window:aView |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
263 |
"set the top window (view), for which an interface |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
264 |
is (being) built" |
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 |
window := aView |
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 |
"Modified: 17.1.1997 / 19:30:22 / cg" |
66 | 269 |
! |
270 |
||
271 |
windowGroup |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
272 |
self halt. |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
273 |
^ window windowGroup |
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:26 / cg" |
66 | 276 |
! ! |
277 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
278 |
!WindowBuilder methodsFor:'building'! |
66 | 279 |
|
125 | 280 |
buildFromSpec:aSpec |
176 | 281 |
^ self subclassResponsibility |
408 | 282 |
! |
283 |
||
284 |
makeTabable:aComponent |
|
285 |
focusSequence isNil ifTrue:[ |
|
286 |
focusSequence := OrderedCollection new. |
|
287 |
]. |
|
288 |
focusSequence add:aComponent |
|
66 | 289 |
! ! |
100 | 290 |
|
422 | 291 |
!WindowBuilder methodsFor:'spec creation aspect fetch'! |
100 | 292 |
|
374 | 293 |
actionFor:aKey |
450 | 294 |
"return an action for aKey. This is invoked during window building |
295 |
(by the builder) to ask for an ActionButtons actionBlock. |
|
296 |
Here, first the local bindings are searched, then the application and |
|
297 |
finally the applications class is asked for a corresponding action. |
|
298 |
The returned object is typically a block." |
|
299 |
||
434 | 300 |
|b| |
301 |
||
302 |
bindings notNil ifTrue:[ |
|
303 |
b := bindings at:aKey ifAbsent:nil. |
|
304 |
b notNil ifTrue:[^ b]. |
|
305 |
]. |
|
306 |
||
374 | 307 |
application notNil ifTrue:[ |
450 | 308 |
Object messageNotUnderstoodSignal catch:[ |
309 |
^ application actionFor:aKey |
|
310 |
] |
|
374 | 311 |
]. |
422 | 312 |
applicationClass notNil ifTrue:[ |
424 | 313 |
(applicationClass respondsTo:#actionFor:) ifTrue:[ |
314 |
^ applicationClass actionFor:aKey |
|
315 |
] |
|
422 | 316 |
]. |
317 |
^ [] |
|
374 | 318 |
|
319 |
"Created: 17.1.1997 / 21:08:22 / cg" |
|
320 |
! |
|
321 |
||
322 |
aspectFor:aKey |
|
450 | 323 |
"return a model for aKey. This is invoked during window building |
324 |
(by the builder) to ask for an Editfields, a Toggles etc. model. |
|
325 |
Here, first the local bindings are searched, then the application and |
|
326 |
finally the applications class is asked for a corresponding action. |
|
327 |
The returned object is typically a valueHolder." |
|
328 |
||
434 | 329 |
|b| |
330 |
||
331 |
bindings notNil ifTrue:[ |
|
332 |
b := bindings at:aKey ifAbsent:nil. |
|
333 |
b notNil ifTrue:[^ b]. |
|
334 |
]. |
|
335 |
||
374 | 336 |
application notNil ifTrue:[ |
450 | 337 |
Object messageNotUnderstoodSignal catch:[ |
338 |
^ application aspectFor:aKey |
|
339 |
] |
|
374 | 340 |
]. |
422 | 341 |
applicationClass notNil ifTrue:[ |
424 | 342 |
(applicationClass respondsTo:#aspectFor:) ifTrue:[ |
343 |
^ applicationClass aspectFor:aKey |
|
344 |
] |
|
422 | 345 |
]. |
374 | 346 |
^ self aspectAt:aKey |
347 |
||
348 |
"Created: 17.1.1997 / 21:06:16 / cg" |
|
349 |
! |
|
350 |
||
423 | 351 |
componentFor:aKey |
450 | 352 |
"return a component for aKey. This is invoked during window building |
353 |
(by the builder) to ask for an ArbitraryComponents view. |
|
354 |
Here, first the local bindings are searched, then the application and |
|
355 |
finally the applications class is asked for a corresponding action. |
|
356 |
The returned object is typically a view." |
|
357 |
||
423 | 358 |
|cls| |
359 |
||
360 |
application notNil ifTrue:[ |
|
450 | 361 |
Object messageNotUnderstoodSignal catch:[ |
362 |
^ application componentFor:aKey |
|
363 |
] |
|
423 | 364 |
]. |
365 |
applicationClass notNil ifTrue:[ |
|
424 | 366 |
(applicationClass respondsTo:#componentFor:) ifTrue:[ |
367 |
^ applicationClass componentFor:aKey |
|
368 |
] |
|
423 | 369 |
]. |
370 |
^ self aspectAt:aKey |
|
371 |
||
372 |
! |
|
373 |
||
422 | 374 |
labelFor:aKey |
450 | 375 |
"return a label for aKey. This is invoked during window building |
376 |
(by the builder) to ask for a ???'s label. |
|
377 |
Here, first the local bindings are searched, then the application and |
|
378 |
finally the applications class is asked for a corresponding action. |
|
379 |
The returned object is typically a string." |
|
380 |
||
422 | 381 |
|cls| |
382 |
||
383 |
application notNil ifTrue:[ |
|
450 | 384 |
Object messageNotUnderstoodSignal catch:[ |
385 |
^ application labelFor:aKey |
|
386 |
] |
|
422 | 387 |
]. |
388 |
applicationClass notNil ifTrue:[ |
|
424 | 389 |
(applicationClass respondsTo:#labelFor:) ifTrue:[ |
390 |
^ applicationClass labelFor:aKey |
|
391 |
] |
|
422 | 392 |
]. |
393 |
^ self aspectAt:aKey |
|
394 |
||
395 |
! |
|
396 |
||
397 |
listFor:aKey |
|
450 | 398 |
"return a list for aKey. This is invoked during window building |
399 |
(by the builder) to ask for a ???'s label. |
|
400 |
Here, first the local bindings are searched, then the application and |
|
401 |
finally the applications class is asked for a corresponding action. |
|
402 |
The returned object is typically a list." |
|
403 |
||
422 | 404 |
application notNil ifTrue:[ |
450 | 405 |
Object messageNotUnderstoodSignal catch:[ |
406 |
^ application listFor:aKey |
|
407 |
] |
|
422 | 408 |
]. |
409 |
applicationClass notNil ifTrue:[ |
|
424 | 410 |
(applicationClass respondsTo:#listFor:) ifTrue:[ |
411 |
^ applicationClass listFor:aKey |
|
412 |
] |
|
422 | 413 |
]. |
414 |
^ self aspectAt:aKey |
|
415 |
||
416 |
"Created: 17.1.1997 / 21:08:45 / cg" |
|
417 |
! ! |
|
418 |
||
419 |
!WindowBuilder methodsFor:'spec creation callbacks'! |
|
420 |
||
100 | 421 |
createdComponent:aView forSpec:spec |
410 | 422 |
componentCreationHook notNil ifTrue:[ |
423 |
componentCreationHook value:aView value:spec value:self |
|
424 |
] |
|
100 | 425 |
|
426 |
"Modified: 5.9.1995 / 21:42:54 / claus" |
|
427 |
! ! |
|
428 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
429 |
!WindowBuilder methodsFor:'startup'! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
430 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
431 |
closeRequest |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
432 |
window destroy |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
433 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
434 |
"Modified: 17.1.1997 / 19:30:32 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
435 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
436 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
437 |
open |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
438 |
"open my topView, as previously created" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
439 |
|
477 | 440 |
|type| |
441 |
||
442 |
application isNil ifTrue:[ |
|
443 |
type := #normal |
|
444 |
] ifFalse:[ |
|
445 |
type := application defaultWindowType |
|
446 |
]. |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
447 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
448 |
openWithExtent:nil |
477 | 449 |
andType:type |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
450 |
|
477 | 451 |
"Modified: 3.3.1997 / 19:43:57 / cg" |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
452 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
453 |
|
428 | 454 |
openAt:aPoint |
455 |
"open my topView at some location" |
|
456 |
||
457 |
self |
|
467 | 458 |
openAt:aPoint |
459 |
withExtent:nil |
|
428 | 460 |
andType:(application defaultWindowType) |
461 |
||
462 |
"Created: 14.2.1997 / 20:21:57 / cg" |
|
467 | 463 |
"Modified: 28.2.1997 / 22:50:29 / cg" |
428 | 464 |
! |
465 |
||
436 | 466 |
openAt:origin withExtent:ext andType:type |
428 | 467 |
"open my window, as previously created, optionally defining the |
468 |
windows origin and/or extent. |
|
469 |
The type argument may be #dialog or #normal, and specifies if the view |
|
470 |
should be opened as a modal view, blocking interaction to the currently |
|
471 |
active view, or as a normal view." |
|
472 |
||
480 | 473 |
|mainSubView| |
474 |
||
428 | 475 |
origin notNil ifTrue:[ |
476 |
window origin:origin |
|
477 |
]. |
|
478 |
ext notNil ifTrue:[ |
|
480 | 479 |
window extent:ext. |
480 |
] ifFalse:[ |
|
481 |
type == #dialog ifTrue:[ |
|
482 |
window fixSize |
|
483 |
] |
|
484 |
]. |
|
485 |
||
486 |
(windowView notNil and:[windowView ~~ window]) ifTrue:[ |
|
487 |
windowView extent:(window extent). |
|
428 | 488 |
]. |
489 |
||
490 |
type == #dialog ifTrue:[ |
|
467 | 491 |
window fixPosition:(window device pointerPosition - window positionOffset). |
428 | 492 |
window openModal. |
493 |
^ self |
|
494 |
]. |
|
495 |
||
496 |
type == #normal ifTrue:[ |
|
480 | 497 |
window isNil ifTrue:[ |
498 |
self setupWindowFor:(StandardSystemView new). |
|
499 |
]. |
|
500 |
||
428 | 501 |
window open. |
502 |
^ self |
|
503 |
]. |
|
504 |
||
505 |
type == #popUp ifTrue:[ |
|
467 | 506 |
window fixPosition:(window device pointerPosition). |
507 |
window openAsPopUp. |
|
428 | 508 |
^ self |
509 |
]. |
|
510 |
||
511 |
" |
|
512 |
if ST-80 supports more types - these may be added later |
|
513 |
" |
|
514 |
self halt:'unimplemented' |
|
515 |
||
516 |
"Created: 14.2.1997 / 20:22:24 / cg" |
|
480 | 517 |
"Modified: 3.3.1997 / 22:27:52 / cg" |
428 | 518 |
! |
519 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
520 |
openDialog |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
521 |
"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
|
522 |
blocking interaction to the currently active view." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
523 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
524 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
525 |
openWithExtent:nil |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
526 |
andType:#dialog |
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 |
"Modified: 17.1.1997 / 19:59:29 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
529 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
530 |
|
428 | 531 |
openDialogAt:aPoint withExtent:ext |
532 |
"open my topView, as previously created as a modal view, |
|
533 |
blocking interaction to the currently active view." |
|
534 |
||
535 |
self |
|
536 |
openAt:aPoint withExtent:ext |
|
537 |
andType:#dialog |
|
538 |
||
539 |
"Modified: 17.1.1997 / 19:59:36 / cg" |
|
540 |
"Created: 14.2.1997 / 20:24:19 / cg" |
|
541 |
! |
|
542 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
543 |
openDialogWithExtent:ext |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
544 |
"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
|
545 |
blocking interaction to the currently active view." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
546 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
547 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
548 |
openWithExtent:ext |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
549 |
andType:#dialog |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
550 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
551 |
"Modified: 17.1.1997 / 19:59:36 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
552 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
553 |
|
428 | 554 |
openPopUpAt:aPoint |
555 |
"open my topView, as previously created as a popUp view, |
|
556 |
blocking interaction to the currently active view." |
|
557 |
||
558 |
self |
|
559 |
openAt:aPoint withExtent:nil |
|
560 |
andType:#popUp |
|
561 |
||
562 |
"Modified: 17.1.1997 / 19:59:29 / cg" |
|
563 |
"Created: 14.2.1997 / 20:24:38 / cg" |
|
564 |
! |
|
565 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
566 |
openPopUpIn:aRectangle |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
567 |
"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
|
568 |
blocking interaction to the currently active view." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
569 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
570 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
571 |
openWithExtent:nil |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
572 |
andType:#popUp |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
573 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
574 |
"Modified: 17.1.1997 / 19:59:29 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
575 |
"Created: 17.1.1997 / 20:01:24 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
576 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
577 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
578 |
openWithExtent:aPoint |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
579 |
"open my topView, as previously created, but override |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
580 |
the extent." |
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:aPoint |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
584 |
andType:(application defaultWindowType) |
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:58:48 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
587 |
! |
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 |
openWithExtent:ext andType:type |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
590 |
"open my window, as previously created. The type argument |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
591 |
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
|
592 |
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
|
593 |
active view, or as a normal view." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
594 |
|
428 | 595 |
^ self openAt:nil withExtent:ext andType:type |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
596 |
|
428 | 597 |
"Modified: 14.2.1997 / 20:22:47 / cg" |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
598 |
! ! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
599 |
|
132 | 600 |
!WindowBuilder class methodsFor:'documentation'! |
601 |
||
602 |
version |
|
502 | 603 |
^ '$Header: /cvs/stx/stx/libview2/Attic/WinBuilder.st,v 1.33 1997-03-27 10:22:06 ca Exp $' |
132 | 604 |
! ! |