author | Claus Gittinger <cg@exept.de> |
Thu, 17 Apr 1997 00:54:07 +0200 | |
changeset 538 | d1166aa560ea |
parent 521 | 2937b6c596b3 |
child 588 | 106b7def4d65 |
permissions | -rw-r--r-- |
50 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
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 |
||
13 |
Model subclass:#ApplicationModel |
|
310 | 14 |
instanceVariableNames:'builder resources device' |
389 | 15 |
classVariableNames:'DefaultLabels DefaultVisuals' |
142
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
16 |
poolDictionaries:'' |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
17 |
category:'Interface-Framework' |
50 | 18 |
! |
19 |
||
138 | 20 |
ApplicationModel class instanceVariableNames:'ClassResources' |
21 |
||
22 |
" |
|
23 |
The following class instance variables are inherited by this class: |
|
24 |
||
25 |
Model - |
|
26 |
Object - |
|
27 |
" |
|
28 |
! |
|
52 | 29 |
|
361 | 30 |
!ApplicationModel class methodsFor:'documentation'! |
50 | 31 |
|
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
35 |
All Rights Reserved |
|
36 |
||
37 |
This software is furnished under a license and may be used |
|
38 |
only in accordance with the terms of that license and with the |
|
39 |
inclusion of the above copyright notice. This software may not |
|
40 |
be provided or otherwise made available to, or used by, any |
|
41 |
other person. No title to or ownership of the software is |
|
42 |
hereby transferred. |
|
43 |
" |
|
44 |
! |
|
45 |
||
46 |
documentation |
|
47 |
" |
|
48 |
Since many ST-80 classes are subclasses of ApplicationModel, this class |
|
49 |
is provided here to allow easier porting of ST-80 code. |
|
57 | 50 |
|
429 | 51 |
It does not (currently) provide all functionality and is NOT |
63 | 52 |
compatible to the corresponding ST80 class; therefore, manual |
50 | 53 |
changes have to be made to get those applications to run under ST/X. |
57 | 54 |
(but at least, this enables you to fileIn that code and have a superclass |
78 | 55 |
for them) |
56 |
||
57 |
As time goes by, ST/X applications are going to be converted to |
|
330
d7ce98930ad3
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
313
diff
changeset
|
58 |
become subclasses of this abstract class - see Launcher for a |
78 | 59 |
first concrete example. |
60 |
||
215 | 61 |
|
78 | 62 |
ApplicationModel is prepared to build a view from a windowSpec, as |
215 | 63 |
created by the windowBuilder. If your subclass does not provide such |
78 | 64 |
a spec, you should at least redefine: |
65 |
||
215 | 66 |
#openInterface - to create a topview and open it |
78 | 67 |
|
68 |
you may want to redefine: |
|
69 |
||
215 | 70 |
#closeRequest - to catch window closing |
71 |
#focusSequence - to define a sequence for focus-stepping |
|
78 | 72 |
|
50 | 73 |
|
215 | 74 |
Once the interfaceBuilder is finished & released, subclasses can |
75 |
alternatively provide the spec via a #windowSpec method. |
|
76 |
||
52 | 77 |
The classResources have been put into this class to allow ST/X |
57 | 78 |
applications (which used to be subclasses of StandardSystemView) |
79 |
to migrate smoothly into ApplicationModels (which is better design ...). |
|
52 | 80 |
|
81 |
||
215 | 82 |
[Instance variables:] |
83 |
resources ResourcePack language string translation |
|
84 |
||
85 |
builder WindowBuilder a builder who knows how to create |
|
86 |
a window hierarchy from a specification |
|
78 | 87 |
|
88 |
||
89 |
Notice: this class was implemented using protocol information |
|
90 |
from alpha testers and PD code - it may not be complete or compatible to |
|
91 |
the corresponding ST-80 class. If you encounter any incompatibilities, |
|
92 |
please forward a note to the ST/X team. |
|
215 | 93 |
|
94 |
||
221 | 95 |
[author:] |
96 |
Claus Gittinger |
|
97 |
||
215 | 98 |
[see also:] |
99 |
StandardSystemView |
|
100 |
WindowGroup DeviceWorkstation |
|
50 | 101 |
" |
102 |
! ! |
|
103 |
||
361 | 104 |
!ApplicationModel class methodsFor:'initialization'! |
52 | 105 |
|
106 |
initialize |
|
107 |
self == ApplicationModel ifTrue:[ |
|
389 | 108 |
Smalltalk addDependent:self |
109 |
]. |
|
110 |
DefaultLabels isNil ifTrue:[ |
|
111 |
DefaultLabels := IdentityDictionary new |
|
112 |
]. |
|
113 |
DefaultVisuals isNil ifTrue:[ |
|
114 |
DefaultVisuals := IdentityDictionary new |
|
115 |
]. |
|
52 | 116 |
|
117 |
" |
|
118 |
ApplicationModel initialize |
|
119 |
" |
|
389 | 120 |
|
121 |
"Modified: 28.1.1997 / 12:31:38 / cg" |
|
52 | 122 |
! ! |
123 |
||
361 | 124 |
!ApplicationModel class methodsFor:'instance creation'! |
52 | 125 |
|
126 |
new |
|
215 | 127 |
"return a new initialized instance" |
128 |
||
63 | 129 |
^ super new basicInitialize initialize |
215 | 130 |
|
131 |
"Modified: 24.4.1996 / 09:42:14 / cg" |
|
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
132 |
! |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
133 |
|
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
134 |
onDevice:aDevice |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
135 |
"return a new initialized instance, which shall open its interface |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
136 |
on aDevice." |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
137 |
|
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
138 |
^ (super new basicInitialize |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
139 |
setDevice:aDevice) initialize |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
140 |
|
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
141 |
"Modified: 24.4.1996 / 09:42:14 / cg" |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
142 |
"Created: 5.7.1996 / 12:19:15 / cg" |
52 | 143 |
! ! |
144 |
||
421 | 145 |
!ApplicationModel class methodsFor:'accessing'! |
146 |
||
147 |
application |
|
148 |
^ self |
|
149 |
||
150 |
! ! |
|
151 |
||
152 |
!ApplicationModel class methodsFor:'bindings'! |
|
153 |
||
154 |
actionFor:aKey |
|
155 |
"sent by the builder to ask for an actionBlock for |
|
156 |
a Button. The argument, aKey comes from an UI-spec |
|
157 |
for a buttons #action property. |
|
158 |
Here, a corresponding message is sent to myself, |
|
159 |
which ought to be defined in the application subclass. |
|
160 |
Alternatively, a subclass may redefine this method, to provide |
|
161 |
actionBlocks from a Dictionary or whatever. |
|
162 |
Typically, a block is returned there." |
|
163 |
||
164 |
^ nil |
|
165 |
||
166 |
||
167 |
! |
|
168 |
||
169 |
aspectFor:aKey |
|
170 |
"sent by the builder to ask for an aspect (a data model). |
|
171 |
The argument, aKey comes from an UI-spec |
|
172 |
for a components #aspect property. |
|
173 |
Here, a corresponding message is sent to myself, |
|
174 |
which ought to be defined in the application subclass. |
|
175 |
Alternatively, a subclass may redefine this method, to provide |
|
176 |
holders from a Dictionary or whatever. |
|
177 |
Typically, a valueHolder is returned there." |
|
178 |
||
179 |
^ nil |
|
180 |
||
181 |
! |
|
182 |
||
183 |
clientFor:aKey |
|
184 |
"sent by the builder to ask for an application provided |
|
185 |
subcanvas's application. |
|
186 |
The argument, aKey comes from an UI-spec |
|
187 |
for a subcanvas's #client property. |
|
188 |
Here, a corresponding message is sent to myself, |
|
189 |
which ought to be defined in the application subclass. |
|
190 |
Alternatively, a subclass may redefine this method, to provide |
|
191 |
appModels from a Dictionary or whatever. |
|
192 |
Typically, an applicationModel is returned there." |
|
193 |
||
194 |
^ nil |
|
195 |
||
196 |
! |
|
197 |
||
198 |
componentFor:aKey |
|
199 |
"sent by the builder to ask for an application provided |
|
200 |
component. |
|
201 |
The argument, aKey comes from an UI-spec |
|
202 |
for a viewHolders #view property. |
|
203 |
Here, a corresponding message is sent to myself, |
|
204 |
which ought to be defined in the application subclass. |
|
205 |
Alternatively, a subclass may redefine this method, to provide |
|
206 |
holders from a Dictionary or whatever. |
|
207 |
Typically, a view is returned there." |
|
208 |
||
427 | 209 |
(self respondsTo:aKey) ifTrue:[ |
210 |
^ self perform:aKey |
|
211 |
]. |
|
212 |
^ nil |
|
421 | 213 |
! |
214 |
||
215 |
labelFor:aKey |
|
216 |
"sent by the builder to ask for an application provided |
|
217 |
label for a component. |
|
218 |
The argument, aKey comes from an UI-spec |
|
219 |
for a components #label property. |
|
220 |
Here, a corresponding message is sent to myself, |
|
221 |
which ought to be defined in the application subclass. |
|
222 |
Alternatively, a subclass may redefine this method, to provide |
|
223 |
labels from a Dictionary or whatever. |
|
224 |
Typically, a string is returned there." |
|
225 |
||
226 |
(self application respondsTo:aKey) ifTrue:[ |
|
227 |
^ self application perform:aKey |
|
228 |
]. |
|
229 |
^ self application labelAt:aKey ifAbsent:nil |
|
230 |
||
231 |
! |
|
232 |
||
233 |
listFor:aKey |
|
234 |
"sent by the builder to ask for an application provided |
|
235 |
holder for a list. |
|
236 |
The argument, aKey comes from an UI-spec |
|
237 |
for a listWidgets #list property. |
|
238 |
Here, a corresponding message is sent to myself, |
|
239 |
which ought to be defined in the application subclass. |
|
240 |
Alternatively, a subclass may redefine this method, to provide |
|
241 |
holders from a Dictionary or whatever. |
|
242 |
Typically, a list-holding model (SelectionInList) is returned there." |
|
243 |
||
483 | 244 |
|app| |
421 | 245 |
|
483 | 246 |
(app := self application) notNil ifTrue:[ |
247 |
(app respondsTo:aKey) ifTrue:[ |
|
248 |
^ app perform:aKey |
|
249 |
] |
|
250 |
]. |
|
251 |
^ nil. |
|
252 |
||
253 |
"Modified: 4.3.1997 / 00:53:03 / cg" |
|
421 | 254 |
! |
255 |
||
256 |
menuFor:aKey |
|
257 |
"sent by the builder to ask for an application provided |
|
258 |
holder for a menu. |
|
259 |
The argument, aKey comes from an UI-spec |
|
260 |
for a widgets #menu property. |
|
261 |
Here, a corresponding message is sent to myself, |
|
262 |
which ought to be defined in the application subclass. |
|
263 |
Alternatively, a subclass may redefine this method, to provide |
|
264 |
holders from a Dictionary or whatever. |
|
265 |
Typically, a menu or a menu-holding valueHolder is returned there." |
|
266 |
||
267 |
^ self application perform:aKey |
|
268 |
||
269 |
! |
|
270 |
||
271 |
specificationFor:aKey |
|
272 |
"sent by the builder to ask for an application provided |
|
273 |
component. |
|
274 |
The argument, aKey comes from an UI-spec |
|
275 |
for a viewHolders #specification property. |
|
276 |
Here, a corresponding message is sent to myself, |
|
277 |
which ought to be defined in the application subclass. |
|
278 |
Alternatively, a subclass may redefine this method, to provide |
|
279 |
holders from a Dictionary or whatever. |
|
280 |
Typically, a view is returned there." |
|
281 |
||
282 |
^ self application perform:aKey |
|
283 |
||
284 |
! |
|
285 |
||
286 |
visualFor:aKey |
|
287 |
"sent by the builder to ask for an application provided |
|
288 |
image or element for a label. |
|
289 |
The argument, aKey comes from an UI-spec |
|
290 |
for a widgets #label property, if LabelIsImage is turned on. |
|
291 |
Here, a corresponding message is sent to myself, |
|
292 |
which ought to be defined in the application subclass. |
|
293 |
Alternatively, a subclass may redefine this method, to provide |
|
294 |
images from a Dictionary or whatever. |
|
295 |
Typically, an image is returned there." |
|
296 |
||
297 |
(self application respondsTo:aKey) ifTrue:[ |
|
298 |
^ self application perform:aKey |
|
299 |
]. |
|
300 |
^ self application visualAt:aKey ifAbsent:nil |
|
301 |
||
302 |
||
303 |
! ! |
|
304 |
||
361 | 305 |
!ApplicationModel class methodsFor:'change & update'! |
52 | 306 |
|
302 | 307 |
update:something with:aParameter from:changedObject |
69 | 308 |
"flush resources on language changes" |
309 |
||
52 | 310 |
something == #Language ifTrue:[ |
302 | 311 |
"flush resources on language changes" |
312 |
self flushAllClassResources |
|
52 | 313 |
] |
302 | 314 |
|
315 |
"Created: 15.6.1996 / 15:13:29 / cg" |
|
52 | 316 |
! ! |
317 |
||
421 | 318 |
!ApplicationModel class methodsFor:'defaults'! |
319 |
||
320 |
labelAt:aKey |
|
321 |
^ nil |
|
322 |
! |
|
323 |
||
324 |
labelAt:aKey ifAbsent:aBlock |
|
325 |
^ aBlock value |
|
326 |
! |
|
327 |
||
328 |
labelAt:aKey put:aValue |
|
329 |
"/ not yet implemented |
|
330 |
! |
|
331 |
||
332 |
labels |
|
333 |
"/ not yet implemented |
|
334 |
^ nil |
|
335 |
! |
|
336 |
||
337 |
visualAt:aKey |
|
338 |
^ nil |
|
339 |
! |
|
340 |
||
341 |
visualAt:aKey ifAbsent:aBlock |
|
342 |
^ aBlock value |
|
343 |
! |
|
344 |
||
345 |
visualAt:aKey put:aValue |
|
346 |
"/ not yet implemented |
|
347 |
! |
|
348 |
||
349 |
visuals |
|
350 |
"/ not yet implemented |
|
351 |
^ nil |
|
352 |
! ! |
|
353 |
||
361 | 354 |
!ApplicationModel class methodsFor:'queries'! |
63 | 355 |
|
356 |
interfaceSpecFor:aSelector |
|
69 | 357 |
"return an interface spec" |
358 |
||
421 | 359 |
^ UISpecification from:(self application specificationFor:aSelector) |
63 | 360 |
! ! |
361 |
||
361 | 362 |
!ApplicationModel class methodsFor:'resources'! |
52 | 363 |
|
364 |
classResources |
|
365 |
"if not already loaded, get the classes resourcePack |
|
366 |
and return it" |
|
367 |
||
368 |
ClassResources isNil ifTrue:[ |
|
369 |
ClassResources := ResourcePack for:self. |
|
370 |
]. |
|
371 |
^ ClassResources |
|
372 |
! |
|
373 |
||
374 |
classResources:aResourcePack |
|
375 |
"allow setting of the classResources" |
|
376 |
||
377 |
ClassResources := aResourcePack |
|
378 |
! |
|
379 |
||
380 |
flushAllClassResources |
|
381 |
"flush all classes resource translations. |
|
382 |
Needed after a resource file / language setting has changed." |
|
383 |
||
384 |
ResourcePack flushCachedResourcePacks. |
|
385 |
self flushClassResources. |
|
386 |
self allSubclassesDo:[:aClass | |
|
387 |
aClass flushClassResources. |
|
388 |
] |
|
389 |
! |
|
390 |
||
391 |
flushClassResources |
|
392 |
"flush classes resource string translations. |
|
393 |
Needed whenever a resource file / language setting has changed" |
|
394 |
||
395 |
ClassResources := nil. |
|
63 | 396 |
! |
397 |
||
398 |
updateClassResources |
|
399 |
"update my classResources" |
|
400 |
||
401 |
ClassResources := nil. |
|
402 |
self classResources |
|
52 | 403 |
! ! |
404 |
||
361 | 405 |
!ApplicationModel class methodsFor:'startup'! |
138 | 406 |
|
407 |
open |
|
408 |
"create an instance of the application and open its view" |
|
409 |
||
240 | 410 |
^ self new open |
138 | 411 |
|
412 |
" |
|
361 | 413 |
Launcher open |
138 | 414 |
" |
240 | 415 |
|
361 | 416 |
"Modified: 13.1.1997 / 20:54:50 / cg" |
138 | 417 |
! |
418 |
||
428 | 419 |
openAt:aLocation |
420 |
"create an instance of the application and open its view |
|
421 |
at some position." |
|
422 |
||
423 |
^ self new openAt:aLocation |
|
424 |
||
425 |
"Modified: 14.2.1997 / 20:28:41 / cg" |
|
426 |
! |
|
427 |
||
428 |
openDialogInterface:anInterfaceSymbol |
|
429 |
"create an instance of the application and open a view as |
|
430 |
specified by anInterfaceSymbol." |
|
431 |
||
464
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
432 |
^ self openDialogInterface:anInterfaceSymbol withBindings:nil |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
433 |
|
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
434 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
435 |
"Created: 14.2.1997 / 20:33:10 / cg" |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
436 |
"Modified: 28.2.1997 / 14:07:36 / cg" |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
437 |
! |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
438 |
|
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
439 |
openDialogInterface:anInterfaceSymbol withBindings:bindings |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
440 |
"create an instance of the application and open a view as |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
441 |
specified by anInterfaceSymbol." |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
442 |
|
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
443 |
^ self new openDialogInterface:anInterfaceSymbol withBindings:bindings |
428 | 444 |
|
445 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
|
446 |
"Modified: 13.1.1997 / 20:55:02 / cg" |
|
464
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
447 |
"Created: 28.2.1997 / 14:07:24 / cg" |
428 | 448 |
! |
449 |
||
138 | 450 |
openInterface:anInterfaceSymbol |
451 |
"create an instance of the application and open a view as |
|
452 |
specified by anInterfaceSymbol." |
|
453 |
||
361 | 454 |
^ self new openInterface:anInterfaceSymbol |
138 | 455 |
|
456 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
|
361 | 457 |
"Modified: 13.1.1997 / 20:55:02 / cg" |
138 | 458 |
! |
459 |
||
428 | 460 |
openInterface:anInterfaceSymbol at:aPoint |
461 |
"create an instance of the application and open a view as |
|
462 |
specified by anInterfaceSymbol." |
|
463 |
||
464 |
^ self new openInterface:anInterfaceSymbol at:aPoint |
|
465 |
||
466 |
"Modified: 14.2.1997 / 20:28:47 / cg" |
|
467 |
! |
|
468 |
||
138 | 469 |
openOn:anApplicationModel |
215 | 470 |
"send an open message to the argument, anApplicationModel. |
471 |
I dont really understand what this method is useful for ..." |
|
138 | 472 |
|
361 | 473 |
^ anApplicationModel open |
215 | 474 |
|
361 | 475 |
"Modified: 13.1.1997 / 20:55:05 / cg" |
138 | 476 |
! |
477 |
||
478 |
openOnDevice:aDevice |
|
479 |
"create an instance of the application and open its view |
|
215 | 480 |
on ANOTHER device. |
481 |
For more info, read the document on multiple display |
|
482 |
support and the documentation of the DeviceWorkstation class." |
|
138 | 483 |
|
361 | 484 |
^ (self onDevice:aDevice) open |
215 | 485 |
|
361 | 486 |
" |
487 |
Launcher openOnDevice:Display |
|
488 |
" |
|
489 |
||
490 |
"Modified: 13.1.1997 / 20:55:27 / cg" |
|
138 | 491 |
! ! |
492 |
||
493 |
!ApplicationModel methodsFor:'accessing'! |
|
494 |
||
421 | 495 |
application |
496 |
^ self class |
|
497 |
! |
|
498 |
||
138 | 499 |
builder |
500 |
"return the applications builder; this one has more information |
|
501 |
about views, components etc." |
|
502 |
||
503 |
^ builder |
|
504 |
! |
|
505 |
||
506 |
builder:aBuilder |
|
507 |
"set the applications builder. Normally, you should not set it |
|
508 |
directly, but depend on the default builder, as created when the application |
|
509 |
was created." |
|
510 |
||
511 |
builder := aBuilder |
|
512 |
! |
|
513 |
||
514 |
focusSequence |
|
515 |
"return a focusSequence for stepping through the applications views. |
|
516 |
The builder usually keeps track of so-called 'tabable' views. |
|
517 |
Stepping is done with the FocusNext/FocusPrevius keys, which are |
|
518 |
typically bound to Meta-CursorUp/Meta-CursorDown. |
|
519 |
Subclasses which do not use the builder (but instead build their view |
|
520 |
programmatically) should redefine this method to return a collection of |
|
521 |
views which defines the sequence." |
|
522 |
||
523 |
builder notNil ifTrue:[ |
|
524 |
^ builder focusSequence |
|
525 |
]. |
|
526 |
^ nil |
|
527 |
! |
|
528 |
||
529 |
resources |
|
530 |
"return the applications resources - thats a ResourcePack containing |
|
531 |
language strings" |
|
532 |
||
533 |
^ resources |
|
534 |
! |
|
535 |
||
536 |
window |
|
537 |
"return my topWindow" |
|
538 |
||
539 |
^ builder window |
|
540 |
! |
|
541 |
||
187 | 542 |
window:aTopView |
543 |
"set my topWindow" |
|
544 |
||
545 |
builder window:aTopView |
|
546 |
||
547 |
"Created: 18.4.1996 / 14:55:26 / cg" |
|
548 |
! |
|
549 |
||
138 | 550 |
windowGroup |
551 |
"return the applications windowGroup" |
|
552 |
||
553 |
^ builder window windowGroup |
|
554 |
! ! |
|
555 |
||
371
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
556 |
!ApplicationModel methodsFor:'binding access'! |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
557 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
558 |
actionFor:aKey |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
559 |
"sent by the builder to ask for an actionBlock for |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
560 |
a Button. The argument, aKey comes from an UI-spec |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
561 |
for a buttons #action property. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
562 |
Here, a corresponding message is sent to myself, |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
563 |
which ought to be defined in the application subclass. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
564 |
Alternatively, a subclass may redefine this method, to provide |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
565 |
actionBlocks from a Dictionary or whatever. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
566 |
Typically, a block is returned there." |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
567 |
|
421 | 568 |
^ [self perform:aKey] |
371
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
569 |
! |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
570 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
571 |
aspectFor:aKey |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
572 |
"sent by the builder to ask for an aspect (a data model). |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
573 |
The argument, aKey comes from an UI-spec |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
574 |
for a components #aspect property. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
575 |
Here, a corresponding message is sent to myself, |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
576 |
which ought to be defined in the application subclass. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
577 |
Alternatively, a subclass may redefine this method, to provide |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
578 |
holders from a Dictionary or whatever. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
579 |
Typically, a valueHolder is returned there." |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
580 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
581 |
^ self perform:aKey |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
582 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
583 |
! |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
584 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
585 |
clientFor:aKey |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
586 |
"sent by the builder to ask for an application provided |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
587 |
subcanvas's application. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
588 |
The argument, aKey comes from an UI-spec |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
589 |
for a subcanvas's #client property. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
590 |
Here, a corresponding message is sent to myself, |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
591 |
which ought to be defined in the application subclass. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
592 |
Alternatively, a subclass may redefine this method, to provide |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
593 |
appModels from a Dictionary or whatever. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
594 |
Typically, an applicationModel is returned there." |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
595 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
596 |
^ self perform:aKey |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
597 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
598 |
! |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
599 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
600 |
componentFor:aKey |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
601 |
"sent by the builder to ask for an application provided |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
602 |
component. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
603 |
The argument, aKey comes from an UI-spec |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
604 |
for a viewHolders #view property. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
605 |
Here, a corresponding message is sent to myself, |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
606 |
which ought to be defined in the application subclass. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
607 |
Alternatively, a subclass may redefine this method, to provide |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
608 |
holders from a Dictionary or whatever. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
609 |
Typically, a view is returned there." |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
610 |
|
421 | 611 |
(self respondsTo:aKey) ifTrue:[ |
612 |
^ self perform:aKey |
|
613 |
]. |
|
614 |
^ self application componentFor:aKey |
|
371
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
615 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
616 |
! |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
617 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
618 |
labelFor:aKey |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
619 |
"sent by the builder to ask for an application provided |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
620 |
label for a component. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
621 |
The argument, aKey comes from an UI-spec |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
622 |
for a components #label property. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
623 |
Here, a corresponding message is sent to myself, |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
624 |
which ought to be defined in the application subclass. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
625 |
Alternatively, a subclass may redefine this method, to provide |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
626 |
labels from a Dictionary or whatever. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
627 |
Typically, a string is returned there." |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
628 |
|
421 | 629 |
^ self application labelFor:aKey |
371
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
630 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
631 |
! |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
632 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
633 |
listFor:aKey |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
634 |
"sent by the builder to ask for an application provided |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
635 |
holder for a list. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
636 |
The argument, aKey comes from an UI-spec |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
637 |
for a listWidgets #list property. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
638 |
Here, a corresponding message is sent to myself, |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
639 |
which ought to be defined in the application subclass. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
640 |
Alternatively, a subclass may redefine this method, to provide |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
641 |
holders from a Dictionary or whatever. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
642 |
Typically, a list-holding model (SelectionInList) is returned there." |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
643 |
|
421 | 644 |
(self respondsTo:aKey) ifTrue:[ |
645 |
^ self perform:aKey |
|
646 |
]. |
|
647 |
^ self application listFor:aKey |
|
371
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
648 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
649 |
! |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
650 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
651 |
menuFor:aKey |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
652 |
"sent by the builder to ask for an application provided |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
653 |
holder for a menu. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
654 |
The argument, aKey comes from an UI-spec |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
655 |
for a widgets #menu property. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
656 |
Here, a corresponding message is sent to myself, |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
657 |
which ought to be defined in the application subclass. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
658 |
Alternatively, a subclass may redefine this method, to provide |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
659 |
holders from a Dictionary or whatever. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
660 |
Typically, a menu or a menu-holding valueHolder is returned there." |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
661 |
|
421 | 662 |
(self respondsTo:aKey) ifTrue:[ |
663 |
^ self perform:aKey |
|
664 |
]. |
|
665 |
^ self application menuFor:aKey |
|
666 |
||
667 |
! |
|
668 |
||
669 |
specificationFor:aKey |
|
670 |
"sent by the builder to ask for an application provided |
|
671 |
subcanvas's application. |
|
672 |
The argument, aKey comes from an UI-spec |
|
673 |
for a subcanvas's #specification property. |
|
674 |
Here, a corresponding message is sent to myself, |
|
675 |
which ought to be defined in the application subclass. |
|
676 |
Alternatively, a subclass may redefine this method, to provide |
|
677 |
appModels from a Dictionary or whatever. |
|
678 |
Typically, an applicationModel is returned there." |
|
679 |
||
371
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
680 |
^ self perform:aKey |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
681 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
682 |
! |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
683 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
684 |
visualFor:aKey |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
685 |
"sent by the builder to ask for an application provided |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
686 |
image or element for a label. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
687 |
The argument, aKey comes from an UI-spec |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
688 |
for a widgets #label property, if LabelIsImage is turned on. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
689 |
Here, a corresponding message is sent to myself, |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
690 |
which ought to be defined in the application subclass. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
691 |
Alternatively, a subclass may redefine this method, to provide |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
692 |
images from a Dictionary or whatever. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
693 |
Typically, an image is returned there." |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
694 |
|
421 | 695 |
^ self application visualFor:aKey |
371
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
696 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
697 |
! ! |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
698 |
|
428 | 699 |
!ApplicationModel methodsFor:'component manipulations'! |
700 |
||
701 |
components:aSymbolOrArray do:aBlock |
|
702 |
"evaluate aBlock for all components listed aSymbolOrArray." |
|
703 |
||
704 |
|coll| |
|
705 |
||
706 |
aSymbolOrArray isSymbol ifTrue:[ |
|
707 |
"/ a single components name |
|
708 |
coll := Array with:aSymbolOrArray |
|
709 |
] ifFalse:[ |
|
710 |
coll := aSymbolOrArray |
|
711 |
]. |
|
712 |
coll do:[:aSymbol | |
|
713 |
|component| |
|
714 |
||
500 | 715 |
(component := self componentFor:aSymbol) isNil ifFalse:[ |
428 | 716 |
aBlock value:component |
717 |
] |
|
718 |
] |
|
719 |
||
500 | 720 |
"Modified: 26.3.1997 / 16:23:14 / cg" |
428 | 721 |
! |
722 |
||
723 |
disable:aSymbolOrArray |
|
724 |
"disable the components whose id's are aSymbolOrArray." |
|
725 |
||
726 |
self components:aSymbolOrArray do:[:comp | comp disable] |
|
727 |
||
728 |
"Modified: 14.2.1997 / 17:32:09 / cg" |
|
729 |
! |
|
730 |
||
731 |
enable:aSymbolOrArray |
|
732 |
"enables the component(s) identified by aSymbolOrArray." |
|
733 |
||
734 |
self components:aSymbolOrArray do:[:comp | comp enable] |
|
735 |
||
736 |
"Modified: 14.2.1997 / 17:32:19 / cg" |
|
737 |
! |
|
738 |
||
739 |
invalidate:aSymbolOrArray |
|
740 |
"invalidates the component(s) identified by aSymbolOrArray." |
|
741 |
||
742 |
self components:aSymbolOrArray do:[:comp | comp invalidate] |
|
743 |
||
744 |
"Modified: 14.2.1997 / 17:32:28 / cg" |
|
745 |
! |
|
746 |
||
747 |
makeInvisible:aSymbolOrArray |
|
748 |
"makes the components whose id's are aSymbolOrArray invisible" |
|
749 |
||
750 |
self components:aSymbolOrArray do:[:comp | comp beInvisible] |
|
751 |
||
752 |
"Modified: 14.2.1997 / 17:32:42 / cg" |
|
753 |
! |
|
754 |
||
755 |
makeReadOnly:aSymbolOrArray |
|
756 |
"make all components identified by aSymbolOrArray read only |
|
757 |
(for editText components)." |
|
758 |
||
759 |
self components:aSymbolOrArray do:[:comp | comp readOnly:true] |
|
760 |
||
761 |
"Modified: 14.2.1997 / 17:36:22 / cg" |
|
762 |
! |
|
763 |
||
764 |
makeVisible:aSymbolOrArray |
|
765 |
"makes the components whose id's are aSymbolOrArray visible" |
|
766 |
||
767 |
self components:aSymbolOrArray do:[:comp | comp beVisible] |
|
768 |
||
769 |
"Modified: 14.2.1997 / 17:32:52 / cg" |
|
770 |
! |
|
771 |
||
772 |
makeWritable:aSymbolOrArray |
|
773 |
"make all components identified by aSymbolOrArray writable |
|
774 |
(for editText components)." |
|
775 |
||
776 |
self components:aSymbolOrArray do:[:comp | comp readOnly:false] |
|
777 |
||
778 |
"Created: 14.2.1997 / 17:36:17 / cg" |
|
779 |
! ! |
|
780 |
||
781 |
!ApplicationModel methodsFor:'drag & drop'! |
|
782 |
||
521
2937b6c596b3
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
783 |
canDrop:aCollectionOfDropObjects in:aComponent |
428 | 784 |
"drop manager asked if a drop is possible |
785 |
- should be redefined by apps which can do it, to return true" |
|
786 |
||
787 |
^ false |
|
788 |
||
521
2937b6c596b3
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
789 |
"Modified: 11.4.1997 / 12:42:47 / cg" |
428 | 790 |
! |
791 |
||
521
2937b6c596b3
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
792 |
drop:aCollectionOfDropObjects in:aComponent at:aPoint |
428 | 793 |
"drop manager wants to drop. |
794 |
This is ony sent, if #canDrop:in: returned true. |
|
795 |
Must be redefined in apps which return true to #canDrop." |
|
796 |
||
797 |
self subclassResponsibility |
|
798 |
||
521
2937b6c596b3
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
799 |
"Modified: 11.4.1997 / 12:43:19 / cg" |
428 | 800 |
! ! |
801 |
||
429 | 802 |
!ApplicationModel methodsFor:'easy bindings'! |
803 |
||
804 |
registerInterestIn: aValueModel using: aSelectorOrArray |
|
805 |
"Register interest in a change in aValueModel using information in aSelectorOrArray. |
|
806 |
aSelectorOrArray can be one of three things: |
|
807 |
||
808 |
1) nil in which case no interest is registered |
|
809 |
2) a selector in which case the receiver is understood to be self |
|
810 |
3) an Array in which case the size is two where the first element is the |
|
811 |
message to be sent and the second element is the receiver." |
|
812 |
||
813 |
aSelectorOrArray isNil ifTrue: [^ aValueModel]. |
|
814 |
||
815 |
(aSelectorOrArray isKindOf:Array) ifTrue:[ |
|
816 |
aValueModel onChangeSend:(aSelectorOrArray at: 1) to:(aSelectorOrArray at: 2) |
|
817 |
] ifFalse: [ |
|
818 |
aValueModel onChangeSend:aSelectorOrArray to:self |
|
819 |
]. |
|
820 |
^aValueModel |
|
821 |
||
822 |
||
823 |
! |
|
824 |
||
825 |
valueHolderFor:aSelector initialValue:anObject |
|
826 |
"Return a ValueHolder on anObject." |
|
827 |
||
828 |
^ self valueHolderFor:aSelector initialValue:anObject changeMessage:nil |
|
829 |
||
830 |
||
831 |
! |
|
832 |
||
833 |
valueHolderFor: aSelector initialValue: anObject changeMessage: aSelectorOrArray |
|
834 |
"Return a ValueHolder on anObject. aSelectorOrArray is the change information |
|
835 |
for the ValueHolder. This argument is either a Symbol or an Array of two elements. |
|
836 |
If it is a Symbol, then it is the change message and the interested object is understood |
|
837 |
to be the reciever. If it is an Array, then the first element is the change message and |
|
838 |
the second element is the interested object. " |
|
839 |
||
840 |
(self builder bindings includesKey:aSelector) ifFalse:[ |
|
841 |
^ self registerInterestIn:(ValueHolder with:anObject) using:aSelectorOrArray |
|
842 |
]. |
|
843 |
^ self builder aspectAt:aSelector |
|
844 |
||
845 |
! ! |
|
846 |
||
52 | 847 |
!ApplicationModel methodsFor:'initialization'! |
848 |
||
138 | 849 |
addTopViewsToCurrentProject |
850 |
"add all of my topViews to the current projects list of views. |
|
371
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
851 |
This allows hiding views on a per-project basis. |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
852 |
Applications which do not want to be switched with projects |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
853 |
(such as the Launcher), may redefine this to a noop." |
85 | 854 |
|
138 | 855 |
self windowGroup topViews do:[:aView | |
371
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
856 |
aView addToCurrentProject |
138 | 857 |
] |
371
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
858 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
859 |
"Modified: 17.1.1997 / 19:43:39 / cg" |
85 | 860 |
! |
861 |
||
63 | 862 |
basicInitialize |
69 | 863 |
"initialize the application. |
371
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
864 |
Since ST-80 applications seem commonly to redefine #initialize |
69 | 865 |
without doing a super initialize, the real initialization is |
866 |
done here ..." |
|
867 |
||
52 | 868 |
super initialize. |
72 | 869 |
|
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
870 |
device := Screen current. |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
871 |
|
72 | 872 |
"claus: I wanted to delay the creation & assignment of the |
873 |
builder till later, to allow setting to another builder. |
|
874 |
however, some ST-80 code accesses the builder right after instance |
|
875 |
creation ..." |
|
876 |
||
877 |
"/ " |
|
878 |
"/ Create a windowBuilder to have someone around which |
|
879 |
"/ understands the builder protocol. Since UIBuilder is not present |
|
880 |
"/ in all systems, this allows operation without one (unless a spec |
|
881 |
"/ is read later ...) |
|
882 |
"/ " |
|
85 | 883 |
builder := self createBuilder. |
78 | 884 |
builder notNil ifTrue:[builder application:self]. |
52 | 885 |
resources := self class classResources. |
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
886 |
|
371
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
887 |
"Modified: 17.1.1997 / 19:41:59 / cg" |
63 | 888 |
! |
889 |
||
138 | 890 |
createBuilder |
891 |
"create a UI Builder for me. |
|
892 |
This method can be redefined if (eventually) there are |
|
893 |
spec readers for other UI languages (motif UIL ?)" |
|
894 |
||
895 |
|cls| |
|
896 |
||
897 |
(cls := UIBuilder) isNil ifTrue:[ |
|
898 |
(cls := WindowBuilder) isNil ifTrue:[ |
|
899 |
^ nil |
|
900 |
] |
|
901 |
]. |
|
902 |
^ cls new |
|
903 |
! |
|
904 |
||
63 | 905 |
initialize |
83 | 906 |
"nothing done here; |
907 |
but can be redefined in concrete applications" |
|
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
908 |
! |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
909 |
|
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
910 |
setDevice:aDevice |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
911 |
"set the device (i.e. some Screen), where the application |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
912 |
shall open its view(s). |
371
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
913 |
The default device (if not set here) will be the current screen." |
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
914 |
|
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
915 |
device := aDevice |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
916 |
|
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
917 |
"Created: 5.7.1996 / 12:01:40 / cg" |
371
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
918 |
"Modified: 17.1.1997 / 19:44:09 / cg" |
138 | 919 |
! ! |
920 |
||
921 |
!ApplicationModel methodsFor:'misc'! |
|
922 |
||
287 | 923 |
restoreCursors |
924 |
"restore the original cursors in all of my views" |
|
925 |
||
926 |
^ self window windowGroup restoreCursors |
|
927 |
||
928 |
"Created: 1.6.1996 / 17:01:24 / cg" |
|
929 |
! |
|
930 |
||
931 |
showCursor:aCursor |
|
932 |
"set all of my views cursor to aCursor. |
|
933 |
It can be restored with #restoreCursor." |
|
934 |
||
935 |
^ self window windowGroup showCursor:aCursor |
|
936 |
||
937 |
"Created: 1.6.1996 / 17:01:09 / cg" |
|
938 |
! |
|
939 |
||
138 | 940 |
withCursor:aCursor do:aBlock |
941 |
"evaluate aBlock, showing aCursor in my topView and all of its subviews. |
|
942 |
Return the value of aBlock." |
|
943 |
||
944 |
^ self window withCursor:aCursor do:aBlock |
|
63 | 945 |
! |
946 |
||
142
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
947 |
withExecuteCursorDo:aBlock |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
948 |
"evaluate aBlock, showing an executeCursor in my topView and all of its subviews. |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
949 |
Return the value of aBlock." |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
950 |
|
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
951 |
^ self withCursor:(Cursor execute) do:aBlock |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
952 |
|
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
953 |
"Created: 14.12.1995 / 20:57:03 / cg" |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
954 |
! |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
955 |
|
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
956 |
withReadCursorDo:aBlock |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
957 |
"evaluate aBlock, showing a readCursor in my topView and all of its subviews. |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
958 |
Return the value of aBlock." |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
959 |
|
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
960 |
^ self withCursor:(Cursor read) do:aBlock |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
961 |
|
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
962 |
"Created: 14.12.1995 / 20:56:47 / cg" |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
963 |
"Modified: 14.12.1995 / 20:57:36 / cg" |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
964 |
! |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
965 |
|
138 | 966 |
withWaitCursorDo:aBlock |
967 |
"evaluate aBlock, showing a waitCursor in my topView and all of its subviews. |
|
968 |
Return the value of aBlock." |
|
63 | 969 |
|
138 | 970 |
^ self withCursor:Cursor wait do:aBlock |
52 | 971 |
! ! |
57 | 972 |
|
428 | 973 |
!ApplicationModel methodsFor:'opening'! |
974 |
||
975 |
openDialog |
|
976 |
"open the window - assumes that the builder has already setup |
|
977 |
the interface." |
|
978 |
||
432 | 979 |
^ builder openDialog. |
428 | 980 |
|
981 |
"Modified: 14.2.1997 / 20:32:52 / cg" |
|
982 |
! |
|
983 |
||
429 | 984 |
openDialogInterface:aSelector |
985 |
"open a dialog" |
|
986 |
||
464
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
987 |
^ self openDialogInterface:aSelector withBindings:nil |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
988 |
|
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
989 |
"Modified: 28.2.1997 / 14:08:01 / cg" |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
990 |
! |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
991 |
|
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
992 |
openDialogInterface:aSelector withBindings:bindings |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
993 |
"open a dialog" |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
994 |
|
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
995 |
^ SimpleDialog new openFor:self interface:aSelector withBindings:bindings |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
996 |
|
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
997 |
"Created: 28.2.1997 / 14:07:45 / cg" |
429 | 998 |
! |
999 |
||
428 | 1000 |
openWindow |
1001 |
"open the window - assumes that the builder has already setup |
|
1002 |
the interface." |
|
1003 |
||
438 | 1004 |
builder open. |
428 | 1005 |
|
1006 |
"Created: 14.2.1997 / 20:20:39 / cg" |
|
1007 |
! |
|
1008 |
||
1009 |
openWindowAt:aLocation |
|
1010 |
"open the window - assumes that the builder has already setup |
|
1011 |
the interface." |
|
1012 |
||
1013 |
builder openWindowAt:aLocation. |
|
1014 |
||
1015 |
"Created: 14.2.1997 / 20:20:55 / cg" |
|
1016 |
! ! |
|
1017 |
||
1018 |
!ApplicationModel methodsFor:'private'! |
|
1019 |
||
1020 |
opened |
|
1021 |
"the topView has been opened. |
|
1022 |
This is sent by my topView when its really open |
|
1023 |
(i.e. finally visible)" |
|
1024 |
||
1025 |
self addTopViewsToCurrentProject. |
|
1026 |
self postOpenWith:builder |
|
1027 |
||
1028 |
"Modified: 14.2.1997 / 20:26:16 / cg" |
|
1029 |
! ! |
|
1030 |
||
71 | 1031 |
!ApplicationModel methodsFor:'queries'! |
1032 |
||
371
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1033 |
defaultWindowType |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1034 |
"Applications come up non-modal, by default" |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1035 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1036 |
^ #normal |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1037 |
|
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1038 |
"Created: 17.1.1997 / 19:57:34 / cg" |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1039 |
! |
ce94ec6a38ee
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1040 |
|
313
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
1041 |
graphicsDevice |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
1042 |
"return the device I want to open my views on. |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
1043 |
The default (if not created with #onDevice:) is the currently |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
1044 |
active screen." |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
1045 |
|
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
1046 |
^ device |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
1047 |
|
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
1048 |
"Created: 5.7.1996 / 17:51:31 / cg" |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
1049 |
! |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
1050 |
|
71 | 1051 |
processName |
1052 |
"return a name to be shown for me in the process monitor" |
|
1053 |
||
1054 |
^ 'Application' |
|
1055 |
! ! |
|
1056 |
||
428 | 1057 |
!ApplicationModel methodsFor:'startup / release'! |
57 | 1058 |
|
63 | 1059 |
allButOpenFrom:aSpec |
69 | 1060 |
"create my views but do not open the main window" |
1061 |
||
71 | 1062 |
|realBuilder| |
1063 |
||
72 | 1064 |
"/ DISABLED; see comment in basicInitialize |
1065 |
"/ |
|
1066 |
"/ " |
|
1067 |
"/ here, we kludge a bit: up to now, the builder was an |
|
1068 |
"/ instance of the no-op WindowBuilder. Now, it becomes |
|
1069 |
"/ a UIBuilder .... |
|
1070 |
"/ This allows for ApplicationModels without a UIBuilder |
|
1071 |
"/ if not needed. |
|
1072 |
"/ " |
|
1073 |
"/ realBuilder := UIBuilder new. |
|
1074 |
"/ builder := realBuilder. |
|
1075 |
"/ builder application:self. |
|
1076 |
"/ builder bindings:builder bindings. |
|
71 | 1077 |
|
63 | 1078 |
self preBuildWith:builder. |
1079 |
builder buildFromSpec:aSpec. |
|
85 | 1080 |
builder window model:self. |
472 | 1081 |
(builder window respondsTo:#application:) ifTrue:[ |
1082 |
builder window application:self. |
|
1083 |
]. |
|
63 | 1084 |
self postBuildWith:builder. |
1085 |
! |
|
57 | 1086 |
|
138 | 1087 |
allButOpenInterface:aSymbol |
1088 |
"create my views but do not open the main window" |
|
1089 |
||
1090 |
|spec| |
|
1091 |
||
1092 |
spec := self class interfaceSpecFor:aSymbol. |
|
1093 |
self allButOpenFrom:spec. |
|
1094 |
^ builder |
|
1095 |
! |
|
1096 |
||
1097 |
close |
|
1098 |
"this is sent by my topView when about to be closed |
|
1099 |
by the program (not by the windowManager). |
|
1100 |
Could be redefined in subclasses." |
|
1101 |
||
1102 |
self closeDownViews |
|
1103 |
! |
|
1104 |
||
1105 |
closeDownViews |
|
435 | 1106 |
"close down the applications view(s)" |
138 | 1107 |
|
1108 |
|wg views| |
|
1109 |
||
1110 |
(wg := self windowGroup) notNil ifTrue:[ |
|
435 | 1111 |
views := wg topViews. |
1112 |
views notNil ifTrue:[ |
|
1113 |
views copy do:[:aView | |
|
1114 |
aView notNil ifTrue:[aView destroy] |
|
1115 |
] |
|
1116 |
] |
|
138 | 1117 |
] |
1118 |
! |
|
1119 |
||
1120 |
closeRequest |
|
482
c357e80669e9
close -> closeRequest leads to a cycle with ST-80 apps;
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
1121 |
"this is sent by my topView when about to be closed |
c357e80669e9
close -> closeRequest leads to a cycle with ST-80 apps;
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
1122 |
by the program (not by the windowManager). |
c357e80669e9
close -> closeRequest leads to a cycle with ST-80 apps;
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
1123 |
Could be redefined in subclasses to suppress close or confirm." |
138 | 1124 |
|
482
c357e80669e9
close -> closeRequest leads to a cycle with ST-80 apps;
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
1125 |
self closeDownViews |
c357e80669e9
close -> closeRequest leads to a cycle with ST-80 apps;
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
1126 |
|
c357e80669e9
close -> closeRequest leads to a cycle with ST-80 apps;
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
1127 |
"Modified: 4.3.1997 / 00:48:15 / cg" |
435 | 1128 |
! |
1129 |
||
1130 |
closeRequestFor:aTopView |
|
1131 |
"this is sent by any of my topViews when about to be closed by the |
|
1132 |
windowmanager. For backward compatibility with single-view applications, |
|
1133 |
this is forwarded here to a simple (non topView-specific) closeRequest. |
|
1134 |
MultiView applications should redefine this method if closing of individual |
|
1135 |
views closing is to be cought." |
|
1136 |
||
1137 |
^ self closeRequest |
|
138 | 1138 |
! |
1139 |
||
69 | 1140 |
open |
1141 |
"open a standard interface" |
|
1142 |
||
240 | 1143 |
^ self openInterface |
1144 |
||
1145 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
69 | 1146 |
! |
1147 |
||
428 | 1148 |
openAt:aPoint |
1149 |
"open a standard interface at some point" |
|
1150 |
||
1151 |
^ self openInterfaceAt:aPoint |
|
1152 |
||
1153 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
1154 |
"Created: 14.2.1997 / 20:17:41 / cg" |
|
1155 |
! |
|
1156 |
||
63 | 1157 |
openInterface |
428 | 1158 |
"open a standard interface. |
215 | 1159 |
|
78 | 1160 |
Subclasses which do not have an interfaceSpec |
215 | 1161 |
should redefine this method and create & open their view(s) there. |
330
d7ce98930ad3
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
313
diff
changeset
|
1162 |
(see Launcher as an example)." |
69 | 1163 |
|
63 | 1164 |
self openInterface:#windowSpec |
215 | 1165 |
|
330
d7ce98930ad3
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
313
diff
changeset
|
1166 |
"Modified: 9.9.1996 / 22:39:23 / stefan" |
428 | 1167 |
"Modified: 14.2.1997 / 20:18:26 / cg" |
57 | 1168 |
! |
1169 |
||
63 | 1170 |
openInterface:aSymbol |
215 | 1171 |
"open a specific interface. |
1172 |
The argument, aSymbol specifies which interface. The concrete |
|
1173 |
application subclass must provide a method with that name, |
|
1174 |
which must return an interfaceSpec. This is forwarded to |
|
1175 |
the builder to create the views. |
|
69 | 1176 |
Typically, applications only use one interface, |
78 | 1177 |
returned by the #windowSpec method." |
69 | 1178 |
|
85 | 1179 |
self allButOpenInterface:aSymbol. |
428 | 1180 |
self openWindow. |
63 | 1181 |
^ builder |
215 | 1182 |
|
428 | 1183 |
"Modified: 14.2.1997 / 20:25:33 / cg" |
1184 |
! |
|
1185 |
||
1186 |
openInterface:aSymbol at:aLocation |
|
1187 |
"open a specific interface. |
|
1188 |
||
1189 |
The argument, aSymbol specifies which interface. The concrete |
|
1190 |
application subclass must provide a method with that name, |
|
1191 |
which must return an interfaceSpec. This is forwarded to |
|
1192 |
the builder to create the views. |
|
1193 |
Typically, applications only use one interface, |
|
1194 |
returned by the #windowSpec method." |
|
1195 |
||
1196 |
self allButOpenInterface:aSymbol. |
|
1197 |
self openWindowAt:aLocation. |
|
1198 |
^ builder |
|
1199 |
||
1200 |
"Created: 14.2.1997 / 20:19:44 / cg" |
|
1201 |
! |
|
1202 |
||
1203 |
openInterfaceAt:aLocation |
|
1204 |
"open a standard interface." |
|
1205 |
||
1206 |
self openInterface:#windowSpec at:aLocation |
|
1207 |
||
1208 |
"Created: 14.2.1997 / 20:18:20 / cg" |
|
63 | 1209 |
! |
1210 |
||
362 | 1211 |
openOnDevice:aDevice |
1212 |
"open a standard interface on some other device" |
|
1213 |
||
1214 |
self setDevice:aDevice. |
|
1215 |
^ self open |
|
1216 |
||
1217 |
"Created: 13.1.1997 / 21:24:11 / cg" |
|
1218 |
"Modified: 13.1.1997 / 21:24:30 / cg" |
|
1219 |
! |
|
1220 |
||
138 | 1221 |
postBuildWith:aBuilder |
1222 |
"this is sent after an interface is built from a spec. |
|
1223 |
Can be redefined in subclasses. |
|
1224 |
mhmh - what should this do here ?" |
|
1225 |
! |
|
1226 |
||
1227 |
postOpenWith:aBuilder |
|
1228 |
"this is sent after the applications main window is opened. |
|
1229 |
Can be redefined in subclasses. |
|
1230 |
mhmh - what should this do here ?" |
|
1231 |
! |
|
1232 |
||
1233 |
preBuildWith:aBuilder |
|
1234 |
"this is sent before an interface is built from a spec. |
|
1235 |
Can be redefined in subclasses. |
|
1236 |
mhmh - what should this do here ?" |
|
1237 |
! |
|
1238 |
||
69 | 1239 |
restarted |
287 | 1240 |
"sent by my topWindow, when restarted from an image. |
69 | 1241 |
Nothing done here, but can be redefined to perform any actions |
1242 |
required to reset the application after an image-restart. |
|
1243 |
(for example: check if application files are still around, restart |
|
287 | 1244 |
subprocesses etc.)." |
1245 |
||
1246 |
"Modified: 1.6.1996 / 16:55:50 / cg" |
|
63 | 1247 |
! |
57 | 1248 |
|
63 | 1249 |
saveAndTerminateRequest |
1250 |
"some windowManagers send this to shut down an application |
|
1251 |
and have it save its state for restart. |
|
1252 |
Can be redefined in subclasses" |
|
1253 |
||
1254 |
self closeRequest |
|
437 | 1255 |
! |
1256 |
||
1257 |
saveAndTerminateRequestFor:aTopView |
|
1258 |
"some windowManagers send this to shut down an application |
|
1259 |
and have it save its state for restart. |
|
1260 |
Can be redefined in subclasses" |
|
1261 |
||
1262 |
self saveAndTerminateRequest |
|
57 | 1263 |
! ! |
72 | 1264 |
|
85 | 1265 |
!ApplicationModel methodsFor:'window events'! |
1266 |
||
144 | 1267 |
showActivity:someMessage |
215 | 1268 |
"some activityNotification shalt be communicated to |
1269 |
the user. Forwarded from the topView and ignored here. |
|
1270 |
Can be redefined in concrete applications to show the |
|
1271 |
message either in some infoView (infoLabel as in Windows) |
|
1272 |
or in the title area (as done in the browsers)" |
|
1273 |
||
144 | 1274 |
^ self |
1275 |
||
1276 |
"Created: 16.12.1995 / 18:41:04 / cg" |
|
215 | 1277 |
"Modified: 24.4.1996 / 09:34:22 / cg" |
144 | 1278 |
! |
1279 |
||
85 | 1280 |
windowEvent:anEvent from:anApplicationWindow |
215 | 1281 |
"dummy: windowEvent forwarding is not yet implemented" |
1282 |
||
85 | 1283 |
^ self |
215 | 1284 |
|
1285 |
"Modified: 24.4.1996 / 09:32:50 / cg" |
|
85 | 1286 |
! ! |
1287 |
||
361 | 1288 |
!ApplicationModel class methodsFor:'documentation'! |
72 | 1289 |
|
138 | 1290 |
version |
521
2937b6c596b3
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1291 |
^ '$Header: /cvs/stx/stx/libview2/Attic/AppModel.st,v 1.49 1997-04-11 10:47:38 cg Exp $' |
81 | 1292 |
! ! |
138 | 1293 |
ApplicationModel initialize! |