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