author | Claus Gittinger <cg@exept.de> |
Sat, 26 Oct 1996 19:17:33 +0200 | |
changeset 346 | 1612c23d9c5d |
parent 330 | d7ce98930ad3 |
child 361 | 765fe20a26d1 |
permissions | -rw-r--r-- |
50 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
330
d7ce98930ad3
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
313
diff
changeset
|
13 |
'From Smalltalk/X, Version:2.10.9 on 9-sep-1996 at 22:51:41' ! |
d7ce98930ad3
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
313
diff
changeset
|
14 |
|
50 | 15 |
Model subclass:#ApplicationModel |
310 | 16 |
instanceVariableNames:'builder resources device' |
142
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
17 |
classVariableNames:'' |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
18 |
poolDictionaries:'' |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
19 |
category:'Interface-Framework' |
50 | 20 |
! |
21 |
||
138 | 22 |
ApplicationModel class instanceVariableNames:'ClassResources' |
23 |
||
24 |
" |
|
25 |
The following class instance variables are inherited by this class: |
|
26 |
||
27 |
Model - |
|
28 |
Object - |
|
29 |
" |
|
30 |
! |
|
52 | 31 |
|
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
32 |
!ApplicationModel class methodsFor:'documentation'! |
50 | 33 |
|
34 |
copyright |
|
35 |
" |
|
36 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
37 |
All Rights Reserved |
|
38 |
||
39 |
This software is furnished under a license and may be used |
|
40 |
only in accordance with the terms of that license and with the |
|
41 |
inclusion of the above copyright notice. This software may not |
|
42 |
be provided or otherwise made available to, or used by, any |
|
43 |
other person. No title to or ownership of the software is |
|
44 |
hereby transferred. |
|
45 |
" |
|
46 |
! |
|
47 |
||
48 |
documentation |
|
49 |
" |
|
50 |
Since many ST-80 classes are subclasses of ApplicationModel, this class |
|
51 |
is provided here to allow easier porting of ST-80 code. |
|
57 | 52 |
|
63 | 53 |
It does not (currently) provide much functionality and is NOT |
54 |
compatible to the corresponding ST80 class; therefore, manual |
|
50 | 55 |
changes have to be made to get those applications to run under ST/X. |
57 | 56 |
(but at least, this enables you to fileIn that code and have a superclass |
78 | 57 |
for them) |
58 |
||
59 |
As time goes by, ST/X applications are going to be converted to |
|
330
d7ce98930ad3
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
313
diff
changeset
|
60 |
become subclasses of this abstract class - see Launcher for a |
78 | 61 |
first concrete example. |
62 |
||
215 | 63 |
|
78 | 64 |
ApplicationModel is prepared to build a view from a windowSpec, as |
215 | 65 |
created by the windowBuilder. If your subclass does not provide such |
78 | 66 |
a spec, you should at least redefine: |
67 |
||
215 | 68 |
#openInterface - to create a topview and open it |
78 | 69 |
|
70 |
you may want to redefine: |
|
71 |
||
215 | 72 |
#closeRequest - to catch window closing |
73 |
#focusSequence - to define a sequence for focus-stepping |
|
78 | 74 |
|
50 | 75 |
|
215 | 76 |
Once the interfaceBuilder is finished & released, subclasses can |
77 |
alternatively provide the spec via a #windowSpec method. |
|
78 |
||
52 | 79 |
The classResources have been put into this class to allow ST/X |
57 | 80 |
applications (which used to be subclasses of StandardSystemView) |
81 |
to migrate smoothly into ApplicationModels (which is better design ...). |
|
52 | 82 |
|
83 |
||
215 | 84 |
[Instance variables:] |
85 |
resources ResourcePack language string translation |
|
86 |
||
87 |
builder WindowBuilder a builder who knows how to create |
|
88 |
a window hierarchy from a specification |
|
78 | 89 |
|
90 |
||
91 |
Notice: this class was implemented using protocol information |
|
92 |
from alpha testers and PD code - it may not be complete or compatible to |
|
93 |
the corresponding ST-80 class. If you encounter any incompatibilities, |
|
94 |
please forward a note to the ST/X team. |
|
215 | 95 |
|
96 |
||
221 | 97 |
[author:] |
98 |
Claus Gittinger |
|
99 |
||
215 | 100 |
[see also:] |
101 |
StandardSystemView |
|
102 |
WindowGroup DeviceWorkstation |
|
50 | 103 |
" |
104 |
! ! |
|
105 |
||
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
106 |
!ApplicationModel class methodsFor:'initialization'! |
52 | 107 |
|
108 |
initialize |
|
109 |
self == ApplicationModel ifTrue:[ |
|
110 |
Smalltalk addDependent:self |
|
111 |
] |
|
112 |
||
113 |
" |
|
114 |
ApplicationModel initialize |
|
115 |
" |
|
116 |
! ! |
|
117 |
||
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
118 |
!ApplicationModel class methodsFor:'instance creation'! |
52 | 119 |
|
120 |
new |
|
215 | 121 |
"return a new initialized instance" |
122 |
||
63 | 123 |
^ super new basicInitialize initialize |
215 | 124 |
|
125 |
"Modified: 24.4.1996 / 09:42:14 / cg" |
|
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
126 |
! |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
127 |
|
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
128 |
onDevice:aDevice |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
129 |
"return a new initialized instance, which shall open its interface |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
130 |
on aDevice." |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
131 |
|
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
132 |
^ (super new basicInitialize |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
133 |
setDevice:aDevice) initialize |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
134 |
|
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
135 |
"Modified: 24.4.1996 / 09:42:14 / cg" |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
136 |
"Created: 5.7.1996 / 12:19:15 / cg" |
52 | 137 |
! ! |
138 |
||
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
139 |
!ApplicationModel class methodsFor:'change & update'! |
52 | 140 |
|
302 | 141 |
update:something with:aParameter from:changedObject |
69 | 142 |
"flush resources on language changes" |
143 |
||
52 | 144 |
something == #Language ifTrue:[ |
302 | 145 |
"flush resources on language changes" |
146 |
self flushAllClassResources |
|
52 | 147 |
] |
302 | 148 |
|
149 |
"Created: 15.6.1996 / 15:13:29 / cg" |
|
52 | 150 |
! ! |
151 |
||
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
152 |
!ApplicationModel class methodsFor:'queries'! |
63 | 153 |
|
154 |
interfaceSpecFor:aSelector |
|
69 | 155 |
"return an interface spec" |
156 |
||
63 | 157 |
^ self perform:aSelector |
158 |
! ! |
|
159 |
||
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
160 |
!ApplicationModel class methodsFor:'resources'! |
52 | 161 |
|
162 |
classResources |
|
163 |
"if not already loaded, get the classes resourcePack |
|
164 |
and return it" |
|
165 |
||
166 |
ClassResources isNil ifTrue:[ |
|
167 |
ClassResources := ResourcePack for:self. |
|
168 |
]. |
|
169 |
^ ClassResources |
|
170 |
! |
|
171 |
||
172 |
classResources:aResourcePack |
|
173 |
"allow setting of the classResources" |
|
174 |
||
175 |
ClassResources := aResourcePack |
|
176 |
! |
|
177 |
||
178 |
flushAllClassResources |
|
179 |
"flush all classes resource translations. |
|
180 |
Needed after a resource file / language setting has changed." |
|
181 |
||
182 |
ResourcePack flushCachedResourcePacks. |
|
183 |
self flushClassResources. |
|
184 |
self allSubclassesDo:[:aClass | |
|
185 |
aClass flushClassResources. |
|
186 |
] |
|
187 |
! |
|
188 |
||
189 |
flushClassResources |
|
190 |
"flush classes resource string translations. |
|
191 |
Needed whenever a resource file / language setting has changed" |
|
192 |
||
193 |
ClassResources := nil. |
|
63 | 194 |
! |
195 |
||
196 |
updateClassResources |
|
197 |
"update my classResources" |
|
198 |
||
199 |
ClassResources := nil. |
|
200 |
self classResources |
|
52 | 201 |
! ! |
202 |
||
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
203 |
!ApplicationModel class methodsFor:'startup'! |
138 | 204 |
|
205 |
open |
|
206 |
"create an instance of the application and open its view" |
|
207 |
||
240 | 208 |
^ self new open |
138 | 209 |
|
210 |
" |
|
211 |
self open |
|
212 |
" |
|
240 | 213 |
|
214 |
"Modified: 3.5.1996 / 13:39:21 / cg" |
|
138 | 215 |
! |
216 |
||
217 |
openInterface:anInterfaceSymbol |
|
218 |
"create an instance of the application and open a view as |
|
219 |
specified by anInterfaceSymbol." |
|
220 |
||
221 |
self new openInterface:anInterfaceSymbol |
|
222 |
||
223 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
|
224 |
! |
|
225 |
||
226 |
openOn:anApplicationModel |
|
215 | 227 |
"send an open message to the argument, anApplicationModel. |
228 |
I dont really understand what this method is useful for ..." |
|
138 | 229 |
|
230 |
anApplicationModel open |
|
215 | 231 |
|
232 |
"Modified: 24.4.1996 / 09:43:04 / cg" |
|
138 | 233 |
! |
234 |
||
235 |
openOnDevice:aDevice |
|
236 |
"create an instance of the application and open its view |
|
215 | 237 |
on ANOTHER device. |
238 |
For more info, read the document on multiple display |
|
239 |
support and the documentation of the DeviceWorkstation class." |
|
138 | 240 |
|
241 |
self new openOnDevice:aDevice |
|
215 | 242 |
|
243 |
"Modified: 24.4.1996 / 09:44:19 / cg" |
|
138 | 244 |
! ! |
245 |
||
246 |
!ApplicationModel methodsFor:'accessing'! |
|
247 |
||
248 |
builder |
|
249 |
"return the applications builder; this one has more information |
|
250 |
about views, components etc." |
|
251 |
||
252 |
^ builder |
|
253 |
! |
|
254 |
||
255 |
builder:aBuilder |
|
256 |
"set the applications builder. Normally, you should not set it |
|
257 |
directly, but depend on the default builder, as created when the application |
|
258 |
was created." |
|
259 |
||
260 |
builder := aBuilder |
|
261 |
! |
|
262 |
||
263 |
focusSequence |
|
264 |
"return a focusSequence for stepping through the applications views. |
|
265 |
The builder usually keeps track of so-called 'tabable' views. |
|
266 |
Stepping is done with the FocusNext/FocusPrevius keys, which are |
|
267 |
typically bound to Meta-CursorUp/Meta-CursorDown. |
|
268 |
Subclasses which do not use the builder (but instead build their view |
|
269 |
programmatically) should redefine this method to return a collection of |
|
270 |
views which defines the sequence." |
|
271 |
||
272 |
builder notNil ifTrue:[ |
|
273 |
^ builder focusSequence |
|
274 |
]. |
|
275 |
^ nil |
|
276 |
! |
|
277 |
||
278 |
resources |
|
279 |
"return the applications resources - thats a ResourcePack containing |
|
280 |
language strings" |
|
281 |
||
282 |
^ resources |
|
283 |
! |
|
284 |
||
285 |
window |
|
286 |
"return my topWindow" |
|
287 |
||
288 |
^ builder window |
|
289 |
! |
|
290 |
||
187 | 291 |
window:aTopView |
292 |
"set my topWindow" |
|
293 |
||
294 |
builder window:aTopView |
|
295 |
||
296 |
"Created: 18.4.1996 / 14:55:26 / cg" |
|
297 |
! |
|
298 |
||
138 | 299 |
windowGroup |
300 |
"return the applications windowGroup" |
|
301 |
||
302 |
^ builder window windowGroup |
|
303 |
! ! |
|
304 |
||
52 | 305 |
!ApplicationModel methodsFor:'initialization'! |
306 |
||
138 | 307 |
addTopViewsToCurrentProject |
308 |
"add all of my topViews to the current projects list of views. |
|
309 |
This allows hiding views on a per-project basis." |
|
85 | 310 |
|
138 | 311 |
self windowGroup topViews do:[:aView | |
312 |
aView addToCurrentProject |
|
313 |
] |
|
85 | 314 |
! |
315 |
||
63 | 316 |
basicInitialize |
69 | 317 |
"initialize the application. |
318 |
Since ST-80 applications seem commonly to redefine initialize |
|
319 |
without doing a super initialize, the real initialization is |
|
320 |
done here ..." |
|
321 |
||
52 | 322 |
super initialize. |
72 | 323 |
|
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
324 |
device := Screen current. |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
325 |
|
72 | 326 |
"claus: I wanted to delay the creation & assignment of the |
327 |
builder till later, to allow setting to another builder. |
|
328 |
however, some ST-80 code accesses the builder right after instance |
|
329 |
creation ..." |
|
330 |
||
331 |
"/ " |
|
332 |
"/ Create a windowBuilder to have someone around which |
|
333 |
"/ understands the builder protocol. Since UIBuilder is not present |
|
334 |
"/ in all systems, this allows operation without one (unless a spec |
|
335 |
"/ is read later ...) |
|
336 |
"/ " |
|
85 | 337 |
builder := self createBuilder. |
78 | 338 |
builder notNil ifTrue:[builder application:self]. |
52 | 339 |
resources := self class classResources. |
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
340 |
|
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
341 |
"Modified: 5.7.1996 / 12:02:37 / cg" |
63 | 342 |
! |
343 |
||
138 | 344 |
createBuilder |
345 |
"create a UI Builder for me. |
|
346 |
This method can be redefined if (eventually) there are |
|
347 |
spec readers for other UI languages (motif UIL ?)" |
|
348 |
||
349 |
|cls| |
|
350 |
||
351 |
(cls := UIBuilder) isNil ifTrue:[ |
|
352 |
(cls := WindowBuilder) isNil ifTrue:[ |
|
353 |
^ nil |
|
354 |
] |
|
355 |
]. |
|
356 |
^ cls new |
|
357 |
! |
|
358 |
||
63 | 359 |
initialize |
83 | 360 |
"nothing done here; |
361 |
but can be redefined in concrete applications" |
|
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
362 |
! |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
363 |
|
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
364 |
setDevice:aDevice |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
365 |
"set the device (i.e. some Screen), where the application |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
366 |
shall open its view(s). |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
367 |
The default device is the current screen." |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
368 |
|
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
369 |
device := aDevice |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
370 |
|
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
371 |
"Created: 5.7.1996 / 12:01:40 / cg" |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
372 |
"Modified: 5.7.1996 / 12:01:53 / cg" |
138 | 373 |
! ! |
374 |
||
375 |
!ApplicationModel methodsFor:'misc'! |
|
376 |
||
287 | 377 |
restoreCursors |
378 |
"restore the original cursors in all of my views" |
|
379 |
||
380 |
^ self window windowGroup restoreCursors |
|
381 |
||
382 |
"Created: 1.6.1996 / 17:01:24 / cg" |
|
383 |
! |
|
384 |
||
385 |
showCursor:aCursor |
|
386 |
"set all of my views cursor to aCursor. |
|
387 |
It can be restored with #restoreCursor." |
|
388 |
||
389 |
^ self window windowGroup showCursor:aCursor |
|
390 |
||
391 |
"Created: 1.6.1996 / 17:01:09 / cg" |
|
392 |
! |
|
393 |
||
138 | 394 |
withCursor:aCursor do:aBlock |
395 |
"evaluate aBlock, showing aCursor in my topView and all of its subviews. |
|
396 |
Return the value of aBlock." |
|
397 |
||
398 |
^ self window withCursor:aCursor do:aBlock |
|
63 | 399 |
! |
400 |
||
142
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
401 |
withExecuteCursorDo:aBlock |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
402 |
"evaluate aBlock, showing an executeCursor in my topView and all of its subviews. |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
403 |
Return the value of aBlock." |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
404 |
|
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
405 |
^ self withCursor:(Cursor execute) do:aBlock |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
406 |
|
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
407 |
"Created: 14.12.1995 / 20:57:03 / cg" |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
408 |
! |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
409 |
|
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
410 |
withReadCursorDo:aBlock |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
411 |
"evaluate aBlock, showing a readCursor in my topView and all of its subviews. |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
412 |
Return the value of aBlock." |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
413 |
|
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
414 |
^ self withCursor:(Cursor read) do:aBlock |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
415 |
|
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
416 |
"Created: 14.12.1995 / 20:56:47 / cg" |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
417 |
"Modified: 14.12.1995 / 20:57:36 / cg" |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
418 |
! |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
419 |
|
138 | 420 |
withWaitCursorDo:aBlock |
421 |
"evaluate aBlock, showing a waitCursor in my topView and all of its subviews. |
|
422 |
Return the value of aBlock." |
|
63 | 423 |
|
138 | 424 |
^ self withCursor:Cursor wait do:aBlock |
52 | 425 |
! ! |
57 | 426 |
|
71 | 427 |
!ApplicationModel methodsFor:'queries'! |
428 |
||
313
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
429 |
graphicsDevice |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
430 |
"return the device I want to open my views on. |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
431 |
The default (if not created with #onDevice:) is the currently |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
432 |
active screen." |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
433 |
|
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
434 |
^ device |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
435 |
|
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
436 |
"Created: 5.7.1996 / 17:51:31 / cg" |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
437 |
! |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
438 |
|
71 | 439 |
processName |
440 |
"return a name to be shown for me in the process monitor" |
|
441 |
||
442 |
^ 'Application' |
|
443 |
! ! |
|
444 |
||
57 | 445 |
!ApplicationModel methodsFor:'startup'! |
446 |
||
63 | 447 |
allButOpenFrom:aSpec |
69 | 448 |
"create my views but do not open the main window" |
449 |
||
71 | 450 |
|realBuilder| |
451 |
||
72 | 452 |
"/ DISABLED; see comment in basicInitialize |
453 |
"/ |
|
454 |
"/ " |
|
455 |
"/ here, we kludge a bit: up to now, the builder was an |
|
456 |
"/ instance of the no-op WindowBuilder. Now, it becomes |
|
457 |
"/ a UIBuilder .... |
|
458 |
"/ This allows for ApplicationModels without a UIBuilder |
|
459 |
"/ if not needed. |
|
460 |
"/ " |
|
461 |
"/ realBuilder := UIBuilder new. |
|
462 |
"/ builder := realBuilder. |
|
463 |
"/ builder application:self. |
|
464 |
"/ builder bindings:builder bindings. |
|
71 | 465 |
|
63 | 466 |
self preBuildWith:builder. |
467 |
builder buildFromSpec:aSpec. |
|
85 | 468 |
builder window model:self. |
469 |
builder window application:self. |
|
63 | 470 |
self postBuildWith:builder. |
471 |
! |
|
57 | 472 |
|
138 | 473 |
allButOpenInterface:aSymbol |
474 |
"create my views but do not open the main window" |
|
475 |
||
476 |
|spec| |
|
477 |
||
478 |
spec := self class interfaceSpecFor:aSymbol. |
|
479 |
self allButOpenFrom:spec. |
|
480 |
^ builder |
|
481 |
! |
|
482 |
||
483 |
close |
|
484 |
"this is sent by my topView when about to be closed |
|
485 |
by the program (not by the windowManager). |
|
486 |
Could be redefined in subclasses." |
|
487 |
||
488 |
self closeDownViews |
|
489 |
! |
|
490 |
||
491 |
closeDownViews |
|
492 |
"close down the applications view" |
|
493 |
||
494 |
|wg views| |
|
495 |
||
496 |
(wg := self windowGroup) notNil ifTrue:[ |
|
497 |
views := wg topViews. |
|
498 |
views notNil ifTrue:[ |
|
499 |
views copy do:[:aView | |
|
500 |
aView notNil ifTrue:[aView destroy] |
|
501 |
] |
|
502 |
] |
|
503 |
] |
|
504 |
! |
|
505 |
||
506 |
closeRequest |
|
507 |
"this is sent by my topView when about to be closed by the |
|
508 |
windowmanager. Can be redefined to inform & query about unsafed |
|
509 |
view contents, to send #close on ok, or ignore the closeRequest." |
|
510 |
||
511 |
self closeDownViews |
|
512 |
! |
|
513 |
||
514 |
menuFor:aSymbol |
|
515 |
"create a new menuBuilder, to read specs and |
|
516 |
create a menu from it. Return this menu" |
|
517 |
||
518 |
|spec mbuilder| |
|
519 |
||
520 |
spec := self class interfaceSpecFor:aSymbol. |
|
521 |
mbuilder := UIBuilder new. |
|
522 |
mbuilder buildFromSpec:spec. |
|
523 |
||
524 |
builder componentAt:#windowMenuHolder put:(mbuilder window asValue). |
|
525 |
^ mbuilder window |
|
526 |
! |
|
527 |
||
69 | 528 |
open |
529 |
"open a standard interface" |
|
530 |
||
240 | 531 |
^ self openInterface |
532 |
||
533 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
69 | 534 |
! |
535 |
||
63 | 536 |
openInterface |
78 | 537 |
"open a standard interface on another device. |
215 | 538 |
|
78 | 539 |
Subclasses which do not have an interfaceSpec |
215 | 540 |
should redefine this method and create & open their view(s) there. |
330
d7ce98930ad3
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
313
diff
changeset
|
541 |
(see Launcher as an example)." |
69 | 542 |
|
63 | 543 |
self openInterface:#windowSpec |
215 | 544 |
|
545 |
"Modified: 24.4.1996 / 09:35:43 / cg" |
|
330
d7ce98930ad3
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
313
diff
changeset
|
546 |
"Modified: 9.9.1996 / 22:39:23 / stefan" |
57 | 547 |
! |
548 |
||
63 | 549 |
openInterface:aSymbol |
215 | 550 |
"open a specific interface. |
551 |
The argument, aSymbol specifies which interface. The concrete |
|
552 |
application subclass must provide a method with that name, |
|
553 |
which must return an interfaceSpec. This is forwarded to |
|
554 |
the builder to create the views. |
|
69 | 555 |
Typically, applications only use one interface, |
78 | 556 |
returned by the #windowSpec method." |
69 | 557 |
|
85 | 558 |
self allButOpenInterface:aSymbol. |
78 | 559 |
builder openWithExtent:nil. |
560 |
||
63 | 561 |
^ builder |
215 | 562 |
|
563 |
"Modified: 24.4.1996 / 09:37:11 / cg" |
|
63 | 564 |
! |
565 |
||
566 |
opened |
|
215 | 567 |
"the topView has been opened. |
568 |
This is sent by my topView when its finally open" |
|
63 | 569 |
|
570 |
self addTopViewsToCurrentProject. |
|
571 |
self postOpenWith:builder |
|
215 | 572 |
|
573 |
"Modified: 24.4.1996 / 09:37:28 / cg" |
|
57 | 574 |
! |
575 |
||
138 | 576 |
postBuildWith:aBuilder |
577 |
"this is sent after an interface is built from a spec. |
|
578 |
Can be redefined in subclasses. |
|
579 |
mhmh - what should this do here ?" |
|
580 |
! |
|
581 |
||
582 |
postOpenWith:aBuilder |
|
583 |
"this is sent after the applications main window is opened. |
|
584 |
Can be redefined in subclasses. |
|
585 |
mhmh - what should this do here ?" |
|
586 |
! |
|
587 |
||
588 |
preBuildWith:aBuilder |
|
589 |
"this is sent before an interface is built from a spec. |
|
590 |
Can be redefined in subclasses. |
|
591 |
mhmh - what should this do here ?" |
|
592 |
! |
|
593 |
||
69 | 594 |
restarted |
287 | 595 |
"sent by my topWindow, when restarted from an image. |
69 | 596 |
Nothing done here, but can be redefined to perform any actions |
597 |
required to reset the application after an image-restart. |
|
598 |
(for example: check if application files are still around, restart |
|
287 | 599 |
subprocesses etc.)." |
600 |
||
601 |
"Modified: 1.6.1996 / 16:55:50 / cg" |
|
63 | 602 |
! |
57 | 603 |
|
63 | 604 |
saveAndTerminateRequest |
605 |
"some windowManagers send this to shut down an application |
|
606 |
and have it save its state for restart. |
|
607 |
Can be redefined in subclasses" |
|
608 |
||
609 |
self closeRequest |
|
57 | 610 |
! ! |
72 | 611 |
|
85 | 612 |
!ApplicationModel methodsFor:'window events'! |
613 |
||
144 | 614 |
showActivity:someMessage |
215 | 615 |
"some activityNotification shalt be communicated to |
616 |
the user. Forwarded from the topView and ignored here. |
|
617 |
Can be redefined in concrete applications to show the |
|
618 |
message either in some infoView (infoLabel as in Windows) |
|
619 |
or in the title area (as done in the browsers)" |
|
620 |
||
144 | 621 |
^ self |
622 |
||
623 |
"Created: 16.12.1995 / 18:41:04 / cg" |
|
215 | 624 |
"Modified: 24.4.1996 / 09:34:22 / cg" |
144 | 625 |
! |
626 |
||
85 | 627 |
windowEvent:anEvent from:anApplicationWindow |
215 | 628 |
"dummy: windowEvent forwarding is not yet implemented" |
629 |
||
85 | 630 |
^ self |
215 | 631 |
|
632 |
"Modified: 24.4.1996 / 09:32:50 / cg" |
|
85 | 633 |
! ! |
634 |
||
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
635 |
!ApplicationModel class methodsFor:'documentation'! |
72 | 636 |
|
138 | 637 |
version |
330
d7ce98930ad3
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
313
diff
changeset
|
638 |
^ '$Header: /cvs/stx/stx/libview2/Attic/AppModel.st,v 1.30 1996-09-09 22:58:38 stefan Exp $' |
81 | 639 |
! ! |
138 | 640 |
ApplicationModel initialize! |