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