author | Claus Gittinger <cg@exept.de> |
Tue, 14 Jan 1997 18:02:37 +0100 | |
changeset 365 | 47e0d48fd769 |
parent 362 | 52212e2a8c84 |
child 371 | ce94ec6a38ee |
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 |
|
361 | 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 |
|
330
d7ce98930ad3
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
313
diff
changeset
|
58 |
become subclasses of this abstract class - see Launcher for a |
78 | 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 |
||
361 | 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 |
||
361 | 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 |
||
361 | 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 |
||
361 | 150 |
!ApplicationModel class methodsFor:'queries'! |
63 | 151 |
|
152 |
interfaceSpecFor:aSelector |
|
69 | 153 |
"return an interface spec" |
154 |
||
63 | 155 |
^ self perform:aSelector |
156 |
! ! |
|
157 |
||
361 | 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 |
||
361 | 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 |
" |
|
361 | 209 |
Launcher open |
138 | 210 |
" |
240 | 211 |
|
361 | 212 |
"Modified: 13.1.1997 / 20:54:50 / cg" |
138 | 213 |
! |
214 |
||
215 |
openInterface:anInterfaceSymbol |
|
216 |
"create an instance of the application and open a view as |
|
217 |
specified by anInterfaceSymbol." |
|
218 |
||
361 | 219 |
^ self new openInterface:anInterfaceSymbol |
138 | 220 |
|
221 |
"Modified: 5.9.1995 / 17:54:50 / claus" |
|
361 | 222 |
"Modified: 13.1.1997 / 20:55:02 / cg" |
138 | 223 |
! |
224 |
||
225 |
openOn:anApplicationModel |
|
215 | 226 |
"send an open message to the argument, anApplicationModel. |
227 |
I dont really understand what this method is useful for ..." |
|
138 | 228 |
|
361 | 229 |
^ anApplicationModel open |
215 | 230 |
|
361 | 231 |
"Modified: 13.1.1997 / 20:55:05 / cg" |
138 | 232 |
! |
233 |
||
234 |
openOnDevice:aDevice |
|
235 |
"create an instance of the application and open its view |
|
215 | 236 |
on ANOTHER device. |
237 |
For more info, read the document on multiple display |
|
238 |
support and the documentation of the DeviceWorkstation class." |
|
138 | 239 |
|
361 | 240 |
^ (self onDevice:aDevice) open |
215 | 241 |
|
361 | 242 |
" |
243 |
Launcher openOnDevice:Display |
|
244 |
" |
|
245 |
||
246 |
"Modified: 13.1.1997 / 20:55:27 / cg" |
|
138 | 247 |
! ! |
248 |
||
249 |
!ApplicationModel methodsFor:'accessing'! |
|
250 |
||
251 |
builder |
|
252 |
"return the applications builder; this one has more information |
|
253 |
about views, components etc." |
|
254 |
||
255 |
^ builder |
|
256 |
! |
|
257 |
||
258 |
builder:aBuilder |
|
259 |
"set the applications builder. Normally, you should not set it |
|
260 |
directly, but depend on the default builder, as created when the application |
|
261 |
was created." |
|
262 |
||
263 |
builder := aBuilder |
|
264 |
! |
|
265 |
||
266 |
focusSequence |
|
267 |
"return a focusSequence for stepping through the applications views. |
|
268 |
The builder usually keeps track of so-called 'tabable' views. |
|
269 |
Stepping is done with the FocusNext/FocusPrevius keys, which are |
|
270 |
typically bound to Meta-CursorUp/Meta-CursorDown. |
|
271 |
Subclasses which do not use the builder (but instead build their view |
|
272 |
programmatically) should redefine this method to return a collection of |
|
273 |
views which defines the sequence." |
|
274 |
||
275 |
builder notNil ifTrue:[ |
|
276 |
^ builder focusSequence |
|
277 |
]. |
|
278 |
^ nil |
|
279 |
! |
|
280 |
||
281 |
resources |
|
282 |
"return the applications resources - thats a ResourcePack containing |
|
283 |
language strings" |
|
284 |
||
285 |
^ resources |
|
286 |
! |
|
287 |
||
288 |
window |
|
289 |
"return my topWindow" |
|
290 |
||
291 |
^ builder window |
|
292 |
! |
|
293 |
||
187 | 294 |
window:aTopView |
295 |
"set my topWindow" |
|
296 |
||
297 |
builder window:aTopView |
|
298 |
||
299 |
"Created: 18.4.1996 / 14:55:26 / cg" |
|
300 |
! |
|
301 |
||
138 | 302 |
windowGroup |
303 |
"return the applications windowGroup" |
|
304 |
||
305 |
^ builder window windowGroup |
|
306 |
! ! |
|
307 |
||
52 | 308 |
!ApplicationModel methodsFor:'initialization'! |
309 |
||
138 | 310 |
addTopViewsToCurrentProject |
311 |
"add all of my topViews to the current projects list of views. |
|
312 |
This allows hiding views on a per-project basis." |
|
85 | 313 |
|
138 | 314 |
self windowGroup topViews do:[:aView | |
315 |
aView addToCurrentProject |
|
316 |
] |
|
85 | 317 |
! |
318 |
||
63 | 319 |
basicInitialize |
69 | 320 |
"initialize the application. |
321 |
Since ST-80 applications seem commonly to redefine initialize |
|
322 |
without doing a super initialize, the real initialization is |
|
323 |
done here ..." |
|
324 |
||
52 | 325 |
super initialize. |
72 | 326 |
|
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
327 |
device := Screen current. |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
328 |
|
72 | 329 |
"claus: I wanted to delay the creation & assignment of the |
330 |
builder till later, to allow setting to another builder. |
|
331 |
however, some ST-80 code accesses the builder right after instance |
|
332 |
creation ..." |
|
333 |
||
334 |
"/ " |
|
335 |
"/ Create a windowBuilder to have someone around which |
|
336 |
"/ understands the builder protocol. Since UIBuilder is not present |
|
337 |
"/ in all systems, this allows operation without one (unless a spec |
|
338 |
"/ is read later ...) |
|
339 |
"/ " |
|
85 | 340 |
builder := self createBuilder. |
78 | 341 |
builder notNil ifTrue:[builder application:self]. |
52 | 342 |
resources := self class classResources. |
311
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
343 |
|
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
344 |
"Modified: 5.7.1996 / 12:02:37 / cg" |
63 | 345 |
! |
346 |
||
138 | 347 |
createBuilder |
348 |
"create a UI Builder for me. |
|
349 |
This method can be redefined if (eventually) there are |
|
350 |
spec readers for other UI languages (motif UIL ?)" |
|
351 |
||
352 |
|cls| |
|
353 |
||
354 |
(cls := UIBuilder) isNil ifTrue:[ |
|
355 |
(cls := WindowBuilder) isNil ifTrue:[ |
|
356 |
^ nil |
|
357 |
] |
|
358 |
]. |
|
359 |
^ cls new |
|
360 |
! |
|
361 |
||
63 | 362 |
initialize |
83 | 363 |
"nothing done here; |
364 |
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
|
365 |
! |
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 |
setDevice:aDevice |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
368 |
"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
|
369 |
shall open its view(s). |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
370 |
The default device is the current screen." |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
371 |
|
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
372 |
device := aDevice |
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
373 |
|
fa222d8a208c
allow opening an app on another device
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
374 |
"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
|
375 |
"Modified: 5.7.1996 / 12:01:53 / cg" |
138 | 376 |
! ! |
377 |
||
378 |
!ApplicationModel methodsFor:'misc'! |
|
379 |
||
287 | 380 |
restoreCursors |
381 |
"restore the original cursors in all of my views" |
|
382 |
||
383 |
^ self window windowGroup restoreCursors |
|
384 |
||
385 |
"Created: 1.6.1996 / 17:01:24 / cg" |
|
386 |
! |
|
387 |
||
388 |
showCursor:aCursor |
|
389 |
"set all of my views cursor to aCursor. |
|
390 |
It can be restored with #restoreCursor." |
|
391 |
||
392 |
^ self window windowGroup showCursor:aCursor |
|
393 |
||
394 |
"Created: 1.6.1996 / 17:01:09 / cg" |
|
395 |
! |
|
396 |
||
138 | 397 |
withCursor:aCursor do:aBlock |
398 |
"evaluate aBlock, showing aCursor in my topView and all of its subviews. |
|
399 |
Return the value of aBlock." |
|
400 |
||
401 |
^ self window withCursor:aCursor do:aBlock |
|
63 | 402 |
! |
403 |
||
142
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
404 |
withExecuteCursorDo:aBlock |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
405 |
"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
|
406 |
Return the value of aBlock." |
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 |
^ self withCursor:(Cursor execute) do:aBlock |
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 |
"Created: 14.12.1995 / 20:57:03 / cg" |
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 |
|
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
413 |
withReadCursorDo:aBlock |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
414 |
"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
|
415 |
Return the value of aBlock." |
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 |
^ self withCursor:(Cursor read) do:aBlock |
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 |
"Created: 14.12.1995 / 20:56:47 / cg" |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
420 |
"Modified: 14.12.1995 / 20:57:36 / cg" |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
421 |
! |
6c6259d788a4
added withReadCursorDo: / withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
422 |
|
138 | 423 |
withWaitCursorDo:aBlock |
424 |
"evaluate aBlock, showing a waitCursor in my topView and all of its subviews. |
|
425 |
Return the value of aBlock." |
|
63 | 426 |
|
138 | 427 |
^ self withCursor:Cursor wait do:aBlock |
52 | 428 |
! ! |
57 | 429 |
|
71 | 430 |
!ApplicationModel methodsFor:'queries'! |
431 |
||
313
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
432 |
graphicsDevice |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
433 |
"return the device I want to open my views on. |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
434 |
The default (if not created with #onDevice:) is the currently |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
435 |
active screen." |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
436 |
|
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
437 |
^ device |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
438 |
|
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
439 |
"Created: 5.7.1996 / 17:51:31 / cg" |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
440 |
! |
09c2e83252f4
added access to graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
311
diff
changeset
|
441 |
|
71 | 442 |
processName |
443 |
"return a name to be shown for me in the process monitor" |
|
444 |
||
445 |
^ 'Application' |
|
446 |
! ! |
|
447 |
||
57 | 448 |
!ApplicationModel methodsFor:'startup'! |
449 |
||
63 | 450 |
allButOpenFrom:aSpec |
69 | 451 |
"create my views but do not open the main window" |
452 |
||
71 | 453 |
|realBuilder| |
454 |
||
72 | 455 |
"/ DISABLED; see comment in basicInitialize |
456 |
"/ |
|
457 |
"/ " |
|
458 |
"/ here, we kludge a bit: up to now, the builder was an |
|
459 |
"/ instance of the no-op WindowBuilder. Now, it becomes |
|
460 |
"/ a UIBuilder .... |
|
461 |
"/ This allows for ApplicationModels without a UIBuilder |
|
462 |
"/ if not needed. |
|
463 |
"/ " |
|
464 |
"/ realBuilder := UIBuilder new. |
|
465 |
"/ builder := realBuilder. |
|
466 |
"/ builder application:self. |
|
467 |
"/ builder bindings:builder bindings. |
|
71 | 468 |
|
63 | 469 |
self preBuildWith:builder. |
470 |
builder buildFromSpec:aSpec. |
|
85 | 471 |
builder window model:self. |
472 |
builder window application:self. |
|
63 | 473 |
self postBuildWith:builder. |
474 |
! |
|
57 | 475 |
|
138 | 476 |
allButOpenInterface:aSymbol |
477 |
"create my views but do not open the main window" |
|
478 |
||
479 |
|spec| |
|
480 |
||
481 |
spec := self class interfaceSpecFor:aSymbol. |
|
482 |
self allButOpenFrom:spec. |
|
483 |
^ builder |
|
484 |
! |
|
485 |
||
486 |
close |
|
487 |
"this is sent by my topView when about to be closed |
|
488 |
by the program (not by the windowManager). |
|
489 |
Could be redefined in subclasses." |
|
490 |
||
491 |
self closeDownViews |
|
492 |
! |
|
493 |
||
494 |
closeDownViews |
|
495 |
"close down the applications view" |
|
496 |
||
497 |
|wg views| |
|
498 |
||
499 |
(wg := self windowGroup) notNil ifTrue:[ |
|
500 |
views := wg topViews. |
|
501 |
views notNil ifTrue:[ |
|
502 |
views copy do:[:aView | |
|
503 |
aView notNil ifTrue:[aView destroy] |
|
504 |
] |
|
505 |
] |
|
506 |
] |
|
507 |
! |
|
508 |
||
509 |
closeRequest |
|
510 |
"this is sent by my topView when about to be closed by the |
|
511 |
windowmanager. Can be redefined to inform & query about unsafed |
|
512 |
view contents, to send #close on ok, or ignore the closeRequest." |
|
513 |
||
514 |
self closeDownViews |
|
515 |
! |
|
516 |
||
517 |
menuFor:aSymbol |
|
518 |
"create a new menuBuilder, to read specs and |
|
519 |
create a menu from it. Return this menu" |
|
520 |
||
521 |
|spec mbuilder| |
|
522 |
||
523 |
spec := self class interfaceSpecFor:aSymbol. |
|
524 |
mbuilder := UIBuilder new. |
|
525 |
mbuilder buildFromSpec:spec. |
|
526 |
||
527 |
builder componentAt:#windowMenuHolder put:(mbuilder window asValue). |
|
528 |
^ mbuilder window |
|
529 |
! |
|
530 |
||
69 | 531 |
open |
532 |
"open a standard interface" |
|
533 |
||
240 | 534 |
^ self openInterface |
535 |
||
536 |
"Modified: 3.5.1996 / 13:39:15 / cg" |
|
69 | 537 |
! |
538 |
||
63 | 539 |
openInterface |
78 | 540 |
"open a standard interface on another device. |
215 | 541 |
|
78 | 542 |
Subclasses which do not have an interfaceSpec |
215 | 543 |
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
|
544 |
(see Launcher as an example)." |
69 | 545 |
|
63 | 546 |
self openInterface:#windowSpec |
215 | 547 |
|
548 |
"Modified: 24.4.1996 / 09:35:43 / cg" |
|
330
d7ce98930ad3
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
313
diff
changeset
|
549 |
"Modified: 9.9.1996 / 22:39:23 / stefan" |
57 | 550 |
! |
551 |
||
63 | 552 |
openInterface:aSymbol |
215 | 553 |
"open a specific interface. |
554 |
The argument, aSymbol specifies which interface. The concrete |
|
555 |
application subclass must provide a method with that name, |
|
556 |
which must return an interfaceSpec. This is forwarded to |
|
557 |
the builder to create the views. |
|
69 | 558 |
Typically, applications only use one interface, |
78 | 559 |
returned by the #windowSpec method." |
69 | 560 |
|
85 | 561 |
self allButOpenInterface:aSymbol. |
78 | 562 |
builder openWithExtent:nil. |
563 |
||
63 | 564 |
^ builder |
215 | 565 |
|
566 |
"Modified: 24.4.1996 / 09:37:11 / cg" |
|
63 | 567 |
! |
568 |
||
362 | 569 |
openOnDevice:aDevice |
570 |
"open a standard interface on some other device" |
|
571 |
||
572 |
self setDevice:aDevice. |
|
573 |
^ self open |
|
574 |
||
575 |
"Created: 13.1.1997 / 21:24:11 / cg" |
|
576 |
"Modified: 13.1.1997 / 21:24:30 / cg" |
|
577 |
! |
|
578 |
||
63 | 579 |
opened |
215 | 580 |
"the topView has been opened. |
581 |
This is sent by my topView when its finally open" |
|
63 | 582 |
|
583 |
self addTopViewsToCurrentProject. |
|
584 |
self postOpenWith:builder |
|
215 | 585 |
|
586 |
"Modified: 24.4.1996 / 09:37:28 / cg" |
|
57 | 587 |
! |
588 |
||
138 | 589 |
postBuildWith:aBuilder |
590 |
"this is sent after an interface is built from a spec. |
|
591 |
Can be redefined in subclasses. |
|
592 |
mhmh - what should this do here ?" |
|
593 |
! |
|
594 |
||
595 |
postOpenWith:aBuilder |
|
596 |
"this is sent after the applications main window is opened. |
|
597 |
Can be redefined in subclasses. |
|
598 |
mhmh - what should this do here ?" |
|
599 |
! |
|
600 |
||
601 |
preBuildWith:aBuilder |
|
602 |
"this is sent before an interface is built from a spec. |
|
603 |
Can be redefined in subclasses. |
|
604 |
mhmh - what should this do here ?" |
|
605 |
! |
|
606 |
||
69 | 607 |
restarted |
287 | 608 |
"sent by my topWindow, when restarted from an image. |
69 | 609 |
Nothing done here, but can be redefined to perform any actions |
610 |
required to reset the application after an image-restart. |
|
611 |
(for example: check if application files are still around, restart |
|
287 | 612 |
subprocesses etc.)." |
613 |
||
614 |
"Modified: 1.6.1996 / 16:55:50 / cg" |
|
63 | 615 |
! |
57 | 616 |
|
63 | 617 |
saveAndTerminateRequest |
618 |
"some windowManagers send this to shut down an application |
|
619 |
and have it save its state for restart. |
|
620 |
Can be redefined in subclasses" |
|
621 |
||
622 |
self closeRequest |
|
57 | 623 |
! ! |
72 | 624 |
|
85 | 625 |
!ApplicationModel methodsFor:'window events'! |
626 |
||
144 | 627 |
showActivity:someMessage |
215 | 628 |
"some activityNotification shalt be communicated to |
629 |
the user. Forwarded from the topView and ignored here. |
|
630 |
Can be redefined in concrete applications to show the |
|
631 |
message either in some infoView (infoLabel as in Windows) |
|
632 |
or in the title area (as done in the browsers)" |
|
633 |
||
144 | 634 |
^ self |
635 |
||
636 |
"Created: 16.12.1995 / 18:41:04 / cg" |
|
215 | 637 |
"Modified: 24.4.1996 / 09:34:22 / cg" |
144 | 638 |
! |
639 |
||
85 | 640 |
windowEvent:anEvent from:anApplicationWindow |
215 | 641 |
"dummy: windowEvent forwarding is not yet implemented" |
642 |
||
85 | 643 |
^ self |
215 | 644 |
|
645 |
"Modified: 24.4.1996 / 09:32:50 / cg" |
|
85 | 646 |
! ! |
647 |
||
361 | 648 |
!ApplicationModel class methodsFor:'documentation'! |
72 | 649 |
|
138 | 650 |
version |
362 | 651 |
^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.32 1997-01-13 20:24:36 cg Exp $' |
81 | 652 |
! ! |
138 | 653 |
ApplicationModel initialize! |