author | penk |
Thu, 15 Nov 2001 11:31:42 +0100 | |
changeset 1528 | a41738a52186 |
parent 1527 | f21dbafe8c3a |
child 1531 | fbd4aada038c |
permissions | -rw-r--r-- |
1419 | 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 |
"{ Package: 'stx:libview2' }" |
|
14 |
||
15 |
Model subclass:#ApplicationModel |
|
16 |
instanceVariableNames:'builder resources device masterApplication' |
|
17 |
classVariableNames:'DefaultLabels DefaultVisuals' |
|
1417 | 18 |
poolDictionaries:'' |
1419 | 19 |
category:'Interface-Framework' |
138 | 20 |
! |
21 |
||
1419 | 22 |
ApplicationModel class instanceVariableNames:'ClassResources' |
23 |
||
24 |
" |
|
25 |
No other class instance variables are inherited by this class. |
|
26 |
" |
|
1350 | 27 |
! |
28 |
||
1419 | 29 |
!ApplicationModel class methodsFor:'documentation'! |
30 |
||
1417 | 31 |
copyright |
1419 | 32 |
" |
33 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
34 |
All Rights Reserved |
|
35 |
||
36 |
This software is furnished under a license and may be used |
|
37 |
only in accordance with the terms of that license and with the |
|
38 |
inclusion of the above copyright notice. This software may not |
|
39 |
be provided or otherwise made available to, or used by, any |
|
40 |
other person. No title to or ownership of the software is |
|
41 |
hereby transferred. |
|
42 |
" |
|
43 |
! |
|
44 |
||
45 |
documentation |
|
46 |
" |
|
47 |
Since many ST-80 classes are subclasses of ApplicationModel, this class |
|
48 |
is provided here to allow easier porting of ST-80 code. |
|
49 |
||
50 |
It does not (currently) provide all functionality and is NOT |
|
51 |
compatible to the corresponding ST80 class; therefore, manual |
|
52 |
changes have to be made to get those applications to run under ST/X. |
|
53 |
(but at least, this enables you to fileIn that code and have a superclass |
|
54 |
for them) |
|
55 |
||
56 |
As time goes by, ST/X applications are going to be converted to |
|
57 |
become subclasses of this abstract class - see Launcher for a |
|
58 |
first concrete example. |
|
59 |
||
60 |
||
61 |
ApplicationModel is prepared to build a view from a windowSpec, as |
|
62 |
created by the windowBuilder. If your subclass does not provide such |
|
63 |
a spec, you should at least redefine: |
|
64 |
||
65 |
#openInterface - to create a topview and open it |
|
66 |
||
67 |
you may want to redefine: |
|
68 |
||
69 |
#closeRequest - to catch window closing |
|
70 |
#focusSequence - to define a sequence for focus-stepping |
|
71 |
||
72 |
||
73 |
Once the interfaceBuilder is finished & released, subclasses can |
|
74 |
alternatively provide the spec via a #windowSpec method. |
|
75 |
||
76 |
The classResources have been put into this class to allow ST/X |
|
77 |
applications (which used to be subclasses of StandardSystemView) |
|
78 |
to migrate smoothly into ApplicationModels (which is better design ...). |
|
79 |
||
80 |
||
81 |
[Instance variables:] |
|
82 |
resources ResourcePack language string translation |
|
83 |
||
84 |
builder WindowBuilder a builder who knows how to create |
|
85 |
a window hierarchy from a specification |
|
86 |
||
87 |
||
88 |
Notice: this class was implemented using protocol information |
|
89 |
from alpha testers and PD code - it may not be complete or compatible to |
|
90 |
the corresponding ST-80 class. If you encounter any incompatibilities, |
|
91 |
please forward a note to the ST/X team. |
|
92 |
||
93 |
||
94 |
[author:] |
|
95 |
Claus Gittinger |
|
96 |
||
97 |
[see also:] |
|
98 |
StandardSystemView |
|
99 |
WindowGroup DeviceWorkstation |
|
100 |
" |
|
101 |
! ! |
|
102 |
||
103 |
!ApplicationModel class methodsFor:'initialization'! |
|
104 |
||
105 |
initialize |
|
106 |
self == ApplicationModel ifTrue:[ |
|
107 |
Smalltalk addDependent:self |
|
108 |
]. |
|
109 |
DefaultLabels isNil ifTrue:[ |
|
110 |
DefaultLabels := IdentityDictionary new |
|
111 |
]. |
|
112 |
DefaultVisuals isNil ifTrue:[ |
|
113 |
DefaultVisuals := IdentityDictionary new |
|
114 |
]. |
|
115 |
||
116 |
" |
|
117 |
ApplicationModel initialize |
|
118 |
" |
|
119 |
||
120 |
"Modified: 28.1.1997 / 12:31:38 / cg" |
|
121 |
! ! |
|
122 |
||
123 |
!ApplicationModel class methodsFor:'instance creation'! |
|
124 |
||
125 |
new |
|
126 |
"return a new initialized instance" |
|
127 |
||
128 |
|inst| |
|
129 |
||
130 |
inst := super basicNew. |
|
131 |
inst basicInitialize. |
|
132 |
inst initialize. |
|
133 |
^ inst |
|
134 |
||
135 |
"Modified: 24.4.1996 / 09:42:14 / cg" |
|
136 |
! |
|
137 |
||
138 |
onDevice:aDevice |
|
139 |
"return a new initialized instance, which shall open its interface |
|
140 |
on aDevice." |
|
141 |
||
142 |
^ (super basicNew basicInitialize |
|
143 |
setDevice:aDevice) initialize |
|
144 |
||
145 |
"Modified: 24.4.1996 / 09:42:14 / cg" |
|
146 |
"Created: 5.7.1996 / 12:19:15 / cg" |
|
147 |
! ! |
|
148 |
||
149 |
!ApplicationModel class methodsFor:'accessing'! |
|
150 |
||
151 |
application |
|
152 |
^ self |
|
153 |
||
154 |
! ! |
|
155 |
||
156 |
!ApplicationModel class methodsFor:'active help'! |
|
157 |
||
158 |
helpSpec |
|
1431 | 159 |
"default is: no help-spec (should be redefined by concrete class if help is wanted)." |
160 |
||
1419 | 161 |
^ IdentityDictionary new. |
162 |
! ! |
|
163 |
||
164 |
!ApplicationModel class methodsFor:'bindings'! |
|
165 |
||
166 |
actionFor:aKey |
|
167 |
"sent by the builder to ask for an actionBlock for |
|
168 |
a Button. The argument, aKey comes from an UI-spec |
|
169 |
for a buttons #action property. |
|
170 |
Here, a corresponding message is sent to myself, |
|
171 |
which ought to be defined in the application subclass. |
|
172 |
Alternatively, a subclass may redefine this method, to provide |
|
173 |
actionBlocks from a Dictionary or whatever. |
|
174 |
Typically, a block is returned there." |
|
175 |
||
176 |
^ nil |
|
177 |
||
178 |
||
179 |
! |
|
180 |
||
181 |
actionFor:aKey withValue:aValue |
|
182 |
"sent by the builder to ask for an actionBlock for |
|
183 |
a Button which passes a value to the actionMethod. |
|
184 |
The argument, aKey comes from an UI-spec |
|
185 |
for a buttons #action property. |
|
186 |
Here, a corresponding message is sent to myself, |
|
187 |
which ought to be defined in the application subclass. |
|
188 |
Alternatively, a subclass may redefine this method, to provide |
|
189 |
actionBlocks from a Dictionary or whatever. |
|
190 |
Typically, a block is returned there." |
|
191 |
||
192 |
^ nil |
|
193 |
||
194 |
||
195 |
! |
|
196 |
||
197 |
aspectFor:aKey |
|
198 |
"sent by the builder to ask for an aspect (a data model). |
|
199 |
The argument, aKey comes from an UI-spec |
|
200 |
for a components #aspect property. |
|
201 |
Here, a corresponding message is sent to myself, |
|
202 |
which ought to be defined in the application subclass. |
|
203 |
Alternatively, a subclass may redefine this method, to provide |
|
204 |
holders from a Dictionary or whatever. |
|
205 |
Typically, a valueHolder is returned there." |
|
206 |
||
207 |
^ self perform:aKey |
|
208 |
||
209 |
"/ ^ nil |
|
210 |
||
211 |
"Modified: / 27.10.1997 / 13:43:12 / cg" |
|
212 |
! |
|
213 |
||
214 |
clientFor:aKey |
|
215 |
"sent by the builder to ask for an application provided |
|
216 |
subcanvas's application. |
|
217 |
The argument, aKey comes from an UI-spec |
|
218 |
for a subcanvas's #client property. |
|
219 |
Here, a corresponding message is sent to myself, |
|
220 |
which ought to be defined in the application subclass. |
|
221 |
Alternatively, a subclass may redefine this method, to provide |
|
222 |
appModels from a Dictionary or whatever. |
|
223 |
Typically, an applicationModel is returned there." |
|
224 |
||
225 |
^ nil |
|
226 |
||
227 |
! |
|
228 |
||
229 |
componentFor:aKey |
|
230 |
"sent by the builder to ask for an application provided |
|
231 |
component. |
|
232 |
The argument, aKey comes from an UI-spec |
|
233 |
for a viewHolders #view property. |
|
234 |
Here, a corresponding message is sent to myself, |
|
235 |
which ought to be defined in the application subclass. |
|
236 |
Alternatively, a subclass may redefine this method, to provide |
|
237 |
holders from a Dictionary or whatever. |
|
238 |
Typically, a view is returned there." |
|
239 |
||
240 |
(self respondsTo:aKey) ifTrue:[ |
|
241 |
^ self perform:aKey |
|
242 |
]. |
|
243 |
^ nil |
|
244 |
! |
|
245 |
||
246 |
labelFor:aKey |
|
247 |
"sent by the builder to ask for an application provided |
|
248 |
label for a component. |
|
249 |
The argument, aKey comes from an UI-spec |
|
250 |
for a components #label property. |
|
251 |
Here, a corresponding message is sent to myself, |
|
252 |
which ought to be defined in the application subclass. |
|
253 |
Alternatively, a subclass may redefine this method, to provide |
|
254 |
labels from a Dictionary or whatever. |
|
255 |
Typically, a string is returned there." |
|
256 |
||
257 |
(self application respondsTo:aKey) ifTrue:[ |
|
258 |
^ self application perform:aKey |
|
259 |
]. |
|
260 |
^ self application labelAt:aKey ifAbsent:nil |
|
261 |
||
262 |
! |
|
263 |
||
264 |
listFor:aKey |
|
265 |
"sent by the builder to ask for an application provided |
|
266 |
holder for a list. |
|
267 |
The argument, aKey comes from an UI-spec |
|
268 |
for a listWidgets #list 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 list-holding model (SelectionInList) is returned there." |
|
274 |
||
275 |
|app| |
|
276 |
||
277 |
(app := self application) notNil ifTrue:[ |
|
278 |
(app respondsTo:aKey) ifTrue:[ |
|
279 |
^ app perform:aKey |
|
280 |
] |
|
281 |
]. |
|
282 |
^ nil. |
|
283 |
||
284 |
"Modified: 4.3.1997 / 00:53:03 / cg" |
|
285 |
! |
|
286 |
||
287 |
menuFor:aKey |
|
288 |
"sent by the builder to ask for an application provided |
|
289 |
holder for a menu. |
|
290 |
The argument, aKey comes from an UI-spec |
|
291 |
for a widgets #menu property. |
|
292 |
Here, a corresponding message is sent to myself, |
|
293 |
which ought to be defined in the application subclass. |
|
294 |
Alternatively, a subclass may redefine this method, to provide |
|
295 |
holders from a Dictionary or whatever. |
|
296 |
Typically, a menu or a menu-holding valueHolder is returned there." |
|
297 |
||
298 |
^ self application perform:aKey |
|
299 |
||
300 |
! |
|
301 |
||
302 |
specificationFor:aKey |
|
303 |
"sent by the builder to ask for an application provided |
|
304 |
specification for a subcanvas or subspecification. |
|
305 |
The argument, aKey comes from an UI-spec |
|
306 |
for a subcanvases #specification property (minorKey). |
|
307 |
Here, a corresponding message is sent to myself, |
|
308 |
which ought to be defined in the application subclass. |
|
309 |
Alternatively, a subclass may redefine this method, to provide |
|
310 |
interfaceSpecifications from a Dictionary or whatever. |
|
311 |
Typically, an interfaceSpecification is returned there." |
|
312 |
||
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
313 |
|displayDevice displayDeviceType modifiedKey| |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
314 |
|
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
315 |
"/ this code is so ugly... |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
316 |
displayDevice := Screen current ? Screen default. |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
317 |
displayDevice notNil ifTrue:[ |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
318 |
displayDeviceType := displayDevice deviceType. |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
319 |
displayDeviceType notNil ifTrue:[ |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
320 |
modifiedKey := (aKey , '_' , displayDeviceType) asSymbolIfInterned. |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
321 |
modifiedKey notNil ifTrue:[ |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
322 |
(self application respondsTo:modifiedKey) ifTrue:[ |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
323 |
^ self application perform:modifiedKey |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
324 |
] |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
325 |
] |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
326 |
] |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
327 |
]. |
1419 | 328 |
^ self application perform:aKey |
329 |
||
330 |
"Modified: / 5.2.1998 / 00:21:57 / stefan" |
|
1115 | 331 |
! |
332 |
||
1419 | 333 |
visualFor:aKey |
334 |
"sent by the builder to ask for an application provided |
|
335 |
image or element for a label. |
|
336 |
The argument, aKey comes from an UI-spec |
|
337 |
for a widgets #label property, if LabelIsImage is turned on. |
|
338 |
Here, a corresponding message is sent to myself, |
|
339 |
which ought to be defined in the application subclass. |
|
340 |
Alternatively, a subclass may redefine this method, to provide |
|
341 |
images from a Dictionary or whatever. |
|
342 |
Typically, an image is returned there." |
|
343 |
||
344 |
(self application respondsTo:aKey) ifTrue:[ |
|
345 |
^ self application perform:aKey |
|
346 |
]. |
|
347 |
^ self application visualAt:aKey ifAbsent:nil |
|
348 |
||
349 |
||
350 |
! ! |
|
351 |
||
352 |
!ApplicationModel class methodsFor:'change & update'! |
|
353 |
||
354 |
update:something with:aParameter from:changedObject |
|
355 |
"flush resources on language changes" |
|
356 |
||
357 |
something == #Language ifTrue:[ |
|
358 |
"flush resources on language changes" |
|
359 |
self flushAllClassResources |
|
360 |
] |
|
361 |
||
362 |
"Created: 15.6.1996 / 15:13:29 / cg" |
|
363 |
! ! |
|
364 |
||
365 |
!ApplicationModel class methodsFor:'defaults'! |
|
366 |
||
367 |
defaultIcon |
|
1431 | 368 |
"default is: no icon (should be redefined by concrete class if an icon is wanted)." |
369 |
||
1419 | 370 |
^ nil |
371 |
! |
|
372 |
||
373 |
labelAt:aKey |
|
1431 | 374 |
"default is: no label (could be redefined by concrete class )." |
375 |
||
1419 | 376 |
^ nil |
377 |
! |
|
378 |
||
379 |
labelAt:aKey ifAbsent:aBlock |
|
1431 | 380 |
"default is: no label (could be redefined by concrete class )." |
381 |
||
1419 | 382 |
^ aBlock value |
383 |
! |
|
384 |
||
385 |
labelAt:aKey put:aValue |
|
386 |
"/ not yet implemented |
|
387 |
! |
|
388 |
||
389 |
labels |
|
390 |
"/ not yet implemented |
|
391 |
^ nil |
|
392 |
! |
|
393 |
||
394 |
visualAt:aKey |
|
1431 | 395 |
"default is: no visual (could be redefined by concrete class )." |
396 |
||
1419 | 397 |
^ nil |
398 |
! |
|
399 |
||
400 |
visualAt:aKey ifAbsent:aBlock |
|
1431 | 401 |
"default is: no visual (could be redefined by concrete class )." |
402 |
||
1419 | 403 |
^ aBlock value |
404 |
! |
|
405 |
||
406 |
visualAt:aKey put:aValue |
|
407 |
"/ not yet implemented |
|
408 |
! |
|
409 |
||
410 |
visuals |
|
411 |
"/ not yet implemented |
|
412 |
^ nil |
|
413 |
! ! |
|
414 |
||
415 |
!ApplicationModel class methodsFor:'queries'! |
|
416 |
||
417 |
interfaceSpecFor:aSelector |
|
418 |
"return an interface spec" |
|
419 |
||
420 |
^ UISpecification from:(self application specificationFor:aSelector) |
|
421 |
! |
|
422 |
||
423 |
isVisualStartable |
|
1427 | 424 |
"return true, if this application can be started via #open. |
425 |
(to allow start of a change browser via double-click in the browser)" |
|
1419 | 426 |
|
427 |
(self == ApplicationModel) ifTrue:[^ false "I am abstract"]. |
|
428 |
((self respondsTo:#open) or:[self class implements:#openInterface]) ifFalse:[^ false]. |
|
429 |
"/ (self respondsTo:#windowSpec) ifFalse:[^ false]. |
|
430 |
^ true |
|
431 |
||
432 |
"Created: / 27.10.1997 / 16:38:02 / cg" |
|
433 |
"Modified: / 14.3.1998 / 16:30:50 / cg" |
|
434 |
! ! |
|
435 |
||
436 |
!ApplicationModel class methodsFor:'resources'! |
|
437 |
||
438 |
classResources |
|
439 |
"if not already loaded, get the classes resourcePack |
|
440 |
and return it" |
|
441 |
||
442 |
ClassResources isNil ifTrue:[ |
|
443 |
ClassResources := ResourcePack for:self. |
|
444 |
]. |
|
445 |
^ ClassResources |
|
446 |
! |
|
447 |
||
448 |
classResources:aResourcePack |
|
449 |
"allow setting of the classResources" |
|
450 |
||
451 |
ClassResources := aResourcePack |
|
452 |
! |
|
453 |
||
454 |
flushAllClassResources |
|
455 |
"flush all classes resource translations. |
|
456 |
Needed after a resource file / language setting has changed." |
|
457 |
||
458 |
ResourcePack flushCachedResourcePacks. |
|
459 |
self flushClassResources. |
|
460 |
self allSubclassesDo:[:aClass | |
|
461 |
aClass flushClassResources. |
|
462 |
] |
|
463 |
! |
|
464 |
||
465 |
flushClassResources |
|
466 |
"flush classes resource string translations. |
|
467 |
Needed whenever a resource file / language setting has changed" |
|
468 |
||
469 |
ClassResources := nil. |
|
470 |
! |
|
471 |
||
472 |
resources |
|
473 |
"return the applications resources - thats a ResourcePack containing |
|
474 |
language strings" |
|
475 |
||
476 |
^ self classResources |
|
477 |
||
478 |
"Created: / 19.5.1998 / 20:14:00 / cg" |
|
479 |
! |
|
480 |
||
481 |
updateClassResources |
|
482 |
"update my classResources" |
|
483 |
||
484 |
ClassResources := nil. |
|
485 |
self classResources |
|
486 |
! ! |
|
487 |
||
488 |
!ApplicationModel class methodsFor:'startup'! |
|
489 |
||
490 |
open |
|
491 |
"create an instance of the application and open its view" |
|
492 |
||
493 |
^ self new open |
|
494 |
||
495 |
" |
|
496 |
Launcher open |
|
497 |
" |
|
498 |
||
499 |
"Modified: 13.1.1997 / 20:54:50 / cg" |
|
500 |
! |
|
501 |
||
502 |
openAt:aLocation |
|
503 |
"create an instance of the application and open its view |
|
504 |
at some position." |
|
505 |
||
506 |
^ self new openAt:aLocation |
|
507 |
||
508 |
"Modified: 14.2.1997 / 20:28:41 / cg" |
|
509 |
! |
|
510 |
||
511 |
openDialogInterface:anInterfaceSymbol |
|
512 |
"create an instance of the application and open a view as |
|
513 |
specified by anInterfaceSymbol." |
|
514 |
||
515 |
^ self openDialogInterface:anInterfaceSymbol withBindings:nil |
|
516 |
||
517 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
|
518 |
"Created: 14.2.1997 / 20:33:10 / cg" |
|
519 |
"Modified: 28.2.1997 / 14:07:36 / cg" |
|
520 |
! |
|
521 |
||
522 |
openDialogInterface:anInterfaceSymbol withBindings:bindings |
|
523 |
"create an instance of the application and open a view as |
|
524 |
specified by anInterfaceSymbol." |
|
525 |
||
526 |
^ self new openDialogInterface:anInterfaceSymbol withBindings:bindings |
|
527 |
||
528 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
|
529 |
"Modified: 13.1.1997 / 20:55:02 / cg" |
|
530 |
"Created: 28.2.1997 / 14:07:24 / cg" |
|
531 |
! |
|
532 |
||
533 |
openDialogInterfaceSpec:anInterfaceSpec |
|
534 |
"create an instance of the application and open a view as |
|
535 |
specified by the given spec." |
|
536 |
||
537 |
^ self new |
|
538 |
openDialogInterfaceSpec:anInterfaceSpec |
|
539 |
withBindings:nil |
|
540 |
! |
|
541 |
||
542 |
openDialogInterfaceSpec:anInterfaceSpec withBindings:bindings |
|
543 |
"create an instance of the application and open a view as |
|
544 |
specified by the given spec." |
|
545 |
||
546 |
^ self new |
|
547 |
openDialogInterfaceSpec:anInterfaceSpec |
|
548 |
withBindings:bindings |
|
549 |
||
550 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
|
551 |
"Modified: 13.1.1997 / 20:55:02 / cg" |
|
552 |
"Created: 28.2.1997 / 14:07:24 / cg" |
|
553 |
! |
|
554 |
||
555 |
openDialogSpec:aSpec |
|
556 |
"create an instance of the application and open a view as |
|
557 |
specified by aSpec." |
|
558 |
||
559 |
^ self openDialogSpec:aSpec withBindings:nil |
|
560 |
||
561 |
"Modified: / 5.9.1995 / 17:54:50 / claus" |
|
562 |
"Modified: / 28.2.1997 / 14:07:36 / cg" |
|
563 |
"Created: / 20.5.1998 / 20:27:08 / cg" |
|
564 |
! |
|
565 |
||
566 |
openDialogSpec:aSpec withBindings:bindings |
|
567 |
"create an instance of the application and open a view as |
|
568 |
specified by the spec." |
|
569 |
||
570 |
^ self new openDialogSpec:aSpec withBindings:bindings |
|
571 |
||
572 |
"Modified: / 5.9.1995 / 17:54:50 / claus" |
|
573 |
"Modified: / 13.1.1997 / 20:55:02 / cg" |
|
574 |
"Created: / 20.5.1998 / 20:26:37 / cg" |
|
575 |
! |
|
576 |
||
577 |
openInterface:anInterfaceSymbol |
|
578 |
"create an instance of the application and open a view as |
|
579 |
specified by anInterfaceSymbol." |
|
580 |
||
581 |
^ self new openInterface:anInterfaceSymbol |
|
582 |
||
583 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
|
584 |
"Modified: 13.1.1997 / 20:55:02 / cg" |
|
585 |
! |
|
586 |
||
587 |
openInterface:anInterfaceSymbol at:aPoint |
|
588 |
"create an instance of the application and open a view as |
|
589 |
specified by anInterfaceSymbol." |
|
590 |
||
591 |
^ self new openInterface:anInterfaceSymbol at:aPoint |
|
592 |
||
593 |
"Modified: 14.2.1997 / 20:28:47 / cg" |
|
594 |
! |
|
595 |
||
596 |
openModal |
|
597 |
"create an instance of the application and open its view modal" |
|
598 |
||
599 |
^ self new openModal |
|
600 |
! |
|
601 |
||
602 |
openOn:anApplicationModel |
|
603 |
"send an open message to the argument, anApplicationModel. |
|
604 |
I dont really understand what this method is useful for ..." |
|
605 |
||
606 |
^ anApplicationModel open |
|
607 |
||
608 |
"Modified: 13.1.1997 / 20:55:05 / cg" |
|
609 |
! |
|
610 |
||
611 |
openOnDevice:aDevice |
|
612 |
"create an instance of the application and open its view |
|
613 |
on ANOTHER device. |
|
614 |
For more info, read the document on multiple display |
|
615 |
support and the documentation of the DeviceWorkstation class." |
|
616 |
||
1444 | 617 |
Screen currentScreenQuerySignal answer:aDevice |
618 |
do:[ |
|
619 |
^ (self onDevice:aDevice) open |
|
620 |
] |
|
1419 | 621 |
|
622 |
" |
|
623 |
Launcher openOnDevice:Display |
|
624 |
" |
|
625 |
||
626 |
"Modified: 13.1.1997 / 20:55:27 / cg" |
|
627 |
! |
|
628 |
||
629 |
openOnXScreenNamed:aScreenName |
|
630 |
"create an instance of the application and open its view |
|
631 |
on some X display screen. The argument aScreenName must be |
|
632 |
a valid x-display name (i.e. of the form '<host>:<screenNr>' as in 'foo:0'). |
|
633 |
For more info, read the document on multiple display |
|
634 |
support and the documentation of the DeviceWorkstation class." |
|
635 |
||
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
636 |
|newDevice msg| |
1419 | 637 |
|
638 |
newDevice := XWorkstation newDispatchingFor:aScreenName. |
|
639 |
newDevice isNil ifTrue:[ |
|
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
640 |
msg := 'Could not open display: ' , aScreenName. |
1419 | 641 |
Screen current notNil ifTrue:[ |
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
642 |
self warn:msg. |
1419 | 643 |
] ifFalse:[ |
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
644 |
msg errorPrintCR |
1419 | 645 |
]. |
646 |
^ nil |
|
995
63d1b9ce554b
Avoid invoking pre/postBuild twice for subCanvases which
Claus Gittinger <cg@exept.de>
parents:
983
diff
changeset
|
647 |
]. |
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
648 |
^ self openOnDevice:newDevice. |
1419 | 649 |
|
650 |
" |
|
651 |
Launcher openOnXScreenNamed:'sgi:0' |
|
652 |
Launcher openOnXScreenNamed:'foo:0' |
|
653 |
NewLauncher openOnXScreenNamed:'dawn:0' |
|
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
654 |
NewLauncher openOnXScreenNamed:'bitsy:0' |
1419 | 655 |
SystemBrowser openOnXScreenNamed:'dawn:0' |
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
656 |
SystemBrowser openOnXScreenNamed:'bitsy:0' |
1419 | 657 |
" |
658 |
||
659 |
"Modified: 13.1.1997 / 20:55:27 / cg" |
|
660 |
! |
|
661 |
||
662 |
openWithSpec:aSpecSymbol |
|
663 |
"ST80 compatibility: |
|
664 |
mhmh - what is the difference to #openInterface ?" |
|
665 |
||
666 |
^ self openInterface:aSpecSymbol |
|
667 |
||
668 |
"Modified: 29.8.1997 / 01:16:52 / cg" |
|
669 |
! ! |
|
670 |
||
671 |
!ApplicationModel methodsFor:'accessing'! |
|
672 |
||
673 |
application |
|
674 |
"application knows about interfaceSpecs, menuSpecs etc. |
|
675 |
Usually this is my class. |
|
676 |
This may be redefined in subclasses" |
|
677 |
||
678 |
^ self class |
|
679 |
||
680 |
"Modified: / 5.2.1998 / 00:45:21 / stefan" |
|
681 |
! |
|
682 |
||
683 |
builder |
|
684 |
"return the applications builder; this one has more information |
|
685 |
about views, components etc." |
|
686 |
||
687 |
^ builder |
|
688 |
! |
|
689 |
||
690 |
builder:aBuilder |
|
691 |
"set the applications builder. Normally, you should not set it |
|
692 |
directly, but depend on the default builder, as created when the application |
|
693 |
was created." |
|
694 |
||
695 |
builder := aBuilder |
|
696 |
! |
|
697 |
||
698 |
focusSequence |
|
699 |
"return a focusSequence for stepping through the applications views. |
|
700 |
The builder usually keeps track of so-called 'tabable' views. |
|
701 |
Stepping is done with the FocusNext/FocusPrevius keys, which are |
|
702 |
typically bound to Meta-CursorUp/Meta-CursorDown. |
|
703 |
(unless the focus is currently attached to a textEditing view, |
|
704 |
tabbing is also possible via the tab-key) |
|
705 |
Subclasses which do not use the builder (but instead build their view |
|
706 |
programmatically) should redefine this method to return a collection of |
|
707 |
views which defines that sequence. |
|
708 |
Notice, that the focuse sequence is asked for at the time of the tabbing |
|
709 |
(not only during startup of the view) - so dynamically adding/removing |
|
710 |
components is possible." |
|
711 |
||
712 |
builder notNil ifTrue:[ |
|
713 |
^ builder focusSequence |
|
714 |
]. |
|
715 |
^ nil |
|
716 |
||
717 |
"Modified: / 31.10.1997 / 19:11:14 / cg" |
|
718 |
! |
|
719 |
||
720 |
masterApplication |
|
721 |
"return the value of the instance variable 'masterApplication' (automatically generated)" |
|
722 |
||
1427 | 723 |
^ masterApplication |
724 |
! |
|
1419 | 725 |
|
726 |
masterApplication:something |
|
727 |
"set the value of the instance variable 'masterApplication' (automatically generated)" |
|
728 |
||
729 |
something == self ifTrue:[ |
|
730 |
self error:'an application cannot be its own masterApplication' mayProceed:true. |
|
731 |
^ self |
|
732 |
]. |
|
733 |
masterApplication := something. |
|
734 |
! |
|
735 |
||
736 |
resources |
|
737 |
"return the applications resources - thats a ResourcePack containing |
|
738 |
language strings" |
|
739 |
||
740 |
^ resources |
|
741 |
! |
|
742 |
||
743 |
resources:aResourcePack |
|
744 |
"set the applications resources - usually tis is done automatically, |
|
745 |
except for manually built dialogs" |
|
746 |
||
747 |
resources := aResourcePack |
|
748 |
! |
|
749 |
||
750 |
window |
|
751 |
"return my topWindow - or nil, if I have no window (yet)" |
|
752 |
||
753 |
|win| |
|
754 |
||
755 |
builder isNil ifTrue:[^ nil]. |
|
756 |
(win := builder window) notNil ifTrue:[ |
|
757 |
^ win |
|
758 |
]. |
|
759 |
masterApplication notNil ifTrue:[ |
|
1442
96d3aff662c3
check for masterApplication == self (to avoid endless recursion)
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
760 |
masterApplication ~~ self ifTrue:[ |
96d3aff662c3
check for masterApplication == self (to avoid endless recursion)
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
761 |
"/ is that true ? |
96d3aff662c3
check for masterApplication == self (to avoid endless recursion)
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
762 |
^ masterApplication window |
96d3aff662c3
check for masterApplication == self (to avoid endless recursion)
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
763 |
] |
1419 | 764 |
]. |
765 |
^ nil. |
|
766 |
||
767 |
"Modified: / 18.9.1998 / 15:18:19 / cg" |
|
768 |
! |
|
769 |
||
770 |
window:aTopView |
|
771 |
"set my topWindow. |
|
772 |
As a side effect, this creates a dummy builder if non has yet |
|
773 |
been built. This prevents non-GUI-Painter apps from failing later, |
|
774 |
when the builder is accessed." |
|
775 |
||
776 |
builder isNil ifTrue:[ |
|
777 |
self createBuilder |
|
778 |
]. |
|
779 |
builder window:aTopView |
|
780 |
||
781 |
"Created: 18.4.1996 / 14:55:26 / cg" |
|
782 |
! |
|
783 |
||
784 |
windowGroup |
|
785 |
"return the applications windowGroup" |
|
786 |
||
787 |
|w| |
|
788 |
||
789 |
builder notNil ifTrue:[ |
|
790 |
(w := builder window) notNil ifTrue:[ |
|
791 |
^ w windowGroup |
|
792 |
]. |
|
793 |
]. |
|
794 |
masterApplication notNil ifTrue:[ |
|
795 |
^ masterApplication windowGroup |
|
796 |
]. |
|
797 |
^ nil |
|
798 |
||
799 |
"Modified: / 7.9.1998 / 23:37:00 / cg" |
|
800 |
! ! |
|
801 |
||
802 |
!ApplicationModel methodsFor:'binding access'! |
|
803 |
||
804 |
actionFor:aKey |
|
805 |
"sent by the builder to ask for an actionBlock for |
|
806 |
a Button. The argument, aKey comes from an UI-spec |
|
807 |
for a buttons #action property. |
|
808 |
Here, a corresponding message is sent to myself, |
|
809 |
which ought to be defined in the application subclass. |
|
810 |
Alternatively, a subclass may redefine this method, to provide |
|
811 |
actionBlocks from a Dictionary or whatever. |
|
812 |
Typically, a block is returned there." |
|
813 |
||
814 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
815 |
^ [self perform:aKey] "/ could use: MessageSend receiver:self selector:aKey |
|
816 |
]. |
|
817 |
^ masterApplication actionFor:aKey |
|
818 |
||
819 |
"Modified: / 28.10.1997 / 20:34:51 / cg" |
|
820 |
! |
|
821 |
||
822 |
actionFor:aKey withValue:aValue |
|
823 |
"sent by the builder to ask for an actionBlock for |
|
824 |
a Button which passes a value. |
|
825 |
The argument, aKey comes from an UI-spec for a buttons #action property. |
|
826 |
Here, a corresponding message is sent to myself, |
|
827 |
which ought to be defined in the application subclass. |
|
828 |
Alternatively, a subclass may redefine this method, to provide |
|
829 |
actionBlocks from a Dictionary or whatever. |
|
830 |
Typically, a block is returned there." |
|
831 |
||
832 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
833 |
^ [self perform:aKey with:aValue] |
|
834 |
]. |
|
835 |
^ masterApplication actionFor:aKey withValue:aValue |
|
836 |
! |
|
837 |
||
838 |
aspectFor:aKey |
|
839 |
"sent by the builder to ask for an aspect (a data model). |
|
840 |
The argument, aKey comes from an UI-spec |
|
841 |
for a components #aspect property. |
|
842 |
Here, a corresponding message is sent to myself, |
|
843 |
which ought to be defined in the application subclass. |
|
844 |
Alternatively, a subclass may redefine this method, to provide |
|
845 |
holders from a Dictionary or whatever. |
|
846 |
Typically, a valueHolder is returned there." |
|
847 |
||
848 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
849 |
^ self perform:aKey |
|
850 |
]. |
|
851 |
^ masterApplication aspectFor:aKey |
|
852 |
||
853 |
"Modified: / 18.6.1998 / 20:33:23 / cg" |
|
854 |
! |
|
855 |
||
856 |
clientFor:aKey |
|
857 |
"sent by the builder to ask for an application provided |
|
858 |
subcanvas's application. |
|
859 |
The argument, aKey comes from an UI-spec |
|
860 |
for a subcanvas's #client property. |
|
861 |
Here, a corresponding message is sent to myself, |
|
862 |
which ought to be defined in the application subclass. |
|
863 |
Alternatively, a subclass may redefine this method, to provide |
|
864 |
appModels from a Dictionary or whatever. |
|
865 |
Typically, an applicationModel is returned there." |
|
866 |
||
867 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
868 |
^ self perform:aKey |
|
869 |
]. |
|
870 |
^ masterApplication clientFor:aKey |
|
871 |
||
872 |
"Modified: / 18.6.1998 / 20:33:30 / cg" |
|
873 |
! |
|
874 |
||
875 |
componentFor:aKey |
|
876 |
"sent by the builder to ask for an application provided |
|
877 |
component. |
|
878 |
The argument, aKey comes from an UI-spec |
|
879 |
for a viewHolders #view property. |
|
880 |
Here, a corresponding message is sent to myself, |
|
881 |
which ought to be defined in the application subclass. |
|
882 |
Alternatively, a subclass may redefine this method, to provide |
|
883 |
holders from a Dictionary or whatever. |
|
884 |
Typically, a view is returned there." |
|
885 |
||
886 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
887 |
^ self perform:aKey |
|
888 |
]. |
|
889 |
^ masterApplication componentFor:aKey |
|
890 |
||
891 |
"Modified: / 18.6.1998 / 20:33:36 / cg" |
|
892 |
! |
|
893 |
||
894 |
helpTextFor:aComponent |
|
895 |
"activeHelp interface: return some help text for a widget component" |
|
896 |
||
897 |
|key cls| |
|
898 |
||
899 |
builder notNil ifTrue:[ |
|
900 |
cls := self class. |
|
901 |
||
902 |
(cls respondsTo:#helpSpec) ifTrue:[ |
|
903 |
(key := builder helpKeyFor:aComponent) notNil ifTrue:[ |
|
904 |
^ self helpTextForKey:key |
|
905 |
] |
|
906 |
] |
|
907 |
]. |
|
908 |
masterApplication notNil ifTrue:[ |
|
909 |
^ masterApplication helpTextFor:aComponent |
|
910 |
]. |
|
911 |
^ nil |
|
912 |
||
913 |
"Modified: / 31.7.1998 / 23:03:10 / cg" |
|
914 |
! |
|
915 |
||
916 |
helpTextForKey:aKey |
|
917 |
"activeHelp interface: return some help text for a key |
|
918 |
key is the symbol associated with some widget or menu item. |
|
919 |
(from my helpSpec); return a language variant (if available)" |
|
920 |
||
921 |
|cls helpText| |
|
922 |
||
923 |
cls := self class. |
|
924 |
||
925 |
(cls respondsTo:#helpSpec) ifTrue:[ |
|
926 |
helpText := (cls helpSpec) at:aKey ifAbsent:nil |
|
927 |
]. |
|
928 |
(masterApplication notNil and:[helpText isNil]) ifTrue:[ |
|
929 |
helpText := masterApplication helpTextForKey:aKey |
|
930 |
]. |
|
931 |
"/ translate. |
|
932 |
resources notNil ifTrue:[ |
|
933 |
^ resources string:helpText |
|
934 |
]. |
|
935 |
^ helpText |
|
936 |
||
937 |
"Modified: / 4.2.2000 / 15:30:16 / cg" |
|
657 | 938 |
! |
939 |
||
1419 | 940 |
labelFor:aKey |
941 |
"sent by the builder to ask for an application provided |
|
942 |
label for a component. |
|
943 |
The argument, aKey comes from an UI-spec |
|
944 |
for a components #label property. |
|
945 |
Here, a corresponding message is sent to myself, |
|
946 |
which ought to be defined in the application subclass. |
|
947 |
Alternatively, a subclass may redefine this method, to provide |
|
948 |
labels from a Dictionary or whatever. |
|
949 |
Typically, a string is returned there." |
|
950 |
||
951 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
952 |
^ self perform:aKey |
|
953 |
]. |
|
954 |
^ masterApplication labelFor:aKey |
|
955 |
||
956 |
"Modified: / 18.6.1998 / 20:33:42 / cg" |
|
957 |
! |
|
958 |
||
959 |
listFor:aKey |
|
960 |
"sent by the builder to ask for an application provided |
|
961 |
holder for a list (for example, a popUpLists list). |
|
962 |
The argument, aKey comes from an UI-spec |
|
963 |
for a listWidgets #list property. |
|
964 |
Here, a corresponding message is sent to myself, |
|
965 |
which ought to be defined in the application subclass. |
|
966 |
Alternatively, a subclass may redefine this method, to provide |
|
967 |
holders from a Dictionary or whatever. |
|
968 |
Typically, a list-holding model (SelectionInList) is returned there. |
|
969 |
If the instance does not provide a value, a corresponding aspect |
|
970 |
is asked for. If that fails as well, the app class is asked as a last |
|
971 |
chance." |
|
972 |
||
973 |
|a| |
|
974 |
||
975 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
976 |
^ self perform:aKey |
|
977 |
]. |
|
978 |
a := self aspectFor:aKey. |
|
979 |
a notNil ifTrue:[ |
|
980 |
^ a |
|
981 |
]. |
|
982 |
^ self application listFor:aKey |
|
983 |
||
984 |
"Modified: / 18.6.1998 / 20:33:50 / cg" |
|
985 |
! |
|
986 |
||
987 |
menuFor:aKey |
|
988 |
"sent by the builder to ask for an application provided |
|
989 |
holder for a menu. |
|
990 |
The argument, aKey comes from an UI-spec |
|
991 |
for a widgets #menu property. |
|
992 |
Here, a corresponding message is sent to myself, |
|
993 |
which ought to be defined in the application subclass. |
|
994 |
Alternatively, a subclass may redefine this method, to provide |
|
995 |
holders from a Dictionary or whatever. |
|
996 |
Typically, a menu or a menu-holding valueHolder is returned there." |
|
997 |
||
998 |
(self selfResponsibleFor:aKey) ifTrue:[ |
|
999 |
^ self perform:aKey |
|
1000 |
]. |
|
1001 |
^ masterApplication menuFor:aKey |
|
1002 |
||
1003 |
"Modified: / 18.6.1998 / 20:33:56 / cg" |
|
1004 |
! |
|
1005 |
||
1006 |
specificationFor:aKey |
|
1007 |
"sent by the builder to ask for an application provided |
|
1008 |
specification for a subcanvas or subspecification. |
|
1009 |
The argument, aKey comes from an UI-spec |
|
1010 |
for a subcanvases #specification property (minorKey). |
|
1011 |
Here, a corresponding message is sent to myself, |
|
1012 |
which ought to be defined in the application subclass. |
|
1013 |
Alternatively, a subclass may redefine this method, to provide |
|
1014 |
interfaceSpecifications from a Dictionary or whatever. |
|
1015 |
Typically, an interfaceSpecification is returned there." |
|
1016 |
||
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1017 |
|displayDevice displayDeviceType app modifiedKey| |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1018 |
|
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1019 |
"/ this code is so ugly... |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1020 |
displayDevice := (self graphicsDevice ? Screen current) ? Screen default. |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1021 |
displayDevice notNil ifTrue:[ |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1022 |
displayDeviceType := displayDevice deviceType. |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1023 |
displayDeviceType notNil ifTrue:[ |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1024 |
modifiedKey := (aKey , '_' , displayDeviceType) asSymbolIfInterned. |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1025 |
modifiedKey notNil ifTrue:[ |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1026 |
(self application respondsTo:modifiedKey) ifTrue:[ |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1027 |
^ self application perform:modifiedKey |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1028 |
] |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1029 |
] |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1030 |
] |
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1031 |
]. |
1419 | 1032 |
|
1033 |
"/(self selfResponsibleFor:aKey) "/ rubbish |
|
1479
c30179d243db
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
1478
diff
changeset
|
1034 |
(self respondsTo:aKey) ifTrue:[ |
1419 | 1035 |
^ self perform:aKey |
1036 |
]. |
|
1037 |
((app := self application) respondsTo:aKey) ifTrue:[ |
|
1038 |
^ app perform:aKey |
|
1039 |
]. |
|
1040 |
^ masterApplication specificationFor:aKey |
|
1041 |
||
1042 |
"Modified: / 5.2.1998 / 00:31:39 / stefan" |
|
1043 |
"Modified: / 18.6.1998 / 20:34:02 / cg" |
|
1044 |
! |
|
1045 |
||
1046 |
visualFor:aKey |
|
1047 |
"sent by the builder to ask for an application provided |
|
1048 |
image or element for a label. |
|
1049 |
The argument, aKey comes from an UI-spec |
|
1050 |
for a widgets #label property, if LabelIsImage is turned on. |
|
1051 |
Here, a corresponding message is sent to myself, |
|
1052 |
which ought to be defined in the application subclass. |
|
1053 |
Alternatively, a subclass may redefine this method, to provide |
|
1054 |
images from a Dictionary or whatever. |
|
1055 |
Typically, an image is returned there." |
|
1056 |
||
1057 |
^ self application visualFor:aKey |
|
1058 |
||
1059 |
! ! |
|
1060 |
||
1061 |
!ApplicationModel methodsFor:'change & update'! |
|
1062 |
||
1063 |
delayedUpdate:something with:aParameter from:changedObject |
|
1064 |
"support for delayed updates - |
|
1065 |
subclasses which invoke #enqueueDelayedUpdate:with:from: (from #update:with:from:) |
|
1066 |
must also redefine this method, and perform the actual update there." |
|
1067 |
||
1068 |
^ self |
|
1069 |
! |
|
1070 |
||
1071 |
enqueueDelayedUpdate:something with:aParameter from:changedObject |
|
1072 |
"support for delayed updates - to be invoked from a concrete classes |
|
1073 |
#update:with:from: method. |
|
1074 |
This will enqueue a delayed update, and resend #delayedUpdate:with:from: |
|
1075 |
whenever the receiver is handling events. |
|
1076 |
Especially useful, if many updates arrive at high frequency, to avoid |
|
1077 |
multiple redraws." |
|
1078 |
||
1079 |
^ self |
|
1080 |
enqueueMessage:#delayedUpdate:with:from: |
|
1081 |
for:self |
|
1082 |
arguments:(Array |
|
1083 |
with:something |
|
1084 |
with:aParameter |
|
1085 |
with:changedObject). |
|
1086 |
||
1087 |
"Modified: / 26.2.2000 / 18:01:44 / cg" |
|
1088 |
! |
|
1089 |
||
1090 |
enqueueMessage:selector for:someone arguments:argList |
|
1091 |
"enqueue a message to be sent to myself later, when my process |
|
1092 |
is back in its eventLoop. Also, filter duplicates. |
|
1093 |
This is useful, to buffer redraws and avoid flicker due to multiple |
|
1094 |
redraws (especially in browsers, when reacting on changeMessages resulting |
|
1095 |
from changes made in other browsers)" |
|
1096 |
||
1097 |
|window sensor| |
|
1098 |
||
1099 |
(window := self window) notNil ifTrue:[ |
|
1100 |
sensor := window sensor. |
|
1101 |
]. |
|
1102 |
sensor isNil ifTrue:[ |
|
1103 |
"/ already closed, or not yet open |
|
1104 |
||
1105 |
^ someone perform:selector withArguments:argList. |
|
1106 |
]. |
|
1107 |
||
1417 | 1108 |
"/ |
1419 | 1109 |
"/ if such a message is already in the queue, ignore it. |
1110 |
"/ Otherwise push it as an event, to be handled when my thread is |
|
1111 |
"/ back in the event loop. |
|
1112 |
"/ |
|
1113 |
(sensor |
|
1114 |
hasEvent:selector |
|
1115 |
for:someone |
|
1116 |
withArguments:argList) ifTrue:[ |
|
1117 |
^ self |
|
1118 |
]. |
|
1119 |
sensor |
|
1120 |
pushUserEvent:selector |
|
1121 |
for:someone |
|
1122 |
withArguments:argList |
|
1123 |
||
1124 |
"Modified: / 5.2.2000 / 00:01:54 / cg" |
|
1125 |
"Created: / 26.2.2000 / 18:01:31 / cg" |
|
1126 |
! ! |
|
1127 |
||
1128 |
!ApplicationModel methodsFor:'component manipulations'! |
|
1129 |
||
1130 |
components:aSymbolOrArray do:aBlock |
|
1131 |
"evaluate aBlock for all components listed aSymbolOrArray." |
|
1132 |
||
1133 |
|coll| |
|
1134 |
||
1135 |
aSymbolOrArray isSymbol ifTrue:[ |
|
1136 |
"/ a single components name |
|
1137 |
coll := Array with:aSymbolOrArray |
|
1138 |
] ifFalse:[ |
|
1139 |
coll := aSymbolOrArray |
|
1140 |
]. |
|
1141 |
coll do:[:aSymbol | |
|
1142 |
|component| |
|
1143 |
||
1144 |
(component := self componentFor:aSymbol) isNil ifFalse:[ |
|
1145 |
aBlock value:component |
|
1146 |
] |
|
1147 |
] |
|
1148 |
||
1149 |
"Modified: 26.3.1997 / 16:23:14 / cg" |
|
1150 |
! |
|
1151 |
||
1152 |
disable:aSymbolOrArray |
|
1153 |
"disable the components whose id's are aSymbolOrArray." |
|
1154 |
||
1155 |
self components:aSymbolOrArray do:[:comp | comp disable] |
|
1156 |
||
1157 |
"Modified: 14.2.1997 / 17:32:09 / cg" |
|
1158 |
! |
|
1159 |
||
1160 |
enable:aSymbolOrArray |
|
1161 |
"enables the component(s) identified by aSymbolOrArray." |
|
1162 |
||
1163 |
self components:aSymbolOrArray do:[:comp | comp enable] |
|
1164 |
||
1165 |
"Modified: 14.2.1997 / 17:32:19 / cg" |
|
1166 |
! |
|
1167 |
||
1168 |
invalidate:aSymbolOrArray |
|
1169 |
"invalidates the component(s) identified by aSymbolOrArray." |
|
1170 |
||
1171 |
self components:aSymbolOrArray do:[:comp | comp invalidate] |
|
1172 |
||
1173 |
"Modified: 14.2.1997 / 17:32:28 / cg" |
|
1174 |
! |
|
1175 |
||
1176 |
makeInvisible:aSymbolOrArray |
|
1177 |
"makes the components whose id's are aSymbolOrArray invisible" |
|
1178 |
||
1179 |
self components:aSymbolOrArray do:[:comp | comp beInvisible] |
|
1180 |
||
1181 |
"Modified: 14.2.1997 / 17:32:42 / cg" |
|
1182 |
! |
|
1183 |
||
1184 |
makeReadOnly:aSymbolOrArray |
|
1185 |
"make all components identified by aSymbolOrArray read only |
|
1186 |
(for editText components)." |
|
1187 |
||
1188 |
self components:aSymbolOrArray do:[:comp | comp readOnly:true] |
|
1189 |
||
1190 |
"Modified: 14.2.1997 / 17:36:22 / cg" |
|
1191 |
! |
|
1192 |
||
1193 |
makeVisible:aSymbolOrArray |
|
1194 |
"makes the components whose id's are aSymbolOrArray visible" |
|
1195 |
||
1196 |
self components:aSymbolOrArray do:[:comp | comp beVisible] |
|
1197 |
||
1198 |
"Modified: 14.2.1997 / 17:32:52 / cg" |
|
1199 |
! |
|
1200 |
||
1201 |
makeWritable:aSymbolOrArray |
|
1202 |
"make all components identified by aSymbolOrArray writable |
|
1203 |
(for editText components)." |
|
1204 |
||
1205 |
self components:aSymbolOrArray do:[:comp | comp readOnly:false] |
|
1206 |
||
1207 |
"Created: 14.2.1997 / 17:36:17 / cg" |
|
1208 |
! ! |
|
1209 |
||
1210 |
!ApplicationModel methodsFor:'copying'! |
|
1211 |
||
1212 |
postCopy |
|
1213 |
builder := device := nil. |
|
1214 |
||
1215 |
"Created: / 19.4.1998 / 11:44:44 / cg" |
|
1216 |
! ! |
|
1217 |
||
1218 |
!ApplicationModel methodsFor:'drag & drop'! |
|
1219 |
||
1220 |
canDrop:aCollectionOfDropObjects in:aComponent |
|
1221 |
"drop manager asked if a drop is possible |
|
1222 |
- should be redefined by apps which can do it, to return true" |
|
1223 |
||
1224 |
^ false |
|
1225 |
||
1226 |
"Modified: 11.4.1997 / 12:42:47 / cg" |
|
1227 |
! |
|
1228 |
||
1229 |
drop:aCollectionOfDropObjects in:aComponent at:aPoint |
|
1230 |
"drop manager wants to drop. |
|
1231 |
This is ony sent, if #canDrop:in: returned true. |
|
1232 |
Must be redefined in apps which return true to #canDrop." |
|
1233 |
||
1234 |
self subclassResponsibility |
|
1235 |
||
1236 |
"Modified: 11.4.1997 / 12:43:19 / cg" |
|
1237 |
! ! |
|
1238 |
||
1239 |
!ApplicationModel methodsFor:'easy bindings'! |
|
1240 |
||
1241 |
registerInterestIn:aValueModel using:aSelectorOrArray |
|
1242 |
"Register interest in a change in aValueModel using information in aSelectorOrArray. |
|
1243 |
aSelectorOrArray can be one of three things: |
|
1244 |
||
1245 |
1) nil in which case no interest is registered |
|
1246 |
2) a selector in which case the receiver is understood to be self |
|
1247 |
3) an Array in which case the size is two where the first element is the |
|
1248 |
message to be sent and the second element is the receiver." |
|
1249 |
||
1250 |
aSelectorOrArray isNil ifTrue:[^ aValueModel]. |
|
1251 |
||
1252 |
(aSelectorOrArray isArray) ifTrue:[ |
|
1253 |
aValueModel onChangeSend:(aSelectorOrArray at:1) to:(aSelectorOrArray at:2) |
|
1254 |
] ifFalse: [ |
|
1255 |
aValueModel onChangeSend:aSelectorOrArray to:self |
|
1256 |
]. |
|
1257 |
^aValueModel |
|
1258 |
||
1259 |
"Modified: / 31.10.1997 / 18:19:44 / cg" |
|
980
3764f680134d
allow subclass to redefine subCanvas-pre/postBuilds;
Claus Gittinger <cg@exept.de>
parents:
978
diff
changeset
|
1260 |
! |
3764f680134d
allow subclass to redefine subCanvas-pre/postBuilds;
Claus Gittinger <cg@exept.de>
parents:
978
diff
changeset
|
1261 |
|
1419 | 1262 |
valueHolderFor:aSelector initialValue:anObject |
1263 |
"Return a ValueHolder on anObject." |
|
1264 |
||
1265 |
^ self valueHolderFor:aSelector initialValue:anObject changeMessage:nil |
|
1266 |
||
1267 |
||
1268 |
! |
|
1269 |
||
1270 |
valueHolderFor:aSelector initialValue:anObject changeMessage:aSelectorOrArrayOrNil |
|
1271 |
"Return a ValueHolder on anObject. aSelectorOrArrayOrNil is the change information |
|
1272 |
for the ValueHolder. This argument is either a Symbol or an Array of two elements. |
|
1273 |
If it is a Symbol, then it is the change message and the interested object is understood |
|
1274 |
to be the reciever. If it is an Array, then the first element is the change message and |
|
1275 |
the second element is the interested object. " |
|
1276 |
||
1277 |
|holder| |
|
1278 |
||
1279 |
(builder bindings includesKey:aSelector) ifFalse:[ |
|
1280 |
holder := ValueHolder with:anObject. |
|
1281 |
builder aspectAt:aSelector put:holder. |
|
1282 |
aSelectorOrArrayOrNil notNil ifTrue:[ |
|
1283 |
^ self registerInterestIn:holder using:aSelectorOrArrayOrNil |
|
1284 |
]. |
|
1285 |
^ holder |
|
1286 |
]. |
|
1287 |
^ builder aspectAt:aSelector |
|
1288 |
||
1289 |
"Modified: / 21.5.1998 / 03:31:28 / cg" |
|
1290 |
! ! |
|
1291 |
||
1292 |
!ApplicationModel methodsFor:'help'! |
|
1293 |
||
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1294 |
aboutImage |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1295 |
"bitmap image or nil for an about box for this application." |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1296 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1297 |
^ self class defaultIcon |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1298 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1299 |
"Modified: / 13.11.2001 / 12:32:44 / cg" |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1300 |
! |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1301 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1302 |
aboutThisApplicationLabel |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1303 |
"label for an about box for this application." |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1304 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1305 |
^ 'About This Application' |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1306 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1307 |
"Modified: / 13.11.2001 / 12:29:53 / cg" |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1308 |
! |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1309 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1310 |
aboutThisApplicationText |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1311 |
"text for an about box for this application." |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1312 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1313 |
|rev myClass clsRev msg| |
1419 | 1314 |
|
1315 |
rev := ''. |
|
1316 |
myClass := self class. |
|
1317 |
||
1318 |
(clsRev := myClass revision) notNil ifTrue: [rev := ' (rev: ', clsRev printString, ')']. |
|
1319 |
||
1320 |
msg := '\' withCRs , myClass name asBoldText, rev. |
|
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1321 |
^ msg |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1322 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1323 |
"Created: / 13.11.2001 / 12:28:36 / cg" |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1324 |
! |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1325 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1326 |
openAboutThisApplication |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1327 |
"opens an about box for this application. |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1328 |
Can be specialized by redefining #aboutThisApplicationText |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1329 |
and #aboutThisApplicationLabel" |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1330 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1331 |
|box image msg| |
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1332 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1333 |
msg := self aboutThisApplicationText. |
1419 | 1334 |
|
1335 |
AboutBox isNil ifTrue:[ |
|
1336 |
"/ this handles bad installations of ST/X, |
|
1337 |
"/ where the AboutBox is missing. |
|
1338 |
"/ (May vanish in the future) |
|
1339 |
^ self information:msg |
|
1340 |
]. |
|
1341 |
||
1342 |
box := AboutBox title:msg. |
|
1343 |
||
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1344 |
image := self aboutImage. |
1419 | 1345 |
image notNil ifTrue:[ |
1346 |
box image:image |
|
1347 |
]. |
|
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1348 |
box label:(resources string:self aboutThisApplicationLabel). |
1419 | 1349 |
box autoHideAfter:10 with:[]. |
1519
bc832a0d71ed
dont use explicit showAtPointer
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1350 |
box open. |
1526
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1351 |
|
02941e80a146
refactored aboutBox setup for easier subclassing
Claus Gittinger <cg@exept.de>
parents:
1523
diff
changeset
|
1352 |
"Modified: / 13.11.2001 / 12:33:52 / cg" |
1419 | 1353 |
! |
1354 |
||
1355 |
openHelpViewOnFile:pathToHelpText |
|
1356 |
"open a help viewer (as opened by the help buttons). |
|
1357 |
The argument is a relative path within the help directory |
|
1358 |
(but a file under the current directory is tried first)" |
|
1359 |
||
1360 |
self withWaitCursorDo:[ |
|
1361 |
HTMLDocumentView openFullOnHelpFile:pathToHelpText |
|
1362 |
] |
|
1363 |
||
1364 |
! |
|
1365 |
||
1366 |
showActiveHelp:aHelpText for:view |
|
1367 |
"This is invoked from the activeHelp event listener, to display some popup-help |
|
1368 |
for a component. If false is returned, the help manager will pop up |
|
1369 |
some active help bubble; if true is returned, it will assume that the |
|
1370 |
help text has been already displayed and will not do any further actions. |
|
1371 |
Here, we accept the help text, and push an event into out own input |
|
1372 |
queue, so that the help text will be displayed asyncronously by myself, |
|
1373 |
vis the #showHelp:for: method. |
|
1374 |
This can be redefined in concrete classes to handle active help differently." |
|
1375 |
||
1376 |
|wg mySensor| |
|
1377 |
||
1378 |
self showingHelp ifFalse: [ |
|
1379 |
^ true |
|
1380 |
]. |
|
1381 |
||
1382 |
"/ masterApplication notNil ifTrue:[ |
|
1383 |
"/ (masterApplication showActiveHelp:aHelpText for:view) ifTrue:[ |
|
1384 |
"/ ^ true |
|
1385 |
"/ ] |
|
1386 |
"/ ]. |
|
1387 |
||
1388 |
"/ NEW: push it into the event queue, to have it displayed |
|
1389 |
"/ syncronously with other events. |
|
1390 |
"/ (also any errors are reported as occurring in my context; |
|
1391 |
"/ instead of occurring in the activeHelp context). |
|
1392 |
||
1393 |
(wg := self windowGroup) notNil ifTrue:[ |
|
1394 |
mySensor := wg sensor. |
|
1395 |
mySensor notNil ifTrue:[ |
|
1396 |
mySensor flushEventsFor:self withType:#showHelp:for:. |
|
1397 |
mySensor |
|
1398 |
pushUserEvent:#showHelp:for: for:self |
|
1399 |
withArguments:(Array with:aHelpText with:view). |
|
1400 |
^ true |
|
1401 |
] |
|
1402 |
]. |
|
1403 |
||
1404 |
"/ mhmh - can this happen ? |
|
1405 |
||
1406 |
^ true |
|
1407 |
||
1408 |
"Modified: / 21.8.1998 / 16:00:37 / cg" |
|
1409 |
! |
|
1410 |
||
1411 |
showHelp:aHelpText for:view |
|
1412 |
"actual method which is supposed to display the help text. |
|
1413 |
Should be redefined in concrete classes, to put the help text |
|
1414 |
into some info label, or the windows title bar. |
|
1415 |
Here, the help text is ignored." |
|
1416 |
||
1417 |
masterApplication notNil ifTrue:[ |
|
1418 |
masterApplication showHelp:aHelpText for:view |
|
1419 |
]. |
|
1420 |
||
1421 |
"Modified: / 31.7.1998 / 19:13:59 / cg" |
|
1422 |
! |
|
1423 |
||
1424 |
showingHelp |
|
1425 |
"return true, if the activeHelp manager should invoke my #showHelp:for: |
|
1426 |
method, when the mouse pointer is moved over my widgets. |
|
1427 |
The default here is true, however, the #showHelp:for: methods are empty. |
|
1428 |
These should be redefined to put the help text into some info label, |
|
1429 |
or into the views title bar. |
|
1430 |
You may also redefine the showingHelp/showingHelp: methods, to |
|
1431 |
remember the flag setting." |
|
1432 |
||
1433 |
^ true |
|
1434 |
||
1435 |
"Modified: / 31.7.1998 / 17:55:31 / cg" |
|
1436 |
! ! |
|
1437 |
||
1438 |
!ApplicationModel methodsFor:'initialization'! |
|
1439 |
||
1440 |
addTopViewsToCurrentProject |
|
1441 |
"add all of my topViews to the current projects list of views. |
|
1442 |
This allows hiding views on a per-project basis. |
|
1443 |
Applications which do not want to be switched with projects |
|
1444 |
(such as the Launcher), may redefine this to a noop." |
|
1445 |
||
1446 |
(self windowGroup topViews ? #()) do:[:aView | |
|
1447 |
aView addToCurrentProject |
|
1448 |
] |
|
1449 |
||
1450 |
"Modified: 17.1.1997 / 19:43:39 / cg" |
|
1451 |
! |
|
1452 |
||
1453 |
basicInitialize |
|
1454 |
"initialize the application. |
|
1455 |
Since ST-80 applications seem commonly to redefine #initialize |
|
1456 |
without doing a super initialize, the real initialization is |
|
1457 |
done here ..." |
|
1458 |
||
1454 | 1459 |
Screen notNil ifTrue:[ |
1460 |
device := Screen current. |
|
1461 |
]. |
|
1419 | 1462 |
|
1463 |
"claus: I wanted to delay the creation & assignment of the |
|
1464 |
builder till later, to allow setting to another builder. |
|
1465 |
however, some ST-80 code accesses the builder right after instance |
|
1466 |
creation ..." |
|
1467 |
||
1468 |
"/ " |
|
1469 |
"/ Create a windowBuilder to have someone around which |
|
1470 |
"/ understands the builder protocol. Since UIBuilder is not present |
|
1471 |
"/ in all systems, this allows operation without one (unless a spec |
|
1472 |
"/ is read later ...) |
|
1473 |
"/ " |
|
1474 |
||
1475 |
"/ changed - cg; create the builder later. |
|
1476 |
"/ some apps (RefactoringBrowser) depend on this being set |
|
1477 |
"/ late. |
|
1478 |
||
1479 |
"/ builder := self builderClass new. |
|
1480 |
"/ builder notNil ifTrue:[builder application:self]. |
|
1481 |
resources := self class classResources. |
|
1482 |
||
1483 |
"Modified: / 20.6.1998 / 11:53:36 / cg" |
|
1484 |
! |
|
1485 |
||
1486 |
initialize |
|
1487 |
"nothing done here; |
|
1488 |
but can be redefined in concrete applications" |
|
1489 |
! |
|
1490 |
||
1491 |
setDevice:aDevice |
|
1492 |
"set the device (i.e. some Screen), where the application |
|
1493 |
shall open its view(s). |
|
1494 |
The default device (if not set here) will be the current screen." |
|
1495 |
||
1496 |
device := aDevice |
|
1497 |
||
1498 |
"Created: 5.7.1996 / 12:01:40 / cg" |
|
1499 |
"Modified: 17.1.1997 / 19:44:09 / cg" |
|
1500 |
! ! |
|
1501 |
||
1502 |
!ApplicationModel methodsFor:'misc'! |
|
1503 |
||
1504 |
information:aString |
|
1505 |
"like Objects information, but translates the string via the |
|
1506 |
resourcePack, thus giving a translated string automatically" |
|
1507 |
||
1508 |
super information:(resources string:aString) withCRs |
|
1509 |
||
1510 |
"Created: / 20.5.1998 / 03:48:43 / cg" |
|
1511 |
! |
|
1512 |
||
1513 |
restoreCursors |
|
1514 |
"restore the original cursors in all of my views" |
|
1515 |
||
1516 |
^ self window windowGroup restoreCursors |
|
1517 |
||
1518 |
"Created: 1.6.1996 / 17:01:24 / cg" |
|
1519 |
! |
|
1520 |
||
1521 |
showCursor:aCursor |
|
1522 |
"set all of my views cursor to aCursor. |
|
1523 |
It can be restored with #restoreCursor." |
|
1524 |
||
1525 |
^ self window windowGroup showCursor:aCursor |
|
1526 |
||
1527 |
"Created: 1.6.1996 / 17:01:09 / cg" |
|
1528 |
! |
|
1529 |
||
1530 |
warn:aString |
|
1531 |
"like Objects warn, but translates the string via the |
|
1532 |
resourcePack, thus giving a translated string automatically" |
|
1533 |
||
1527 | 1534 |
|s| |
1535 |
||
1536 |
resources isNil ifTrue:[ |
|
1537 |
"/ mhmh an early warning ... |
|
1538 |
s := aString |
|
1539 |
] ifFalse:[ |
|
1540 |
s := resources string:aString |
|
1541 |
]. |
|
1542 |
super warn:s withCRs |
|
1419 | 1543 |
|
1544 |
"Created: / 20.5.1998 / 01:14:52 / cg" |
|
1527 | 1545 |
"Modified: / 13.11.2001 / 20:10:12 / cg" |
1419 | 1546 |
! |
1547 |
||
1548 |
warn:aString with:arg |
|
1549 |
"like Objects warn, but translates the string via the |
|
1550 |
resourcePack, thus giving a translated string automatically" |
|
1551 |
||
1552 |
super warn:(resources string:aString with:arg) withCRs |
|
1553 |
||
1554 |
! |
|
1555 |
||
1556 |
warn:aString with:arg1 with:arg2 |
|
1557 |
"like Objects warn, but translates the string via the |
|
1558 |
resourcePack, thus giving a translated string automatically" |
|
1559 |
||
1560 |
super warn:(resources string:aString with:arg1 with:arg2) withCRs |
|
1561 |
||
1562 |
! |
|
1563 |
||
1564 |
warn:aString with:arg1 with:arg2 with:arg3 |
|
1565 |
"like Objects warn, but translates the string via the |
|
1566 |
resourcePack, thus giving a translated string automatically" |
|
1567 |
||
1568 |
super warn:(resources string:aString with:arg1 with:arg2 with:arg3) withCRs |
|
1569 |
||
1570 |
! |
|
1571 |
||
1572 |
warn:aString with:arg1 with:arg2 with:arg3 with:arg4 |
|
1573 |
"like Objects warn, but translates the string via the |
|
1574 |
resourcePack, thus giving a translated string automatically" |
|
1575 |
||
1576 |
super warn:(resources string:aString with:arg1 with:arg2 with:arg3 with:arg4) withCRs |
|
1577 |
||
1578 |
"Created: / 23.2.2000 / 09:43:04 / cg" |
|
1579 |
! |
|
1580 |
||
1581 |
withCursor:aCursor do:aBlock |
|
1582 |
"evaluate aBlock, showing aCursor in my topView and all of its subviews. |
|
1583 |
Return the value of aBlock." |
|
1584 |
||
1585 |
|w ret| |
|
1586 |
||
1587 |
w := self window. |
|
1588 |
w notNil ifTrue:[ |
|
1589 |
^ w withCursor:aCursor do:aBlock |
|
1590 |
]. |
|
1591 |
aCursor showWhile:[ret := aBlock value]. |
|
1592 |
^ ret. |
|
1593 |
||
1594 |
"Modified: / 23.9.1998 / 17:00:25 / cg" |
|
969
ac96df5a2f97
oops - had to undo some error-handling stuff.
Claus Gittinger <cg@exept.de>
parents:
967
diff
changeset
|
1595 |
! |
ac96df5a2f97
oops - had to undo some error-handling stuff.
Claus Gittinger <cg@exept.de>
parents:
967
diff
changeset
|
1596 |
|
1419 | 1597 |
withExecuteCursorDo:aBlock |
1598 |
"evaluate aBlock, showing an executeCursor in my topView and all of its subviews. |
|
1599 |
Return the value of aBlock." |
|
1600 |
||
1601 |
^ self withCursor:(Cursor execute) do:aBlock |
|
1602 |
||
1603 |
"Created: 14.12.1995 / 20:57:03 / cg" |
|
1604 |
! |
|
1605 |
||
1606 |
withReadCursorDo:aBlock |
|
1607 |
"evaluate aBlock, showing a readCursor in my topView and all of its subviews. |
|
1608 |
Return the value of aBlock." |
|
1609 |
||
1610 |
^ self withCursor:(Cursor read) do:aBlock |
|
1611 |
||
1612 |
"Created: 14.12.1995 / 20:56:47 / cg" |
|
1613 |
"Modified: 14.12.1995 / 20:57:36 / cg" |
|
1614 |
! |
|
1615 |
||
1616 |
withWaitCursorDo:aBlock |
|
1617 |
"evaluate aBlock, showing a waitCursor in my topView and all of its subviews. |
|
1618 |
Return the value of aBlock." |
|
1619 |
||
1620 |
^ self withCursor:Cursor wait do:aBlock |
|
1621 |
! ! |
|
1622 |
||
1623 |
!ApplicationModel methodsFor:'opening'! |
|
1624 |
||
1625 |
allButOpen |
|
1626 |
"create my views from the windowSpec, but do not open the main window." |
|
1627 |
||
1628 |
^ self allButOpenInterface:#windowSpec. |
|
1629 |
||
1630 |
"Modified: / 19.6.1998 / 01:48:26 / cg" |
|
1631 |
! |
|
1632 |
||
1633 |
allButOpenFrom:aSpec |
|
1634 |
"create my views but do not open the main window. |
|
1635 |
The argument is a spec which defines the interface." |
|
1636 |
||
1637 |
|realBuilder window| |
|
1638 |
||
1639 |
"/ DISABLED; see comment in basicInitialize |
|
1640 |
"/ |
|
1641 |
"/ " |
|
1642 |
"/ here, we kludge a bit: up to now, the builder was an |
|
1643 |
"/ instance of the no-op WindowBuilder. Now, it becomes |
|
1644 |
"/ a UIBuilder .... |
|
1645 |
"/ This allows for ApplicationModels without a UIBuilder |
|
1646 |
"/ if not needed. |
|
1647 |
"/ " |
|
1648 |
"/ realBuilder := UIBuilder new. |
|
1649 |
"/ builder := realBuilder. |
|
1650 |
"/ builder application:self. |
|
1651 |
"/ builder bindings:builder bindings. |
|
1652 |
||
1653 |
builder isNil ifTrue:[ |
|
1654 |
self createBuilder. |
|
1655 |
]. |
|
1656 |
||
1657 |
self preBuildWith:builder. |
|
1658 |
builder buildFromSpec:aSpec. |
|
1659 |
window := builder window. |
|
1660 |
window model:self. |
|
1661 |
(window respondsTo:#application:) ifTrue:[ |
|
1662 |
window application:self. |
|
1663 |
]. |
|
1664 |
self showingHelp ifTrue: [ActiveHelp startFor: self]. |
|
1665 |
self postBuildWith:builder. |
|
1666 |
||
1667 |
"Modified: / 19.6.1998 / 03:35:31 / cg" |
|
1668 |
! |
|
1669 |
||
1670 |
allButOpenInterface:aSymbol |
|
1671 |
"create my views but do not open the main window. |
|
1672 |
The argument specifies a selector of a method, |
|
1673 |
which when sent to myself should return a spec. |
|
1674 |
Notice, this returns the windowBuilder." |
|
1675 |
||
1676 |
self allButOpenFrom:(self interfaceSpecFor:aSymbol). |
|
1677 |
^ builder |
|
1678 |
||
1679 |
"Modified: / 19.6.1998 / 01:48:26 / cg" |
|
1680 |
! |
|
1681 |
||
1682 |
buildSubCanvas:spec withBuilder:aBuilder |
|
1683 |
"build a subcanvases spec into aSubcanvas" |
|
1684 |
||
1685 |
|sameApp prevSpec prevSource specToBuild| |
|
1686 |
||
1687 |
builder isNil ifTrue:[ |
|
1688 |
builder := aBuilder. |
|
1689 |
aBuilder isNil ifTrue:[ |
|
1690 |
self createBuilder |
|
1691 |
] |
|
1692 |
] ifFalse:[ |
|
1693 |
prevSpec := aBuilder spec. |
|
1694 |
prevSource := aBuilder source. |
|
1695 |
]. |
|
1696 |
||
1697 |
aBuilder source:self. |
|
1698 |
||
1699 |
"/ if the subcanvases appModel is NOT the same as |
|
1700 |
"/ the topApp, it must be pre/post-built. |
|
1701 |
"/ Otherwise, we invoke pre/post-builtAsSubcanvas. |
|
1702 |
"/ which provides a hook for redefinition in concrete appModels. |
|
1703 |
"/ This avoids invoking pre/postBuild twice for subCanvases which |
|
1704 |
"/ have the topApp as appModel. |
|
1705 |
||
1706 |
sameApp := aBuilder application == aBuilder window topView application. |
|
1707 |
sameApp ifTrue:[ |
|
1708 |
self preBuildAsSubcanvasWith:aBuilder. |
|
1709 |
] ifFalse:[ |
|
1710 |
self preBuildWith:aBuilder. |
|
1711 |
]. |
|
1712 |
||
1713 |
"/ subapps should not build the menu and other fullSpec stuff. |
|
1714 |
spec class == FullSpec ifTrue:[ |
|
1715 |
specToBuild := spec component. |
|
1716 |
] ifFalse:[ |
|
1717 |
specToBuild := spec. |
|
1718 |
]. |
|
1719 |
aBuilder buildFromSpec:specToBuild. |
|
1720 |
||
1721 |
sameApp ifTrue:[ |
|
1722 |
self postBuildAsSubcanvasWith:aBuilder. |
|
1723 |
] ifFalse:[ |
|
1724 |
self postBuildWith:aBuilder. |
|
1725 |
]. |
|
1726 |
||
1727 |
prevSpec notNil ifTrue:[ |
|
1728 |
"/ restore state in builder if original builder was used |
|
1729 |
aBuilder spec:prevSpec. |
|
1730 |
aBuilder source:prevSource. |
|
1731 |
]. |
|
1732 |
||
1733 |
^ aBuilder |
|
1734 |
||
1735 |
"Created: / 18.6.1998 / 20:08:45 / cg" |
|
1736 |
"Modified: / 8.7.1998 / 18:30:46 / cg" |
|
1359
f40bfb94f862
allow for application to decide what type of
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1737 |
! |
f40bfb94f862
allow for application to decide what type of
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
1738 |
|
1419 | 1739 |
open |
1740 |
"open a standard interface" |
|
1741 |
||
1742 |
^ self openInterface |
|
1743 |
||
1744 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
1745 |
! |
|
1746 |
||
1747 |
openAt:aPoint |
|
1748 |
"open a standard interface at some point" |
|
1749 |
||
1750 |
^ self openInterfaceAt:aPoint |
|
1751 |
||
1752 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
1753 |
"Created: 14.2.1997 / 20:17:41 / cg" |
|
1754 |
! |
|
1755 |
||
1756 |
openDialog |
|
1757 |
"open the window - assumes that the builder has already setup |
|
1758 |
the interface." |
|
1759 |
||
1760 |
^ builder openDialog. |
|
1761 |
||
1762 |
"Modified: 14.2.1997 / 20:32:52 / cg" |
|
1763 |
! |
|
1764 |
||
1765 |
openDialogInterface:aSelector |
|
1766 |
"open a dialog" |
|
1767 |
||
1768 |
^ self openDialogInterface:aSelector withBindings:nil |
|
1769 |
||
1770 |
"Modified: 28.2.1997 / 14:08:01 / cg" |
|
1771 |
! |
|
1772 |
||
1773 |
openDialogInterface:aSelector withBindings:bindings |
|
1774 |
"open a dialog, given a spec-selector" |
|
1775 |
||
1776 |
^ SimpleDialog new |
|
1777 |
openFor:self |
|
1778 |
interface:aSelector |
|
1779 |
withBindings:bindings |
|
1780 |
||
1781 |
"Created: / 28.2.1997 / 14:07:45 / cg" |
|
1782 |
"Modified: / 23.1.1998 / 18:18:14 / cg" |
|
1783 |
! |
|
1784 |
||
1785 |
openDialogInterfaceSpec:aSpec withBindings:bindings |
|
1786 |
"open a dialog, given a spec" |
|
1787 |
||
1788 |
^ SimpleDialog new |
|
1789 |
openFor:self |
|
1790 |
interfaceSpec:aSpec |
|
1791 |
withBindings:bindings |
|
1792 |
||
1793 |
"Created: / 28.2.1997 / 14:07:45 / cg" |
|
1794 |
"Modified: / 23.1.1998 / 18:18:14 / cg" |
|
1795 |
! |
|
1796 |
||
1797 |
openDialogSpec:aSpec withBindings:bindings |
|
1798 |
"open a dialog" |
|
1799 |
||
1800 |
^ SimpleDialog new |
|
1801 |
openFor:self |
|
1802 |
spec:aSpec |
|
1803 |
withBindings:bindings |
|
1804 |
||
1805 |
"Modified: / 23.1.1998 / 18:18:14 / cg" |
|
1806 |
"Created: / 20.5.1998 / 20:27:56 / cg" |
|
1807 |
! |
|
1808 |
||
1809 |
openInterface |
|
1810 |
"open a standard interface. |
|
1811 |
||
1812 |
Subclasses which do not have an interfaceSpec |
|
1813 |
should redefine this method and create & open their view(s) there. |
|
1814 |
(see Launcher as an example)." |
|
1815 |
||
1816 |
^ self openInterface:#windowSpec |
|
1817 |
||
1818 |
"Modified: / 9.9.1996 / 22:39:23 / stefan" |
|
1819 |
"Modified: / 23.1.1998 / 18:16:50 / cg" |
|
1820 |
! |
|
1821 |
||
1822 |
openInterface:aSymbol |
|
1823 |
"open a specific interface. |
|
1824 |
The argument, aSymbol specifies which interface. The concrete |
|
1825 |
application subclass must provide a method with that name, |
|
1826 |
which must return an interfaceSpec. This is forwarded to |
|
1827 |
the builder to create the views. |
|
1828 |
Typically, applications only use one interface, |
|
1829 |
returned by the #windowSpec method." |
|
1830 |
||
1831 |
self allButOpenInterface:aSymbol. |
|
1832 |
self openWindow. |
|
1833 |
^ builder |
|
1834 |
||
1835 |
"Modified: 14.2.1997 / 20:25:33 / cg" |
|
1836 |
! |
|
1837 |
||
1838 |
openInterface:aSymbol at:aLocation |
|
1839 |
"open a specific interface. |
|
1840 |
||
1841 |
The argument, aSymbol specifies which interface. The concrete |
|
1842 |
application subclass must provide a method with that name, |
|
1843 |
which must return an interfaceSpec. This is forwarded to |
|
1844 |
the builder to create the views. |
|
1845 |
Typically, applications only use one interface, |
|
1846 |
returned by the #windowSpec method." |
|
1847 |
||
1848 |
self allButOpenInterface:aSymbol. |
|
1849 |
self openWindowAt:aLocation. |
|
1850 |
^ builder |
|
1851 |
||
1852 |
"Created: 14.2.1997 / 20:19:44 / cg" |
|
1853 |
! |
|
1854 |
||
1855 |
openInterfaceAt:aLocation |
|
1856 |
"open a standard interface." |
|
1857 |
||
1858 |
^ self openInterface:#windowSpec at:aLocation |
|
1859 |
||
1860 |
"Created: / 14.2.1997 / 20:18:20 / cg" |
|
1861 |
"Modified: / 23.1.1998 / 18:17:13 / cg" |
|
1862 |
! |
|
1863 |
||
1864 |
openInterfaceModal |
|
1865 |
"open a standard interface as a modal dialog. |
|
1866 |
||
1867 |
Subclasses which do not have an interfaceSpec |
|
1868 |
should redefine this method and create & open their view(s) there. |
|
1869 |
(see Launcher as an example)." |
|
1870 |
||
1871 |
^ self openInterfaceModal:#windowSpec |
|
1872 |
||
1873 |
"Modified: / 9.9.1996 / 22:39:23 / stefan" |
|
1874 |
"Modified: / 23.1.1998 / 18:17:17 / cg" |
|
1875 |
! |
|
1876 |
||
1877 |
openInterfaceModal:aSymbol |
|
1878 |
"open a specific interface as a modal dialog. |
|
1879 |
The argument, aSymbol specifies which interface. The concrete |
|
1880 |
application subclass must provide a method with that name, |
|
1881 |
which must return an interfaceSpec. This is forwarded to |
|
1882 |
the builder to create the views. |
|
1883 |
Typically, applications only use one interface, |
|
1884 |
returned by the #windowSpec method." |
|
1885 |
||
1886 |
self allButOpenInterface:aSymbol. |
|
1887 |
self openWindowModal. |
|
1888 |
^ builder |
|
1889 |
||
1890 |
"Modified: 14.2.1997 / 20:25:33 / cg" |
|
969
ac96df5a2f97
oops - had to undo some error-handling stuff.
Claus Gittinger <cg@exept.de>
parents:
967
diff
changeset
|
1891 |
! |
ac96df5a2f97
oops - had to undo some error-handling stuff.
Claus Gittinger <cg@exept.de>
parents:
967
diff
changeset
|
1892 |
|
1419 | 1893 |
openInterfaceModal:aSymbol at:location |
1894 |
"open a specific interface modal at some screen location. |
|
1895 |
The argument, aSymbol specifies which interface. The concrete |
|
1896 |
application subclass must provide a method with that name, |
|
1897 |
which must return an interfaceSpec. This is forwarded to |
|
1898 |
the builder to create the views. |
|
1899 |
Typically, applications only use one interface, |
|
1900 |
returned by the #windowSpec method." |
|
1901 |
||
1902 |
self allButOpenInterface:aSymbol. |
|
1903 |
self openWindowModalAt:location. |
|
1904 |
^ builder |
|
1905 |
||
1906 |
"Modified: 14.2.1997 / 20:25:33 / cg" |
|
1907 |
! |
|
1908 |
||
1909 |
openModal |
|
1910 |
"open a standard interface as a modal dialog" |
|
1911 |
||
1912 |
^ self openInterfaceModal |
|
1913 |
||
1914 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
1915 |
! |
|
1916 |
||
1917 |
openOnDevice:aDevice |
|
1918 |
"open a standard interface on some other device" |
|
1919 |
||
1920 |
self setDevice:aDevice. |
|
1444 | 1921 |
Screen currentScreenQuerySignal answer:aDevice |
1922 |
do:[ |
|
1923 |
^ self open |
|
1924 |
] |
|
1419 | 1925 |
|
1926 |
"Created: 13.1.1997 / 21:24:11 / cg" |
|
1927 |
"Modified: 13.1.1997 / 21:24:30 / cg" |
|
1928 |
! |
|
1929 |
||
1930 |
openSpec:anInterfaceSpec |
|
1931 |
"open a view as specified in anInterfaceSpec." |
|
1932 |
||
1933 |
self allButOpenFrom:anInterfaceSpec. |
|
1934 |
self openWindow. |
|
1935 |
^ builder |
|
1936 |
||
1937 |
"Modified: / 14.2.1997 / 20:25:33 / cg" |
|
1938 |
"Created: / 20.5.1998 / 20:08:51 / cg" |
|
1939 |
! |
|
1940 |
||
1941 |
openSpecModal:anInterfaceSpec |
|
1942 |
"open an interface spec modal" |
|
1943 |
||
1944 |
self allButOpenFrom:anInterfaceSpec. |
|
1945 |
self openWindowModal. |
|
1946 |
^ builder |
|
1947 |
||
1948 |
"Modified: / 14.2.1997 / 20:25:33 / cg" |
|
1949 |
"Created: / 20.5.1998 / 20:20:21 / cg" |
|
1950 |
! |
|
1951 |
||
1952 |
openWindow |
|
1953 |
"open the window - assumes that the builder has already setup |
|
1954 |
the interface." |
|
1955 |
||
1956 |
builder openWindow. |
|
1957 |
||
1958 |
"Created: 14.2.1997 / 20:20:39 / cg" |
|
1959 |
! |
|
1960 |
||
1961 |
openWindowAt:aLocation |
|
1962 |
"open the window - assumes that the builder has already setup |
|
1963 |
the interface." |
|
1964 |
||
1965 |
builder openWindowAt:aLocation. |
|
1966 |
||
1967 |
"Created: 14.2.1997 / 20:20:55 / cg" |
|
1968 |
! |
|
1969 |
||
1970 |
openWindowAtCenter |
|
1971 |
"open the window centered on the screen |
|
1972 |
- assumes that the builder has already setup the interface." |
|
1973 |
||
1974 |
builder openWindowAt:#center |
|
1975 |
||
1976 |
"Created: 14.2.1997 / 20:20:55 / cg" |
|
1977 |
! |
|
1978 |
||
1979 |
openWindowModal |
|
1980 |
"open the window - assumes that the builder has already setup |
|
1981 |
the interface." |
|
1982 |
||
1983 |
"/ builder openDialog. |
|
1984 |
builder |
|
1985 |
openAt:nil |
|
1986 |
withExtent:nil |
|
1987 |
andType:#dialog |
|
1988 |
||
1989 |
"Created: 14.2.1997 / 20:20:39 / cg" |
|
1990 |
! |
|
1991 |
||
1992 |
openWindowModalAt:aLocation |
|
1993 |
"open the window modal - assumes that the builder has already setup |
|
1994 |
the interface." |
|
1995 |
||
1996 |
builder openDialogAt:aLocation. |
|
1997 |
||
1998 |
"Created: 14.2.1997 / 20:20:55 / cg" |
|
1999 |
! |
|
2000 |
||
1478 | 2001 |
openWithExtent:extPoint |
2002 |
"open a standard interface with given extent" |
|
2003 |
||
2004 |
|bldr| |
|
2005 |
||
2006 |
bldr := self allButOpen. |
|
2007 |
bldr openWithExtent:extPoint. |
|
2008 |
^ bldr |
|
2009 |
||
2010 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
2011 |
! |
|
2012 |
||
1419 | 2013 |
postApplicationProcessCreate:newProcess windowGroup:newGroup |
2014 |
"this is sent whenever a new application is launched from this app, |
|
2015 |
which forks its own windowGroup process. Allows for process group management, |
|
2016 |
or process-global exception handlers to be installed. |
|
2017 |
Nothing done here - to be redefined in concrete applications" |
|
2018 |
||
2019 |
! |
|
2020 |
||
2021 |
postBuildAsSubcanvasWith:aBuilder |
|
2022 |
"this is sent after an interface is built from a spec as subcanvas. |
|
2023 |
Can be redefined in subclasses for additional setup after |
|
2024 |
the subcanvas view has been built, but not yet opened." |
|
2025 |
||
2026 |
|sameApp| |
|
2027 |
||
2028 |
sameApp := aBuilder application == aBuilder window topView application. |
|
2029 |
||
2030 |
"/ If I am opened as subcanvas in another application |
|
2031 |
"/ then treat this like a regular open. |
|
2032 |
"/ otherwise ignore it. |
|
2033 |
sameApp ifFalse:[ |
|
2034 |
self postBuildWith:aBuilder. |
|
2035 |
] |
|
2036 |
||
2037 |
"Modified: / 8.7.1998 / 18:28:55 / cg" |
|
2038 |
! |
|
2039 |
||
2040 |
postBuildWith:aBuilder |
|
2041 |
"this is sent after an interface is built from a spec. |
|
2042 |
Can be redefined in subclasses for additional setup after |
|
2043 |
the view has been built, but not yet opened." |
|
2044 |
! |
|
2045 |
||
1432
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2046 |
postOpenAsSubcanvasWith:aBuilder |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2047 |
"this is sent after the applications window is opened inside another application. |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2048 |
Can be redefined in subclasses for actions after opening the view." |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2049 |
! |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2050 |
|
1419 | 2051 |
postOpenWith:aBuilder |
2052 |
"this is sent after the applications main window is opened. |
|
2053 |
Can be redefined in subclasses for actions after opening the view." |
|
2054 |
||
2055 |
||
138 | 2056 |
! |
2057 |
||
1419 | 2058 |
preBuildAsSubcanvasWith:aBuilder |
2059 |
"this is sent before an interface is built from a spec as a subcanvas. |
|
2060 |
Can be redefined for apps which need to be informed about that." |
|
2061 |
||
2062 |
"Modified: / 8.7.1998 / 18:29:34 / cg" |
|
2063 |
! |
|
2064 |
||
2065 |
preBuildWith:aBuilder |
|
2066 |
"this is sent before an interface is built from a spec. |
|
2067 |
Can be redefined in subclasses. |
|
2068 |
mhmh - what should this do here ?" |
|
2069 |
! ! |
|
2070 |
||
2071 |
!ApplicationModel methodsFor:'private'! |
|
2072 |
||
2073 |
builderClass |
|
2074 |
"return the UIBuilder class for me. |
|
2075 |
This method can be redefined if (eventually) there are |
|
2076 |
spec readers for other UI languages (motif UIL ?)" |
|
2077 |
||
2078 |
^ UIBuilder |
|
2079 |
||
2080 |
"Created: / 19.6.1998 / 01:39:26 / cg" |
|
2081 |
"Modified: / 19.6.1998 / 01:45:24 / cg" |
|
2082 |
! |
|
2083 |
||
2084 |
createBuilder |
|
1431 | 2085 |
"create a WindowBuilder if not already present" |
2086 |
||
1419 | 2087 |
builder isNil ifTrue:[ |
2088 |
builder := self builderClass new. |
|
2089 |
builder application:self. |
|
2090 |
] |
|
2091 |
||
2092 |
"Created: / 19.6.1998 / 03:32:37 / cg" |
|
2093 |
! |
|
2094 |
||
2095 |
opened:whichTopView |
|
2096 |
"the topView has been opened. |
|
2097 |
This is sent by my topView when its really open |
|
2098 |
(i.e. finally visible)" |
|
2099 |
||
2100 |
self addTopViewsToCurrentProject. |
|
2101 |
self postOpenWith:builder |
|
2102 |
! |
|
2103 |
||
2104 |
selfResponsibleFor:aKey |
|
1431 | 2105 |
"internal: return true, if I am to provide a value for some aspect." |
2106 |
||
1419 | 2107 |
^ (aKey isNil or:[masterApplication isNil or:[self respondsTo:aKey]]) |
2108 |
! ! |
|
2109 |
||
2110 |
!ApplicationModel methodsFor:'queries'! |
|
2111 |
||
2112 |
defaultWindowType |
|
2113 |
"Applications come up non-modal, by default" |
|
2114 |
||
2115 |
^ #normal |
|
2116 |
||
2117 |
"Created: 17.1.1997 / 19:57:34 / cg" |
|
2118 |
! |
|
2119 |
||
2120 |
graphicsDevice |
|
2121 |
"return the device I want to open my views on. |
|
2122 |
The default (if not created with #onDevice:) is the currently |
|
2123 |
active screen." |
|
2124 |
||
2125 |
^ device |
|
2126 |
||
2127 |
"Created: 5.7.1996 / 17:51:31 / cg" |
|
1132
b801d744051b
kludge & hook to allow modeless appModels to
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
2128 |
! |
b801d744051b
kludge & hook to allow modeless appModels to
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
2129 |
|
1419 | 2130 |
interfaceSpecFor:aSelector |
2131 |
"return an interface spec. |
|
2132 |
Here, the query is forwarded to my class. |
|
2133 |
Can be refefined in subclasses which want to provide per-instance specs." |
|
2134 |
||
2135 |
^ self class interfaceSpecFor:aSelector |
|
2136 |
||
2137 |
"Created: / 25.1.1998 / 19:45:12 / cg" |
|
2138 |
"Modified: / 25.1.1998 / 19:47:09 / cg" |
|
2139 |
! |
|
2140 |
||
1481
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
2141 |
isOpen |
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
2142 |
"answer true if the application's window is open" |
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
2143 |
|
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
2144 |
|win| |
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
2145 |
|
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
2146 |
^ (win := self window) notNil and:[win isOpen] |
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
2147 |
! |
e1922b505268
Define #isOpen to check wether an application has an open window.
Stefan Vogel <sv@exept.de>
parents:
1479
diff
changeset
|
2148 |
|
1419 | 2149 |
processName |
2150 |
"return a name to be shown for me in the process monitor" |
|
2151 |
||
2152 |
self class == ApplicationModel ifTrue:[ |
|
2153 |
^ 'Application' |
|
2154 |
]. |
|
2155 |
^ self class nameWithoutPrefix |
|
2156 |
||
2157 |
"Modified: / 4.12.1997 / 12:39:14 / cg" |
|
2158 |
! |
|
2159 |
||
2160 |
resolveClassNamed:something inClass:aClass |
|
2161 |
"return the class from something, a class, symbol, string or nil. |
|
2162 |
first we are looking in the namespace of the application, than of the |
|
2163 |
current namespace and than in Smalltalk |
|
2164 |
" |
|
2165 |
||
2166 |
^ Smalltalk resolveName:something inClass:aClass. |
|
2167 |
! |
|
2168 |
||
2169 |
resolveName:something |
|
2170 |
"return the class from something, a class, symbol, string or nil. |
|
2171 |
first we are looking in the namespace of the application, than of the |
|
2172 |
current namespace and than in Smalltalk |
|
2173 |
" |
|
2174 |
^ self resolveName:something inClass:self class |
|
2175 |
! |
|
2176 |
||
2177 |
resolveName:something inClass:aClass |
|
2178 |
"return the class from something, a class, symbol, string or nil. |
|
2179 |
first we are looking in the namespace of the application, than of the |
|
2180 |
current namespace and than in Smalltalk |
|
2181 |
" |
|
2182 |
|cls| |
|
2183 |
||
2184 |
aClass notNil ifTrue:[ |
|
2185 |
(cls := Smalltalk resolveName:something inClass:aClass) notNil ifTrue:[ |
|
2186 |
^ cls |
|
2187 |
]. |
|
2188 |
||
2189 |
masterApplication notNil ifTrue:[ |
|
2190 |
^ masterApplication resolveName:something |
|
2191 |
] |
|
2192 |
]. |
|
2193 |
^ nil |
|
2194 |
! |
|
2195 |
||
2196 |
topApplication |
|
2197 |
"return the top-master application" |
|
2198 |
||
2199 |
masterApplication isNil ifTrue:[ |
|
2200 |
^ self |
|
2201 |
]. |
|
2202 |
^ masterApplication topApplication |
|
2203 |
||
2204 |
"Created: / 6.6.1998 / 19:40:42 / cg" |
|
2205 |
! ! |
|
2206 |
||
2207 |
!ApplicationModel methodsFor:'startup / release'! |
|
2208 |
||
2209 |
applicationWindowClass |
|
1431 | 2210 |
"return the class used for my (top-) windows" |
2211 |
||
1419 | 2212 |
^ ApplicationWindow |
2213 |
! |
|
2214 |
||
2215 |
close |
|
2216 |
"this is sent by my topView when about to be closed |
|
2217 |
by the program (not by the windowManager). |
|
2218 |
Notice, that we get a closeRequest message if closed by the windowManager, |
|
2219 |
which can be rejected by the app (or confirmed via a dialog) |
|
2220 |
Could be redefined in subclasses." |
|
2221 |
||
2222 |
self closeDownViews |
|
1132
b801d744051b
kludge & hook to allow modeless appModels to
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
2223 |
! |
b801d744051b
kludge & hook to allow modeless appModels to
Claus Gittinger <cg@exept.de>
parents:
1118
diff
changeset
|
2224 |
|
1419 | 2225 |
closeDownViews |
2226 |
"close down the applications view(s)" |
|
2227 |
||
2228 |
|wg wgProcess views| |
|
2229 |
||
2230 |
self release. |
|
2231 |
ActiveHelp stopFor:self. |
|
2232 |
||
2233 |
(wg := self windowGroup) notNil ifTrue:[ |
|
2234 |
wgProcess := wg process. |
|
2235 |
(Processor activeProcess ~~ wgProcess |
|
2236 |
and:[wgProcess notNil]) ifTrue:[ |
|
2237 |
wgProcess terminate |
|
2238 |
] ifFalse:[ |
|
2239 |
wg closeDownViews. |
|
2240 |
] |
|
2241 |
] |
|
2242 |
! |
|
2243 |
||
2244 |
closeRequest |
|
2245 |
"this is sent by my topView when about to be closed by the windowManager. |
|
2246 |
Could be redefined in subclasses to suppress close or confirm." |
|
2247 |
||
1528 | 2248 |
|sav window| |
2249 |
||
2250 |
window := self window. |
|
2251 |
window isNil ifTrue:[ |
|
1461
f3ad0001d240
fixed: raise leaveSignal in closeRequest for a modal opened view
tm
parents:
1454
diff
changeset
|
2252 |
'ApplicationModel [warning]: oops - closeRequest for non-view application arrived' infoPrintCR. |
f3ad0001d240
fixed: raise leaveSignal in closeRequest for a modal opened view
tm
parents:
1454
diff
changeset
|
2253 |
^ self |
f3ad0001d240
fixed: raise leaveSignal in closeRequest for a modal opened view
tm
parents:
1454
diff
changeset
|
2254 |
]. |
f3ad0001d240
fixed: raise leaveSignal in closeRequest for a modal opened view
tm
parents:
1454
diff
changeset
|
2255 |
|
1528 | 2256 |
(window isTopView not) ifTrue:[ |
2257 |
window topView isModal ifTrue:[ |
|
1461
f3ad0001d240
fixed: raise leaveSignal in closeRequest for a modal opened view
tm
parents:
1454
diff
changeset
|
2258 |
WindowGroup leaveSignal raise. |
f3ad0001d240
fixed: raise leaveSignal in closeRequest for a modal opened view
tm
parents:
1454
diff
changeset
|
2259 |
]. |
f3ad0001d240
fixed: raise leaveSignal in closeRequest for a modal opened view
tm
parents:
1454
diff
changeset
|
2260 |
|
1419 | 2261 |
'ApplicationModel [warning]: oops - closeRequest for non-TopView arrived' infoPrintCR. |
2262 |
^ self |
|
2263 |
]. |
|
2264 |
||
2265 |
"/ In multiView apps, tell my master. |
|
2266 |
"/ (but not if I am a modal reincarnation) |
|
2267 |
(masterApplication notNil |
|
1528 | 2268 |
and:[window isModal not]) ifTrue:[ |
1419 | 2269 |
|
2270 |
"/ temporary clear my masterApplication to prevent |
|
2271 |
"/ endless recursion, in case the master sends me |
|
2272 |
"/ a closeRequest (although, it is supposed to |
|
2273 |
"/ send me a closeDownViews ...) |
|
2274 |
||
2275 |
sav := masterApplication. |
|
2276 |
masterApplication := nil. |
|
1528 | 2277 |
sav closeRequestFor:window. |
1419 | 2278 |
|
2279 |
"/ restore - in case master did not want me to close ... |
|
2280 |
masterApplication := sav. |
|
2281 |
] ifFalse:[ |
|
2282 |
"/ ST/X does close-check by redefining this message without |
|
2283 |
"/ a supersend; |
|
2284 |
"/ VW does it by returning false from requestForWindowClose |
|
2285 |
"/ sigh. |
|
2286 |
||
2287 |
self requestForWindowClose ifTrue:[ |
|
2288 |
self closeDownViews |
|
2289 |
] |
|
2290 |
]. |
|
2291 |
||
2292 |
"Modified: / 19.6.1998 / 01:37:17 / cg" |
|
2293 |
! |
|
2294 |
||
2295 |
closeRequestFor:aTopView |
|
2296 |
"this is sent by any of my topViews when about to be closed by the |
|
2297 |
windowmanager. For backward compatibility with single-view applications, |
|
2298 |
this is forwarded here to a simple (non topView-specific) closeRequest, |
|
2299 |
effectively closing all of my views. |
|
2300 |
MultiView applications should redefine this method if closing of individual |
|
2301 |
views closing is to be caught and/or should not close all of them." |
|
2302 |
||
2303 |
|sav| |
|
2304 |
||
2305 |
"/ In multiView apps, tell my master. |
|
2306 |
"/ (but not if I am a modal reincarnation) |
|
2307 |
(masterApplication notNil |
|
1523 | 2308 |
and:[self window topView isModal not]) ifTrue:[ |
1419 | 2309 |
|
2310 |
"/ temporary clear my masterApplication to prevent |
|
2311 |
"/ endless recursion, in case the master sends me |
|
2312 |
"/ a closeRequest (although, it is supposed to |
|
2313 |
"/ send me a closeDownViews ...) |
|
2314 |
||
2315 |
sav := masterApplication. |
|
2316 |
masterApplication := nil. |
|
2317 |
sav closeRequestFor:(self window). |
|
2318 |
||
2319 |
"/ restore - in case master did not want me to close ... |
|
2320 |
masterApplication := sav. |
|
2321 |
] ifFalse:[ |
|
2322 |
self closeRequest |
|
2323 |
] |
|
2324 |
! |
|
2325 |
||
2326 |
doAccept |
|
2327 |
"this is invoked by the Return-Key (if returnIsOK) or |
|
2328 |
the ok-button (if any), IFF the application has been |
|
2329 |
opened modal (i.e. as a dialog)." |
|
2330 |
||
2331 |
"/ the following is a bad kludge - |
|
2332 |
"/ actually, modal apps should inherit from SimpleDialog |
|
2333 |
"/ (then, things would be clean) |
|
2334 |
"/ However, it may be useful, to open some app (which is normally |
|
2335 |
"/ modeless) as a modal one as well. |
|
2336 |
"/ In that, case, we have no acceptHolder (see SimpleDialog), |
|
2337 |
"/ to remember the accept vs. cancel case. |
|
2338 |
"/ |
|
2339 |
self window isModal ifTrue:[ |
|
2340 |
"/ mhmh - is this a good idea ? |
|
2341 |
(self respondsTo:#accept) ifTrue:[ |
|
2342 |
self accept |
|
2343 |
] ifFalse:[ |
|
2344 |
self closeRequest. |
|
2345 |
]. |
|
2346 |
^ self |
|
2347 |
]. |
|
2348 |
||
2349 |
^ self "/ nothing done here ... |
|
2350 |
! |
|
2351 |
||
2352 |
doCancel |
|
2353 |
"this is invoked by the Escape-Key (if escapeIsCancel) or |
|
2354 |
the cancel-button (if any), IFF the application has been |
|
2355 |
opened modal (i.e. as a dialog)." |
|
2356 |
||
2357 |
"/ the following is a bad kludge - |
|
2358 |
"/ actually, modal apps should inherit from SimpleDialog |
|
2359 |
"/ (then, things would be clean) |
|
2360 |
"/ However, it may be useful, to open some app (which is normally |
|
2361 |
"/ modeless) as a modal one as well. |
|
2362 |
"/ In that, case, we have no acceptHolder (see SimpleDialog), |
|
2363 |
"/ to remember the accept vs. cancel case. |
|
1417 | 2364 |
"/ |
1419 | 2365 |
self window isModal ifTrue:[ |
2366 |
"/ mhmh - is this a good idea ? |
|
2367 |
(self respondsTo:#cancel) ifTrue:[ |
|
2368 |
self cancel |
|
2369 |
] ifFalse:[ |
|
2370 |
self closeRequest. |
|
2371 |
]. |
|
2372 |
^ self |
|
2373 |
]. |
|
2374 |
^ self "/ nothing done here ... |
|
2375 |
! |
|
2376 |
||
2377 |
releaseAsSubCanvas |
|
2378 |
"a subcanvas is closed or switching to a new application. |
|
2379 |
Can be redefined to perform a self release in this case." |
|
2380 |
||
2381 |
"/ used to self release here, |
|
2382 |
"/ but that is incompatible to VW (RefactoryBrowser). |
|
2383 |
"/ Therefore, if you need it, you MUST now redefine |
|
2384 |
"/ this method. |
|
2385 |
! |
|
2386 |
||
2387 |
restarted |
|
2388 |
"sent by my topWindow, when restarted from an image. |
|
2389 |
Nothing done here, but can be redefined to perform any actions |
|
2390 |
required to reset the application after an image-restart. |
|
2391 |
(for example: check if application files are still around, restart |
|
2392 |
subprocesses etc.)." |
|
2393 |
||
2394 |
"Modified: 1.6.1996 / 16:55:50 / cg" |
|
2395 |
! |
|
2396 |
||
2397 |
saveAndTerminateRequest |
|
2398 |
"some windowManagers send this to shut down an application |
|
2399 |
and have it save its state for restart. |
|
2400 |
Can be redefined in subclasses" |
|
2401 |
||
2402 |
self closeRequest |
|
2403 |
! |
|
2404 |
||
2405 |
saveAndTerminateRequestFor:aTopView |
|
2406 |
"some windowManagers send this to shut down an application |
|
2407 |
and have it save its state for restart. |
|
2408 |
Can be redefined in subclasses" |
|
2409 |
||
2410 |
self saveAndTerminateRequest |
|
2411 |
! |
|
2412 |
||
2413 |
windowClass |
|
2414 |
"return the type of topWindow I would like to have created. |
|
2415 |
Can be redefined in subclasses to allow for specialized |
|
2416 |
subclass of ApplicationWindow to be returned here." |
|
2417 |
||
2418 |
^ ApplicationWindow |
|
2419 |
! ! |
|
2420 |
||
2421 |
!ApplicationModel methodsFor:'window events'! |
|
2422 |
||
2423 |
dispatchEvent:event |
|
2424 |
"dispatch a user-pushed event. |
|
2425 |
This allows for events for an appModel to be pushed into the event queue |
|
2426 |
the same way as events for a view are pushable." |
|
2427 |
||
2428 |
^ self |
|
2429 |
dispatchEvent:event |
|
2430 |
withFocusOn:nil |
|
2431 |
delegate:true |
|
2432 |
||
2433 |
! |
|
2434 |
||
2435 |
dispatchEvent:evType arguments:evArgs withFocusOn:focusView delegate:doDelegate |
|
2436 |
"dispatch a user-pushed event. |
|
2437 |
This allows for events for an appModel to be pushed into the event queue |
|
2438 |
the same way as events for a view are pushable." |
|
2439 |
||
2440 |
self perform:evType withArguments:evArgs |
|
2441 |
||
2442 |
"Created: / 20.6.1998 / 16:36:54 / cg" |
|
2443 |
"Modified: / 20.6.1998 / 16:44:05 / cg" |
|
1290 | 2444 |
! |
2445 |
||
1419 | 2446 |
dispatchEvent:ev type:evType arguments:evArgs withFocusOn:focusView delegate:doDelegate |
2447 |
"dispatch a user-pushed event. |
|
2448 |
This allows for events for an appModel to be pushed into the event queue |
|
2449 |
the same way as events for a view are pushable." |
|
2450 |
||
2451 |
self perform:evType withArguments:evArgs |
|
2452 |
||
2453 |
"Created: / 20.6.1998 / 16:36:54 / cg" |
|
2454 |
"Modified: / 20.6.1998 / 16:44:05 / cg" |
|
2455 |
! |
|
2456 |
||
2457 |
dispatchEvent:event withFocusOn:focusViewOrNil |
|
2458 |
"dispatch a user-pushed event. |
|
2459 |
This allows for events for an appModel to be pushed into the event queue |
|
2460 |
the same way as events for a view are pushable." |
|
2461 |
||
2462 |
^ self |
|
2463 |
dispatchEvent:event |
|
2464 |
withFocusOn:focusViewOrNil |
|
2465 |
delegate:true |
|
2466 |
||
2467 |
||
2468 |
! |
|
2469 |
||
2470 |
dispatchEvent:event withFocusOn:focusViewOrNil delegate:doDelegate |
|
2471 |
"dispatch a user-pushed event. |
|
2472 |
This allows for events for an appModel to be pushed into the event queue |
|
2473 |
the same way as events for a view are pushable." |
|
2474 |
||
2475 |
^ self |
|
2476 |
dispatchEvent:event |
|
2477 |
type:event type |
|
2478 |
arguments:(event arguments) |
|
2479 |
withFocusOn:focusViewOrNil |
|
2480 |
delegate:doDelegate |
|
2481 |
||
2482 |
||
2483 |
! |
|
2484 |
||
2485 |
noticeOfWindowClose:aWindow |
|
1432
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2486 |
"sent when a topView or applicationSubView has been closed. |
1419 | 2487 |
Can be redefined in subclasses for cleanup." |
2488 |
||
1432
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2489 |
"/ ST-80 compatibility |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2490 |
self windowEvent:(#close -> aWindow) from:aWindow. |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2491 |
^ self |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2492 |
|
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2493 |
"Created: / 18.6.1998 / 18:56:31 / cg" |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2494 |
"Modified: / 18.6.1998 / 19:14:16 / cg" |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2495 |
! |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2496 |
|
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2497 |
noticeOfWindowOpen:aWindow |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2498 |
"sent when a topView or applicationSubView has been opened. |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2499 |
Can be redefined in subclasses." |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2500 |
|
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2501 |
"/ ST-80 compatibility |
6dc94e38fa8e
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
1431
diff
changeset
|
2502 |
self windowEvent:(#open -> aWindow) from:aWindow. |
1419 | 2503 |
^ self |
2504 |
||
2505 |
"Created: / 18.6.1998 / 18:56:31 / cg" |
|
2506 |
"Modified: / 18.6.1998 / 19:14:16 / cg" |
|
2507 |
! |
|
2508 |
||
2509 |
requestForWindowClose |
|
2510 |
"the applicationWindow wants to know, if a close |
|
2511 |
is ok. Return false if not." |
|
2512 |
||
2513 |
|w k| |
|
2514 |
||
2515 |
builder notNil ifTrue:[ |
|
2516 |
(w := builder window) notNil ifTrue:[ |
|
2517 |
(k := w keyboardProcessor) notNil ifTrue:[ |
|
2518 |
^ k requestForWindowClose |
|
2519 |
] |
|
2520 |
] |
|
2521 |
]. |
|
2522 |
^ true |
|
2523 |
||
2524 |
"Modified: / 18.6.1998 / 19:14:16 / cg" |
|
2525 |
"Created: / 19.6.1998 / 01:34:58 / cg" |
|
2526 |
! |
|
2527 |
||
2528 |
showActivity:someMessage |
|
2529 |
"some activityNotification shalt be communicated to |
|
2530 |
the user. Forwarded from the topView and ignored here. |
|
2531 |
Can be redefined in concrete applications to show the |
|
2532 |
message either in some infoView (infoLabel as in Windows) |
|
2533 |
or in the title area (as done in the browsers)" |
|
2534 |
||
2535 |
^ self |
|
2536 |
||
2537 |
"Created: 16.12.1995 / 18:41:04 / cg" |
|
2538 |
"Modified: 24.4.1996 / 09:34:22 / cg" |
|
2539 |
! |
|
2540 |
||
2541 |
windowEvent:anEvent from:anApplicationWindow |
|
2542 |
"dummy: windowEvent forwarding is not yet implemented" |
|
2543 |
||
2544 |
^ self |
|
2545 |
||
2546 |
"Modified: 24.4.1996 / 09:32:50 / cg" |
|
2547 |
! ! |
|
2548 |
||
2549 |
!ApplicationModel class methodsFor:'documentation'! |
|
2550 |
||
1417 | 2551 |
version |
1528 | 2552 |
^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.162 2001-11-15 10:31:42 penk Exp $' |
85 | 2553 |
! ! |
1419 | 2554 |
ApplicationModel initialize! |