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