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