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