0
|
1 |
"
|
6
|
2 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
72
|
3 |
All Rights Reserved
|
0
|
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 |
|
135
|
13 |
TopView subclass:#StandardSystemView
|
24
|
14 |
instanceVariableNames:'label icon iconView iconLabel
|
135
|
15 |
minExtent maxExtent sizeFixed
|
142
|
16 |
application windowEventsForApplication'
|
180
|
17 |
classVariableNames: 'DefaultIcon TakeFocusWhenMapped IncludeHostNameInLabel'
|
0
|
18 |
poolDictionaries:''
|
|
19 |
category:'Views-Basic'
|
|
20 |
!
|
|
21 |
|
|
22 |
StandardSystemView comment:'
|
46
|
23 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
72
|
24 |
All Rights Reserved
|
54
|
25 |
|
193
|
26 |
$Header: /cvs/stx/stx/libview/Attic/StdSysV.st,v 1.34 1995-10-23 16:59:29 cg Exp $
|
46
|
27 |
'!
|
0
|
28 |
|
46
|
29 |
!StandardSystemView class methodsFor:'documentation'!
|
|
30 |
|
|
31 |
copyright
|
|
32 |
"
|
|
33 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
72
|
34 |
All Rights Reserved
|
0
|
35 |
|
46
|
36 |
This software is furnished under a license and may be used
|
|
37 |
only in accordance with the terms of that license and with the
|
|
38 |
inclusion of the above copyright notice. This software may not
|
|
39 |
be provided or otherwise made available to, or used by, any
|
|
40 |
other person. No title to or ownership of the software is
|
|
41 |
hereby transferred.
|
|
42 |
"
|
|
43 |
!
|
0
|
44 |
|
46
|
45 |
version
|
|
46 |
"
|
193
|
47 |
$Header: /cvs/stx/stx/libview/Attic/StdSysV.st,v 1.34 1995-10-23 16:59:29 cg Exp $
|
46
|
48 |
"
|
|
49 |
!
|
|
50 |
|
|
51 |
documentation
|
|
52 |
"
|
|
53 |
I represent topViews i.e. those views which have a title-label,
|
72
|
54 |
an icon etc. Usually StandardSystemViews are subclassed for
|
|
55 |
special views.
|
46
|
56 |
"
|
|
57 |
! !
|
0
|
58 |
|
|
59 |
!StandardSystemView class methodsFor:'defaults'!
|
|
60 |
|
183
|
61 |
includeHostNameInLabel
|
|
62 |
"return the flag which controls if a views label should
|
|
63 |
include the hostname.
|
|
64 |
This flag is usually set/cleared in your private.rc file;
|
|
65 |
the default is false."
|
|
66 |
|
|
67 |
^ IncludeHostNameInLabel
|
|
68 |
|
|
69 |
"Created: 10.9.1995 / 19:21:16 / claus"
|
|
70 |
!
|
|
71 |
|
180
|
72 |
includeHostNameInLabel:aBoolean
|
|
73 |
"set/clear the flag which controls if a views label should
|
|
74 |
include the hostname - this is highly useful if you have
|
|
75 |
multiple smalltalks open simultaniously ...
|
|
76 |
This flag is usually set/cleared in your private.rc file;
|
|
77 |
the default is false."
|
|
78 |
|
|
79 |
IncludeHostNameInLabel := aBoolean
|
|
80 |
!
|
|
81 |
|
81
|
82 |
defaultLabel
|
|
83 |
"return the default label for views of my kind.
|
|
84 |
This can be redefined in subclasses or overwritten in
|
|
85 |
initialize methods."
|
|
86 |
|
|
87 |
^ 'aView'
|
|
88 |
!
|
|
89 |
|
|
90 |
defaultIcon
|
|
91 |
"return the default icon for views.
|
|
92 |
This can be redefined in subclasses or overwritten in
|
|
93 |
initialize methods."
|
|
94 |
|
|
95 |
DefaultIcon isNil ifTrue:[
|
135
|
96 |
DefaultIcon := Image fromFile:'SmalltalkX.xbm'.
|
119
|
97 |
DefaultIcon notNil ifTrue:[
|
|
98 |
DefaultIcon := DefaultIcon on:Display
|
|
99 |
]
|
81
|
100 |
].
|
|
101 |
^ DefaultIcon
|
0
|
102 |
! !
|
|
103 |
|
|
104 |
!StandardSystemView class methodsFor:'startup'!
|
|
105 |
|
46
|
106 |
open
|
|
107 |
"create, realize the view - this topview and all its subviews will
|
|
108 |
run as a separate process with its own windowGroup"
|
|
109 |
|
|
110 |
^ self new open
|
|
111 |
!
|
|
112 |
|
0
|
113 |
start
|
12
|
114 |
"create, realize the view - this topview and all its subviews will
|
81
|
115 |
run as a separate process with its own windowGroup.
|
|
116 |
This method exists for backward compatibility - use open."
|
0
|
117 |
|
46
|
118 |
^ self open
|
0
|
119 |
! !
|
|
120 |
|
|
121 |
!StandardSystemView class methodsFor:'instance creation'!
|
|
122 |
|
|
123 |
model:aModel label:aLabel minimumSize:minExtent
|
81
|
124 |
"ST80-style instance creation"
|
|
125 |
|
0
|
126 |
|newView|
|
|
127 |
|
|
128 |
newView := self origin:nil
|
72
|
129 |
extent:minExtent
|
|
130 |
label:aLabel
|
|
131 |
icon:nil
|
|
132 |
minExtent:minExtent
|
|
133 |
maxExtent:nil.
|
0
|
134 |
newView model:aModel.
|
109
|
135 |
"/ newView controller:(self defaultControllerClass new view:newView).
|
0
|
136 |
^ newView
|
|
137 |
!
|
|
138 |
|
|
139 |
label:aLabel
|
|
140 |
"create a new topView and define its label"
|
|
141 |
|
|
142 |
^ self origin:nil extent:nil
|
72
|
143 |
label:aLabel icon:nil
|
|
144 |
minExtent:nil maxExtent:nil
|
0
|
145 |
!
|
|
146 |
|
|
147 |
label:aLabel minExtent:anExtent
|
81
|
148 |
"create a new topView and define its label and minimum extent"
|
|
149 |
|
0
|
150 |
^ self origin:nil extent:nil
|
72
|
151 |
label:aLabel icon:nil
|
|
152 |
minExtent:anExtent maxExtent:nil
|
0
|
153 |
!
|
|
154 |
|
|
155 |
label:aLabel icon:aForm
|
81
|
156 |
"create a new topView and define its label and icon"
|
|
157 |
|
0
|
158 |
^ self origin:nil extent:nil
|
72
|
159 |
label:aLabel icon:aForm
|
|
160 |
minExtent:nil maxExtent:nil
|
0
|
161 |
!
|
|
162 |
|
|
163 |
label:aLabel icon:aForm minExtent:anExtent
|
81
|
164 |
"create a new topView and define its label, icon and minumum extent"
|
|
165 |
|
0
|
166 |
^ self origin:nil extent:nil
|
72
|
167 |
label:aLabel icon:aForm
|
|
168 |
minExtent:anExtent maxExtent:nil
|
0
|
169 |
!
|
|
170 |
|
|
171 |
label:aLabel icon:aForm minExtent:minExtent maxExtent:maxExtent
|
81
|
172 |
"create a new topView and define its label, icon, min and max extents"
|
|
173 |
|
0
|
174 |
^ self origin:nil extent:nil
|
72
|
175 |
label:aLabel icon:aForm
|
|
176 |
minExtent:minExtent maxExtent:maxExtent
|
0
|
177 |
!
|
|
178 |
|
|
179 |
origin:anOrigin extent:anExtent label:aLabel
|
81
|
180 |
"create a new topView and define its origin, extent and label"
|
|
181 |
|
0
|
182 |
^ self origin:anOrigin extent:anExtent
|
72
|
183 |
label:aLabel icon:nil
|
|
184 |
minExtent:nil maxExtent:nil
|
0
|
185 |
!
|
|
186 |
|
|
187 |
origin:anOrigin label:aLabel icon:aForm
|
72
|
188 |
minExtent:minExtent maxExtent:maxExtent
|
81
|
189 |
"create a new topView and define its origin, extent, label, icon
|
|
190 |
and extent-boundaries."
|
|
191 |
|
0
|
192 |
^ self origin:anOrigin extent:nil
|
72
|
193 |
label:aLabel icon:aForm
|
|
194 |
minExtent:minExtent maxExtent:maxExtent
|
0
|
195 |
!
|
|
196 |
|
81
|
197 |
extent:anExtent label:aLabel minExtent:minExtent
|
|
198 |
"create a new topView and define its extent, label and minumum extent"
|
|
199 |
|
0
|
200 |
^ self origin:nil extent:anExtent
|
72
|
201 |
label:aLabel icon:nil
|
|
202 |
minExtent:minExtent maxExtent:nil
|
0
|
203 |
!
|
|
204 |
|
|
205 |
extent:anExtent label:aLabel icon:aForm
|
81
|
206 |
"create a new topView and define its extent, label and icon"
|
|
207 |
|
0
|
208 |
^ self origin:nil extent:anExtent
|
72
|
209 |
label:aLabel icon:aForm
|
|
210 |
minExtent:nil maxExtent:nil
|
0
|
211 |
!
|
|
212 |
|
81
|
213 |
extent:anExtent label:aLabel icon:aForm minExtent:minExtent
|
0
|
214 |
^ self origin:nil extent:anExtent
|
72
|
215 |
label:aLabel icon:aForm
|
|
216 |
minExtent:minExtent maxExtent:nil
|
0
|
217 |
!
|
|
218 |
|
81
|
219 |
extent:anExtent label:aLabel icon:aForm minExtent:minExtent maxExtent:maxExtent
|
0
|
220 |
^ self origin:nil extent:anExtent
|
72
|
221 |
label:aLabel icon:aForm
|
|
222 |
minExtent:minExtent maxExtent:maxExtent
|
0
|
223 |
! !
|
|
224 |
|
|
225 |
!StandardSystemView methodsFor:'initialization'!
|
|
226 |
|
|
227 |
initialize
|
|
228 |
super initialize.
|
|
229 |
|
81
|
230 |
borderWidth := 2. "- notice: many window managers ignore this"
|
0
|
231 |
minExtent := 10 @ 10.
|
81
|
232 |
maxExtent := (device width) @ (device height).
|
135
|
233 |
label isNil ifTrue:[label := self class defaultLabel].
|
110
|
234 |
icon isNil ifTrue:[icon := self class defaultIcon].
|
81
|
235 |
name := self class name.
|
0
|
236 |
!
|
|
237 |
|
89
|
238 |
initEvents
|
|
239 |
super initEvents.
|
|
240 |
self enableFocusEvents.
|
|
241 |
!
|
|
242 |
|
109
|
243 |
defaultControllerClass
|
46
|
244 |
"for ST-80 compatibility only - not used in ST/X"
|
|
245 |
|
89
|
246 |
^ nil "/ StandardSystemController
|
12
|
247 |
!
|
|
248 |
|
0
|
249 |
addToCurrentProject
|
46
|
250 |
"add the receiver (a topview) to the current projects set-of-views.
|
|
251 |
(If there is a current project)"
|
|
252 |
|
72
|
253 |
|p|
|
69
|
254 |
|
|
255 |
"
|
72
|
256 |
the following check allows systems
|
|
257 |
without projects and changeSets
|
69
|
258 |
"
|
72
|
259 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[
|
|
260 |
p addView: self
|
69
|
261 |
]
|
|
262 |
!
|
12
|
263 |
|
69
|
264 |
removeFromCurrentProject
|
|
265 |
"remove the receiver (a topview) from the current projects set-of-views.
|
|
266 |
(If there is a current project)"
|
|
267 |
|
72
|
268 |
|p|
|
69
|
269 |
|
|
270 |
"
|
72
|
271 |
the following check allows systems
|
|
272 |
without projects and changeSets
|
69
|
273 |
"
|
72
|
274 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[
|
|
275 |
p removeView:self
|
12
|
276 |
]
|
0
|
277 |
!
|
|
278 |
|
24
|
279 |
reinitialize
|
46
|
280 |
"reopen the receiver if if was visible before.
|
|
281 |
This is called right after snapIn; Notice, that all instance variables
|
72
|
282 |
(such as shown, realized etc.) are left-overs from the time the snapout
|
46
|
283 |
was done. Remap the receiver, if it was mapped at snapout time"
|
24
|
284 |
|
|
285 |
|myController|
|
|
286 |
|
|
287 |
"if I have already been reinited - return"
|
|
288 |
drawableId notNil ifTrue:[
|
72
|
289 |
^ self
|
24
|
290 |
].
|
|
291 |
|
46
|
292 |
"have to kludge with the controller
|
|
293 |
- otherwise its startup performs unwanted actions ..."
|
|
294 |
|
24
|
295 |
myController := controller.
|
|
296 |
controller := nil.
|
46
|
297 |
|
|
298 |
"physically create the view & subviews"
|
24
|
299 |
self recreate.
|
|
300 |
|
|
301 |
"if I was mapped, do it again"
|
|
302 |
realized ifTrue:[
|
72
|
303 |
"if it was iconified, try to remap iconified"
|
89
|
304 |
device mapView:self id:drawableId iconified:(shown not)
|
|
305 |
atX:left y:top width:width height:height.
|
24
|
306 |
|
72
|
307 |
"and restart the window-group process"
|
|
308 |
windowGroup notNil ifTrue:[
|
|
309 |
windowGroup restart
|
|
310 |
]
|
24
|
311 |
].
|
|
312 |
|
|
313 |
"restore controller"
|
|
314 |
controller := myController
|
|
315 |
!
|
|
316 |
|
0
|
317 |
recreate
|
|
318 |
"recreate the view after a snap-in"
|
|
319 |
|
24
|
320 |
icon := self convertedIcon.
|
|
321 |
super recreate.
|
46
|
322 |
|
24
|
323 |
iconView notNil ifTrue:[
|
72
|
324 |
iconView create.
|
|
325 |
device setWindowIconWindow:iconView in:drawableId
|
24
|
326 |
] ifFalse:[
|
72
|
327 |
(icon notNil and:[icon id notNil]) ifTrue:[
|
|
328 |
device setWindowIcon:icon in:drawableId
|
|
329 |
].
|
12
|
330 |
].
|
24
|
331 |
|
|
332 |
iconLabel notNil ifTrue:[
|
72
|
333 |
device setIconName:iconLabel in:drawableId
|
12
|
334 |
]
|
|
335 |
!
|
|
336 |
|
|
337 |
reAdjustGeometry
|
|
338 |
"when we come up on a smaller display,
|
|
339 |
make certain, that the receiver is visible"
|
|
340 |
|
94
|
341 |
|dX dY limitRight limitBottom|
|
12
|
342 |
|
|
343 |
dX := (device horizontalPixelPerMillimeter * 20) rounded.
|
|
344 |
dY := (device verticalPixelPerMillimeter * 20) rounded.
|
|
345 |
|
94
|
346 |
limitRight := device width - dX.
|
|
347 |
limitBottom := device height - dY.
|
|
348 |
((self left > limitRight) or:[
|
|
349 |
self top > limitBottom]) ifTrue:[
|
|
350 |
'moving view into visible area' errorPrintNL.
|
|
351 |
self origin:limitRight @ limitBottom
|
0
|
352 |
]
|
89
|
353 |
!
|
|
354 |
|
|
355 |
realize
|
142
|
356 |
"realize the view i.e. make it visible."
|
|
357 |
|
89
|
358 |
super realize.
|
|
359 |
windowGroup notNil ifTrue:[
|
135
|
360 |
"/
|
|
361 |
"/ have to wait till now, since before I had no windowGroup
|
|
362 |
"/
|
|
363 |
windowGroup focusSequence:self focusSequence.
|
|
364 |
"/
|
|
365 |
"/ let the application add its views to the current project
|
|
366 |
"/
|
|
367 |
application notNil ifTrue:[
|
|
368 |
application opened.
|
|
369 |
] ifFalse:[
|
|
370 |
self addToCurrentProject.
|
|
371 |
].
|
89
|
372 |
]
|
|
373 |
!
|
|
374 |
|
140
|
375 |
restarted
|
|
376 |
"sent by my windowGroup, when restarted from an image.
|
|
377 |
Nothing done here, but can be redefined to perform any actions
|
|
378 |
required to reset the application after an image-restart.
|
|
379 |
(for example: check if application files are still around, restart
|
|
380 |
subprocesses etc.)."
|
|
381 |
|
|
382 |
application notNil ifTrue:[
|
|
383 |
application restarted
|
|
384 |
].
|
0
|
385 |
! !
|
|
386 |
|
|
387 |
!StandardSystemView methodsFor:'destroying'!
|
|
388 |
|
135
|
389 |
terminate
|
142
|
390 |
"terminate request from the windowManager. If there is an application,
|
|
391 |
let it decide if it really wants to be close. Otherwise, forward it to
|
157
|
392 |
superclasses terminate which knows how to do this.
|
|
393 |
Notice, that not all windowmanagers are nice enough
|
|
394 |
to send this request; some simply distroy the view."
|
142
|
395 |
|
135
|
396 |
application notNil ifTrue:[
|
|
397 |
application closeRequest
|
|
398 |
] ifFalse:[
|
|
399 |
super terminate
|
|
400 |
]
|
|
401 |
!
|
|
402 |
|
|
403 |
saveAndTerminate
|
142
|
404 |
"save & terminate request from the windowManager. The application should
|
|
405 |
save its data/files/text etc. somehow and close.
|
|
406 |
If there is an application, let it decide how do do that.
|
|
407 |
Otherwise, forward it to superclasses which knows how to do this.
|
157
|
408 |
(it defaults to a terminate there).
|
|
409 |
Notice, that not all windowmanagers are nice enough
|
|
410 |
to send this request; some simply distroy the view."
|
142
|
411 |
|
135
|
412 |
application notNil ifTrue:[
|
|
413 |
application saveAndTerminateRequest
|
|
414 |
] ifFalse:[
|
|
415 |
super saveAndTerminate
|
|
416 |
]
|
|
417 |
!
|
|
418 |
|
0
|
419 |
destroy
|
142
|
420 |
"destroy the view."
|
|
421 |
|
153
|
422 |
self removeFromCurrentProject.
|
132
|
423 |
windowGroup notNil ifTrue:[
|
|
424 |
windowGroup focusSequence:nil.
|
|
425 |
].
|
157
|
426 |
application notNil ifTrue:[
|
|
427 |
application windowEvent:(#close -> self) from:self
|
|
428 |
].
|
0
|
429 |
super destroy.
|
157
|
430 |
!
|
|
431 |
|
|
432 |
closeRequest
|
|
433 |
"programmatic close request"
|
|
434 |
|
|
435 |
^ self terminate
|
0
|
436 |
! !
|
|
437 |
|
24
|
438 |
!StandardSystemView methodsFor:'private'!
|
|
439 |
|
|
440 |
convertedIcon
|
|
441 |
"make certain, that the icon is a b&w bitmap;
|
72
|
442 |
do so by converting if required.
|
24
|
443 |
Will add a device supportsDeepIcons and only convert when needed;
|
72
|
444 |
for now, we always have to convert (since there are only Xdisplays)."
|
24
|
445 |
|
|
446 |
|deviceIcon|
|
|
447 |
|
|
448 |
icon isNil ifTrue:[^ nil].
|
|
449 |
|
81
|
450 |
device supportsDeepIcons ifFalse:[
|
|
451 |
icon depth ~~ 1 ifTrue:[
|
|
452 |
"
|
|
453 |
dither to monochrome
|
|
454 |
"
|
|
455 |
deviceIcon := icon asMonochromeFormOn:device.
|
|
456 |
] ifFalse:[
|
|
457 |
deviceIcon := icon
|
|
458 |
]
|
24
|
459 |
].
|
|
460 |
deviceIcon notNil ifTrue:[
|
81
|
461 |
"
|
|
462 |
get device pixmap (i.e. allocate colors & resource)
|
|
463 |
"
|
72
|
464 |
deviceIcon := deviceIcon on:device
|
24
|
465 |
].
|
|
466 |
^ deviceIcon
|
193
|
467 |
!
|
|
468 |
|
|
469 |
setWindowGroupFromApplication
|
|
470 |
|win|
|
|
471 |
|
|
472 |
windowGroup isNil ifTrue:[
|
|
473 |
application notNil ifTrue:[
|
|
474 |
(win := application window) notNil ifTrue:[
|
|
475 |
windowGroup := win windowGroup.
|
|
476 |
]
|
|
477 |
]
|
|
478 |
].
|
|
479 |
|
|
480 |
"Created: 22.9.1995 / 17:40:36 / claus"
|
24
|
481 |
! !
|
|
482 |
|
0
|
483 |
!StandardSystemView methodsFor:'realization'!
|
|
484 |
|
46
|
485 |
physicalCreate
|
|
486 |
"common code for create & recreate"
|
|
487 |
|
183
|
488 |
|l|
|
|
489 |
|
|
490 |
IncludeHostNameInLabel == true ifTrue:[
|
|
491 |
l := OperatingSystem getHostName , ': ' , label.
|
|
492 |
] ifFalse:[
|
|
493 |
l := label
|
|
494 |
].
|
|
495 |
|
46
|
496 |
drawableId := device
|
72
|
497 |
createWindowFor:self
|
|
498 |
origin:(left @ top)
|
|
499 |
extent:(width @ height)
|
|
500 |
minExtent:minExtent
|
|
501 |
maxExtent:maxExtent
|
|
502 |
borderWidth:borderWidth
|
|
503 |
subViewOf:nil
|
157
|
504 |
onTop:(self isPopUpView)
|
72
|
505 |
inputOnly:(self inputOnly)
|
183
|
506 |
label:l
|
72
|
507 |
cursor:cursor
|
|
508 |
icon:icon
|
|
509 |
iconView:iconView.
|
46
|
510 |
|
|
511 |
extentChanged := false.
|
|
512 |
originChanged := false.
|
|
513 |
|
81
|
514 |
(borderColor notNil and:[borderColor ~~ Black]) ifTrue:[
|
|
515 |
borderColor := borderColor on:device.
|
|
516 |
self setBorderColor
|
72
|
517 |
].
|
81
|
518 |
|
|
519 |
"/ (viewGravity notNil "and:[viewGravity ~~ #NorthWest]") ifTrue:[
|
|
520 |
"/ device setWindowGravity:viewGravity in:drawableId
|
|
521 |
"/ ].
|
|
522 |
|
|
523 |
"/ (bitGravity notNil "and:[bitGravity ~~ #NorthWest]") ifTrue:[
|
|
524 |
"/ device setBitGravity:bitGravity in:drawableId
|
|
525 |
"/ ].
|
72
|
526 |
|
46
|
527 |
borderShape notNil ifTrue:[
|
72
|
528 |
device setWindowBorderShape:(borderShape id) in:drawableId
|
46
|
529 |
].
|
|
530 |
viewShape notNil ifTrue:[
|
72
|
531 |
device setWindowShape:(viewShape id) in:drawableId
|
46
|
532 |
].
|
|
533 |
(backed notNil and:[backed ~~ false]) ifTrue:[
|
72
|
534 |
device setBackingStore:backed in:drawableId
|
46
|
535 |
].
|
|
536 |
saveUnder ifTrue:[
|
72
|
537 |
device setSaveUnder:true in:drawableId
|
46
|
538 |
].
|
|
539 |
!
|
|
540 |
|
0
|
541 |
create
|
|
542 |
"create - make certain that icon is available"
|
|
543 |
|
24
|
544 |
icon := self convertedIcon.
|
2
|
545 |
super create.
|
12
|
546 |
|
2
|
547 |
iconView notNil ifTrue:[
|
72
|
548 |
iconView create.
|
|
549 |
device setWindowIconWindow:iconView in:drawableId
|
24
|
550 |
].
|
|
551 |
iconLabel notNil ifTrue:[
|
72
|
552 |
device setIconName:iconLabel in:drawableId
|
2
|
553 |
]
|
0
|
554 |
!
|
|
555 |
|
94
|
556 |
openWithPriority:aPriority
|
|
557 |
"open the view, run the windowgroup process at
|
135
|
558 |
other than UserScehdulingPriority."
|
94
|
559 |
|
|
560 |
self open.
|
|
561 |
windowGroup process priority:aPriority.
|
0
|
562 |
! !
|
|
563 |
|
72
|
564 |
!StandardSystemView methodsFor:'printing & storing'!
|
|
565 |
|
|
566 |
displayString
|
118
|
567 |
"just for your convenience in inspectors ...
|
|
568 |
... add the views label to the displayString."
|
72
|
569 |
|
|
570 |
|s|
|
|
571 |
|
|
572 |
s := super displayString.
|
118
|
573 |
label notNil ifTrue:[
|
72
|
574 |
s := s , '(' , label , ')'
|
|
575 |
].
|
|
576 |
^ s
|
69
|
577 |
! !
|
|
578 |
|
141
|
579 |
!StandardSystemView methodsFor:'queries'!
|
|
580 |
|
|
581 |
processName
|
|
582 |
"return a string to be shown for my process in the
|
|
583 |
process monitor"
|
|
584 |
|
|
585 |
application notNil ifTrue:[
|
|
586 |
^ application processName
|
|
587 |
].
|
|
588 |
label notNil ifTrue:[^ label].
|
|
589 |
^ super processName
|
142
|
590 |
!
|
|
591 |
|
|
592 |
focusSequence
|
|
593 |
"return a sequence which defines the order in which the focus
|
|
594 |
is passed for FocusNext and FocusPrevious keys.
|
|
595 |
All views which like to support these keys should redefine
|
|
596 |
this method and return a collection of (sub-) views.
|
|
597 |
Or, if the model is some applicationModel, it may itself define
|
|
598 |
the focusSequence.
|
|
599 |
Notice: I dont think this is good style: the focusSequence seems
|
|
600 |
to belong into the controller, ..."
|
|
601 |
|
|
602 |
"/
|
|
603 |
"/ if I have an application, its supposed to
|
|
604 |
"/ know about the focusSequence
|
|
605 |
"/
|
|
606 |
application notNil ifTrue:[
|
|
607 |
^ application focusSequence
|
|
608 |
].
|
|
609 |
|
|
610 |
(model notNil
|
|
611 |
and:[(model respondsTo:#focusSequence)
|
|
612 |
and:[model ~~ self]]) ifTrue:[
|
|
613 |
^ model focusSequence
|
|
614 |
].
|
|
615 |
^ nil
|
141
|
616 |
! !
|
|
617 |
|
0
|
618 |
!StandardSystemView methodsFor:'accessing'!
|
|
619 |
|
|
620 |
label
|
|
621 |
"return the views name in the title area"
|
|
622 |
|
|
623 |
^ label
|
|
624 |
!
|
|
625 |
|
|
626 |
label:aString
|
180
|
627 |
"define the views name in the windows title area.
|
|
628 |
If IncludeHostNameInLabel is true, prepend the hostname
|
|
629 |
(you will appreciate this, if you are working on multiple
|
|
630 |
machines simultanously - as I do ...)"
|
|
631 |
|
|
632 |
|l|
|
0
|
633 |
|
181
|
634 |
aString ~= label ifTrue:[
|
|
635 |
label := aString.
|
|
636 |
drawableId notNil ifTrue: [
|
|
637 |
IncludeHostNameInLabel == true ifTrue:[
|
|
638 |
l := OperatingSystem getHostName , ': ' , aString.
|
|
639 |
] ifFalse:[
|
|
640 |
l := aString
|
|
641 |
].
|
|
642 |
device setWindowName:l in:drawableId.
|
|
643 |
"
|
|
644 |
unbuffered - to make it visible right NOW
|
|
645 |
"
|
|
646 |
device flush.
|
|
647 |
]
|
0
|
648 |
]
|
181
|
649 |
|
|
650 |
"Created: 8.9.1995 / 19:37:06 / claus"
|
|
651 |
"Modified: 8.9.1995 / 19:39:18 / claus"
|
0
|
652 |
!
|
|
653 |
|
24
|
654 |
iconLabel
|
|
655 |
"return the name displayed in the icon"
|
|
656 |
|
|
657 |
^ iconLabel
|
|
658 |
!
|
|
659 |
|
|
660 |
iconLabel:aString
|
|
661 |
"define the name to be displayed in the icon"
|
|
662 |
|
|
663 |
iconLabel := aString.
|
|
664 |
drawableId notNil ifTrue:[
|
72
|
665 |
device setIconName:aString in:drawableId.
|
|
666 |
"
|
|
667 |
unbuffered - to make it visible right NOW
|
|
668 |
"
|
151
|
669 |
device flush.
|
24
|
670 |
]
|
|
671 |
!
|
|
672 |
|
153
|
673 |
label:labelString iconLabel:iconLabelString
|
|
674 |
"set both the label and the iconLabel"
|
|
675 |
|
|
676 |
self label:labelString.
|
|
677 |
self iconLabel:iconLabelString
|
|
678 |
!
|
|
679 |
|
12
|
680 |
name
|
24
|
681 |
"return the topViews label"
|
|
682 |
|
12
|
683 |
^ label
|
|
684 |
!
|
|
685 |
|
0
|
686 |
icon
|
|
687 |
"return the form defined as icon"
|
|
688 |
|
|
689 |
^ icon
|
|
690 |
!
|
|
691 |
|
|
692 |
icon:aForm
|
|
693 |
"define the form (bitmap) used as icon"
|
|
694 |
|
24
|
695 |
|invertedIcon i|
|
12
|
696 |
|
0
|
697 |
icon := aForm.
|
12
|
698 |
icon notNil ifTrue:[
|
72
|
699 |
drawableId notNil ifTrue:[
|
|
700 |
icon depth ~~ 1 ifTrue:[
|
|
701 |
icon := icon asMonochromeFormOn:device.
|
|
702 |
].
|
|
703 |
"icons assume 1s as black - invert icon if the device thinks different"
|
|
704 |
(device depth == 1 and:[device whitepixel ~~ 0]) ifTrue:[
|
|
705 |
i := icon on:device.
|
|
706 |
i notNil ifTrue:[
|
|
707 |
invertedIcon := Form width:icon width height:icon height on:device.
|
|
708 |
invertedIcon function:#copy.
|
|
709 |
invertedIcon foreground:Color noColor background:Color allColor.
|
|
710 |
invertedIcon copyFrom:i x:0 y:0 toX:0 y:0 width:icon width height:icon height.
|
|
711 |
i := invertedIcon.
|
|
712 |
]
|
|
713 |
] ifFalse:[
|
|
714 |
i := icon on:device.
|
|
715 |
].
|
|
716 |
(i notNil and:[i id notNil]) ifTrue:[
|
|
717 |
device setWindowIcon:i in:drawableId
|
|
718 |
]
|
|
719 |
]
|
0
|
720 |
]
|
|
721 |
!
|
|
722 |
|
|
723 |
iconView
|
|
724 |
"return the view used as icon-view"
|
|
725 |
|
|
726 |
^ iconView
|
|
727 |
!
|
|
728 |
|
|
729 |
iconView:aView
|
|
730 |
"specify the view to be used as icon"
|
|
731 |
|
|
732 |
iconView := aView.
|
|
733 |
drawableId notNil ifTrue:[
|
72
|
734 |
aView create.
|
|
735 |
device setWindowIconWindow:aView in:drawableId
|
0
|
736 |
]
|
|
737 |
!
|
|
738 |
|
|
739 |
iconName:aString
|
24
|
740 |
"this method will vanish soon ... - for backward compatibility"
|
0
|
741 |
|
24
|
742 |
self iconLabel:aString
|
0
|
743 |
!
|
|
744 |
|
|
745 |
maximumSize:anExtent
|
24
|
746 |
"same as maxExtent: for ST-80 compatibility"
|
0
|
747 |
|
|
748 |
^ self maxExtent:anExtent
|
|
749 |
!
|
|
750 |
|
135
|
751 |
minimumSize
|
|
752 |
"same as minExtent for ST-80 compatibility"
|
|
753 |
|
|
754 |
^ self minExtent
|
|
755 |
!
|
|
756 |
|
0
|
757 |
minimumSize:anExtent
|
24
|
758 |
"same as minExtent: for ST-80 compatibility"
|
0
|
759 |
|
|
760 |
^ self minExtent:anExtent
|
|
761 |
!
|
|
762 |
|
|
763 |
minExtent
|
|
764 |
"return the views minimum allowed extent"
|
|
765 |
|
|
766 |
^ minExtent
|
|
767 |
!
|
|
768 |
|
|
769 |
minExtent:min
|
|
770 |
"define the minimum extent the view may have -
|
|
771 |
depends on good-will of window manager"
|
|
772 |
|
|
773 |
minExtent := min.
|
|
774 |
(width notNil and:[height notNil]) ifTrue:[
|
72
|
775 |
((width < (minExtent x)) or:
|
|
776 |
[height < (minExtent y)]) ifTrue: [
|
|
777 |
self extent:minExtent
|
|
778 |
]
|
0
|
779 |
]
|
|
780 |
!
|
|
781 |
|
|
782 |
maxExtent
|
|
783 |
"return the views maximum allowed extent"
|
|
784 |
|
|
785 |
^ maxExtent
|
|
786 |
!
|
|
787 |
|
|
788 |
maxExtent:max
|
|
789 |
"define the maximum extent the view may have -
|
|
790 |
depends on good-will of window manager"
|
|
791 |
|
|
792 |
maxExtent := max.
|
|
793 |
(width notNil and:[height notNil]) ifTrue:[
|
72
|
794 |
((width > (maxExtent x)) or:
|
|
795 |
[height > (maxExtent y)]) ifTrue: [
|
|
796 |
self extent:maxExtent
|
|
797 |
]
|
0
|
798 |
]
|
135
|
799 |
!
|
|
800 |
|
|
801 |
sizeFixed:aBoolean
|
|
802 |
"this prevents the view from resizing itself when realized.
|
|
803 |
For normal topViews, this is void, since they dont do this anyway.
|
151
|
804 |
|
|
805 |
However, modalBoxes (especially: DialogBoxes) typically resize themselfes
|
|
806 |
to the preferredExtent of their components. In some cases, this behavior is
|
|
807 |
not desired and it should be turned off by setting sizeFixed to true.
|
|
808 |
|
144
|
809 |
To avoid confusion:
|
|
810 |
This does NOT prevent the window manager from resizing the view,
|
151
|
811 |
instead it tells the view to NOT resize ITSELF."
|
144
|
812 |
|
|
813 |
sizeFixed := aBoolean.
|
|
814 |
|
|
815 |
"example: dialog which resizes itself on #open:
|
|
816 |
(thereby ignoring the 200@200 extent)
|
|
817 |
|
|
818 |
|dialog|
|
135
|
819 |
|
144
|
820 |
dialog := Dialog new.
|
|
821 |
dialog addInputFieldOn:'' asValue.
|
|
822 |
dialog addOkButton.
|
|
823 |
dialog extent:200@200.
|
|
824 |
dialog open.
|
|
825 |
|
151
|
826 |
|
144
|
827 |
using sizeFixed:
|
|
828 |
|
|
829 |
|dialog|
|
|
830 |
|
|
831 |
dialog := Dialog new.
|
|
832 |
dialog addInputFieldOn:'' asValue.
|
|
833 |
dialog addOkButton.
|
|
834 |
dialog extent:200@200; sizeFixed:true.
|
|
835 |
dialog open.
|
151
|
836 |
|
|
837 |
|
|
838 |
using openWithExtent (also sets sizeFixed):
|
|
839 |
|
|
840 |
|dialog|
|
|
841 |
|
|
842 |
dialog := Dialog new.
|
|
843 |
dialog addInputFieldOn:'' asValue.
|
|
844 |
dialog addOkButton.
|
|
845 |
dialog openWithExtent:200@200.
|
144
|
846 |
"
|
135
|
847 |
!
|
|
848 |
|
|
849 |
application
|
|
850 |
"return the topViews application.
|
|
851 |
This is new protocol for ST-80 compatibility and not yet fully supported"
|
|
852 |
|
|
853 |
^ application
|
|
854 |
!
|
|
855 |
|
|
856 |
application:anApplicationModel
|
|
857 |
"set the topViews application.
|
|
858 |
This is new protocol for ST-80 compatibility and not yet fully supported"
|
|
859 |
|
|
860 |
application := anApplicationModel
|
193
|
861 |
!
|
|
862 |
|
|
863 |
bePartner
|
|
864 |
self setWindowGroupFromApplication.
|
|
865 |
super bePartner.
|
|
866 |
|
|
867 |
"Created: 22.9.1995 / 17:40:15 / claus"
|
|
868 |
!
|
|
869 |
|
|
870 |
beSlave
|
|
871 |
self setWindowGroupFromApplication.
|
|
872 |
super beSlave.
|
|
873 |
|
|
874 |
"Created: 22.9.1995 / 17:40:15 / claus"
|
0
|
875 |
! !
|
89
|
876 |
|
|
877 |
!StandardSystemView methodsFor:'event handling'!
|
|
878 |
|
142
|
879 |
sendWindowEvents:collectionOfEventSymbols
|
|
880 |
"define the events that are to be forwarded to the application.
|
|
881 |
This is being implemented ..."
|
|
882 |
|
|
883 |
windowEventsForApplication := collectionOfEventSymbols
|
|
884 |
!
|
|
885 |
|
89
|
886 |
focusOut
|
|
887 |
"the view lost keyboard focus"
|
|
888 |
|
|
889 |
|v|
|
|
890 |
|
|
891 |
windowGroup notNil ifTrue:[
|
|
892 |
(v := windowGroup focusView) notNil ifTrue:[
|
|
893 |
v showNoFocus
|
|
894 |
]
|
|
895 |
].
|
|
896 |
!
|
|
897 |
|
|
898 |
focusIn
|
|
899 |
"the view got the keyboard focus"
|
|
900 |
|
|
901 |
|v|
|
|
902 |
|
|
903 |
windowGroup notNil ifTrue:[
|
|
904 |
(v := windowGroup focusView) notNil ifTrue:[
|
|
905 |
v showFocus
|
|
906 |
]
|
|
907 |
].
|
|
908 |
!
|
|
909 |
|
|
910 |
mapped
|
|
911 |
"the view got mapped"
|
|
912 |
|
|
913 |
super mapped.
|
|
914 |
"
|
|
915 |
ask for the focus - this avoids having to click on the
|
|
916 |
view with WM's which need an explicit click.
|
|
917 |
Q: is this a good idea ?
|
|
918 |
"
|
|
919 |
TakeFocusWhenMapped == true ifTrue:[
|
|
920 |
self getKeyboardFocus.
|
|
921 |
]
|
|
922 |
! !
|