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