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