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