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