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
|
|
16 |
application'
|
89
|
17 |
classVariableNames: 'DefaultIcon TakeFocusWhenMapped'
|
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 |
|
140
|
26 |
$Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.24 1995-05-09 00:22:41 claus 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 |
"
|
140
|
47 |
$Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.24 1995-05-09 00:22:41 claus 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 |
|
81
|
61 |
defaultLabel
|
|
62 |
"return the default label for views of my kind.
|
|
63 |
This can be redefined in subclasses or overwritten in
|
|
64 |
initialize methods."
|
|
65 |
|
|
66 |
^ 'aView'
|
|
67 |
!
|
|
68 |
|
|
69 |
defaultIcon
|
|
70 |
"return the default icon for views.
|
|
71 |
This can be redefined in subclasses or overwritten in
|
|
72 |
initialize methods."
|
|
73 |
|
|
74 |
DefaultIcon isNil ifTrue:[
|
135
|
75 |
DefaultIcon := Image fromFile:'SmalltalkX.xbm'.
|
119
|
76 |
DefaultIcon notNil ifTrue:[
|
|
77 |
DefaultIcon := DefaultIcon on:Display
|
|
78 |
]
|
81
|
79 |
].
|
|
80 |
^ DefaultIcon
|
0
|
81 |
! !
|
|
82 |
|
|
83 |
!StandardSystemView class methodsFor:'startup'!
|
|
84 |
|
46
|
85 |
open
|
|
86 |
"create, realize the view - this topview and all its subviews will
|
|
87 |
run as a separate process with its own windowGroup"
|
|
88 |
|
|
89 |
^ self new open
|
|
90 |
!
|
|
91 |
|
0
|
92 |
start
|
12
|
93 |
"create, realize the view - this topview and all its subviews will
|
81
|
94 |
run as a separate process with its own windowGroup.
|
|
95 |
This method exists for backward compatibility - use open."
|
0
|
96 |
|
46
|
97 |
^ self open
|
0
|
98 |
! !
|
|
99 |
|
|
100 |
!StandardSystemView class methodsFor:'instance creation'!
|
|
101 |
|
|
102 |
model:aModel label:aLabel minimumSize:minExtent
|
81
|
103 |
"ST80-style instance creation"
|
|
104 |
|
0
|
105 |
|newView|
|
|
106 |
|
|
107 |
newView := self origin:nil
|
72
|
108 |
extent:minExtent
|
|
109 |
label:aLabel
|
|
110 |
icon:nil
|
|
111 |
minExtent:minExtent
|
|
112 |
maxExtent:nil.
|
0
|
113 |
newView model:aModel.
|
109
|
114 |
"/ newView controller:(self defaultControllerClass new view:newView).
|
0
|
115 |
^ newView
|
|
116 |
!
|
|
117 |
|
|
118 |
label:aLabel
|
|
119 |
"create a new topView and define its label"
|
|
120 |
|
|
121 |
^ self origin:nil extent:nil
|
72
|
122 |
label:aLabel icon:nil
|
|
123 |
minExtent:nil maxExtent:nil
|
0
|
124 |
!
|
|
125 |
|
|
126 |
label:aLabel minExtent:anExtent
|
81
|
127 |
"create a new topView and define its label and minimum extent"
|
|
128 |
|
0
|
129 |
^ self origin:nil extent:nil
|
72
|
130 |
label:aLabel icon:nil
|
|
131 |
minExtent:anExtent maxExtent:nil
|
0
|
132 |
!
|
|
133 |
|
|
134 |
label:aLabel icon:aForm
|
81
|
135 |
"create a new topView and define its label and icon"
|
|
136 |
|
0
|
137 |
^ self origin:nil extent:nil
|
72
|
138 |
label:aLabel icon:aForm
|
|
139 |
minExtent:nil maxExtent:nil
|
0
|
140 |
!
|
|
141 |
|
|
142 |
label:aLabel icon:aForm minExtent:anExtent
|
81
|
143 |
"create a new topView and define its label, icon and minumum extent"
|
|
144 |
|
0
|
145 |
^ self origin:nil extent:nil
|
72
|
146 |
label:aLabel icon:aForm
|
|
147 |
minExtent:anExtent maxExtent:nil
|
0
|
148 |
!
|
|
149 |
|
|
150 |
label:aLabel icon:aForm minExtent:minExtent maxExtent:maxExtent
|
81
|
151 |
"create a new topView and define its label, icon, min and max extents"
|
|
152 |
|
0
|
153 |
^ self origin:nil extent:nil
|
72
|
154 |
label:aLabel icon:aForm
|
|
155 |
minExtent:minExtent maxExtent:maxExtent
|
0
|
156 |
!
|
|
157 |
|
|
158 |
origin:anOrigin extent:anExtent label:aLabel
|
81
|
159 |
"create a new topView and define its origin, extent and label"
|
|
160 |
|
0
|
161 |
^ self origin:anOrigin extent:anExtent
|
72
|
162 |
label:aLabel icon:nil
|
|
163 |
minExtent:nil maxExtent:nil
|
0
|
164 |
!
|
|
165 |
|
|
166 |
origin:anOrigin label:aLabel icon:aForm
|
72
|
167 |
minExtent:minExtent maxExtent:maxExtent
|
81
|
168 |
"create a new topView and define its origin, extent, label, icon
|
|
169 |
and extent-boundaries."
|
|
170 |
|
0
|
171 |
^ self origin:anOrigin extent:nil
|
72
|
172 |
label:aLabel icon:aForm
|
|
173 |
minExtent:minExtent maxExtent:maxExtent
|
0
|
174 |
!
|
|
175 |
|
81
|
176 |
extent:anExtent label:aLabel minExtent:minExtent
|
|
177 |
"create a new topView and define its extent, label and minumum extent"
|
|
178 |
|
0
|
179 |
^ self origin:nil extent:anExtent
|
72
|
180 |
label:aLabel icon:nil
|
|
181 |
minExtent:minExtent maxExtent:nil
|
0
|
182 |
!
|
|
183 |
|
|
184 |
extent:anExtent label:aLabel icon:aForm
|
81
|
185 |
"create a new topView and define its extent, label and icon"
|
|
186 |
|
0
|
187 |
^ self origin:nil extent:anExtent
|
72
|
188 |
label:aLabel icon:aForm
|
|
189 |
minExtent:nil maxExtent:nil
|
0
|
190 |
!
|
|
191 |
|
81
|
192 |
extent:anExtent label:aLabel icon:aForm minExtent:minExtent
|
0
|
193 |
^ self origin:nil extent:anExtent
|
72
|
194 |
label:aLabel icon:aForm
|
|
195 |
minExtent:minExtent maxExtent:nil
|
0
|
196 |
!
|
|
197 |
|
81
|
198 |
extent:anExtent label:aLabel icon:aForm minExtent:minExtent maxExtent:maxExtent
|
0
|
199 |
^ self origin:nil extent:anExtent
|
72
|
200 |
label:aLabel icon:aForm
|
|
201 |
minExtent:minExtent maxExtent:maxExtent
|
0
|
202 |
! !
|
|
203 |
|
|
204 |
!StandardSystemView methodsFor:'initialization'!
|
|
205 |
|
|
206 |
initialize
|
|
207 |
super initialize.
|
|
208 |
|
81
|
209 |
borderWidth := 2. "- notice: many window managers ignore this"
|
0
|
210 |
minExtent := 10 @ 10.
|
81
|
211 |
maxExtent := (device width) @ (device height).
|
135
|
212 |
label isNil ifTrue:[label := self class defaultLabel].
|
110
|
213 |
icon isNil ifTrue:[icon := self class defaultIcon].
|
81
|
214 |
name := self class name.
|
0
|
215 |
!
|
|
216 |
|
89
|
217 |
initEvents
|
|
218 |
super initEvents.
|
|
219 |
self enableFocusEvents.
|
|
220 |
!
|
|
221 |
|
109
|
222 |
defaultControllerClass
|
46
|
223 |
"for ST-80 compatibility only - not used in ST/X"
|
|
224 |
|
89
|
225 |
^ nil "/ StandardSystemController
|
12
|
226 |
!
|
|
227 |
|
0
|
228 |
addToCurrentProject
|
46
|
229 |
"add the receiver (a topview) to the current projects set-of-views.
|
|
230 |
(If there is a current project)"
|
|
231 |
|
72
|
232 |
|p|
|
69
|
233 |
|
|
234 |
"
|
72
|
235 |
the following check allows systems
|
|
236 |
without projects and changeSets
|
69
|
237 |
"
|
72
|
238 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[
|
|
239 |
p addView: self
|
69
|
240 |
]
|
|
241 |
!
|
12
|
242 |
|
69
|
243 |
removeFromCurrentProject
|
|
244 |
"remove the receiver (a topview) from the current projects set-of-views.
|
|
245 |
(If there is a current project)"
|
|
246 |
|
72
|
247 |
|p|
|
69
|
248 |
|
|
249 |
"
|
72
|
250 |
the following check allows systems
|
|
251 |
without projects and changeSets
|
69
|
252 |
"
|
72
|
253 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[
|
|
254 |
p removeView:self
|
12
|
255 |
]
|
0
|
256 |
!
|
|
257 |
|
24
|
258 |
reinitialize
|
46
|
259 |
"reopen the receiver if if was visible before.
|
|
260 |
This is called right after snapIn; Notice, that all instance variables
|
72
|
261 |
(such as shown, realized etc.) are left-overs from the time the snapout
|
46
|
262 |
was done. Remap the receiver, if it was mapped at snapout time"
|
24
|
263 |
|
|
264 |
|myController|
|
|
265 |
|
|
266 |
"if I have already been reinited - return"
|
|
267 |
drawableId notNil ifTrue:[
|
72
|
268 |
^ self
|
24
|
269 |
].
|
|
270 |
|
46
|
271 |
"have to kludge with the controller
|
|
272 |
- otherwise its startup performs unwanted actions ..."
|
|
273 |
|
24
|
274 |
myController := controller.
|
|
275 |
controller := nil.
|
46
|
276 |
|
|
277 |
"physically create the view & subviews"
|
24
|
278 |
self recreate.
|
|
279 |
|
|
280 |
"if I was mapped, do it again"
|
|
281 |
realized ifTrue:[
|
72
|
282 |
"if it was iconified, try to remap iconified"
|
89
|
283 |
device mapView:self id:drawableId iconified:(shown not)
|
|
284 |
atX:left y:top width:width height:height.
|
24
|
285 |
|
72
|
286 |
"and restart the window-group process"
|
|
287 |
windowGroup notNil ifTrue:[
|
|
288 |
windowGroup restart
|
|
289 |
]
|
24
|
290 |
].
|
|
291 |
|
|
292 |
"restore controller"
|
|
293 |
controller := myController
|
|
294 |
!
|
|
295 |
|
0
|
296 |
recreate
|
|
297 |
"recreate the view after a snap-in"
|
|
298 |
|
24
|
299 |
icon := self convertedIcon.
|
|
300 |
super recreate.
|
46
|
301 |
|
24
|
302 |
iconView notNil ifTrue:[
|
72
|
303 |
iconView create.
|
|
304 |
device setWindowIconWindow:iconView in:drawableId
|
24
|
305 |
] ifFalse:[
|
72
|
306 |
(icon notNil and:[icon id notNil]) ifTrue:[
|
|
307 |
device setWindowIcon:icon in:drawableId
|
|
308 |
].
|
12
|
309 |
].
|
24
|
310 |
|
|
311 |
iconLabel notNil ifTrue:[
|
72
|
312 |
device setIconName:iconLabel in:drawableId
|
12
|
313 |
]
|
|
314 |
!
|
|
315 |
|
|
316 |
reAdjustGeometry
|
|
317 |
"when we come up on a smaller display,
|
|
318 |
make certain, that the receiver is visible"
|
|
319 |
|
94
|
320 |
|dX dY limitRight limitBottom|
|
12
|
321 |
|
|
322 |
dX := (device horizontalPixelPerMillimeter * 20) rounded.
|
|
323 |
dY := (device verticalPixelPerMillimeter * 20) rounded.
|
|
324 |
|
94
|
325 |
limitRight := device width - dX.
|
|
326 |
limitBottom := device height - dY.
|
|
327 |
((self left > limitRight) or:[
|
|
328 |
self top > limitBottom]) ifTrue:[
|
|
329 |
'moving view into visible area' errorPrintNL.
|
|
330 |
self origin:limitRight @ limitBottom
|
0
|
331 |
]
|
89
|
332 |
!
|
|
333 |
|
|
334 |
realize
|
|
335 |
super realize.
|
|
336 |
windowGroup notNil ifTrue:[
|
135
|
337 |
"/
|
|
338 |
"/ have to wait till now, since before I had no windowGroup
|
|
339 |
"/
|
|
340 |
windowGroup focusSequence:self focusSequence.
|
|
341 |
"/
|
|
342 |
"/ let the application add its views to the current project
|
|
343 |
"/
|
|
344 |
application notNil ifTrue:[
|
|
345 |
application opened.
|
|
346 |
] ifFalse:[
|
|
347 |
self addToCurrentProject.
|
|
348 |
].
|
89
|
349 |
]
|
|
350 |
!
|
|
351 |
|
|
352 |
focusSequence
|
|
353 |
"return a sequence which defines the order in which the focus
|
|
354 |
is passed for FocusNext and FocusPrevious keys.
|
|
355 |
All views which like to support these keys should redefine
|
125
|
356 |
this method and return a collection of (sub-) views.
|
|
357 |
Or, if the model is some applicationModel, it may itself define
|
|
358 |
the focusSequence.
|
|
359 |
Notice: I dont think this is good style: the focusSequence seems
|
|
360 |
to belong into the controller, ..."
|
89
|
361 |
|
135
|
362 |
"/
|
|
363 |
"/ if I have an application, its supposed to
|
|
364 |
"/ know about the focusSequence
|
|
365 |
"/
|
|
366 |
application notNil ifTrue:[
|
|
367 |
^ application focusSequence
|
|
368 |
].
|
|
369 |
|
125
|
370 |
(model notNil
|
|
371 |
and:[(model respondsTo:#focusSequence)
|
|
372 |
and:[model ~~ self]]) ifTrue:[
|
|
373 |
^ model focusSequence
|
|
374 |
].
|
89
|
375 |
^ nil
|
140
|
376 |
!
|
89
|
377 |
|
140
|
378 |
restarted
|
|
379 |
"sent by my windowGroup, when restarted from an image.
|
|
380 |
Nothing done here, but can be redefined to perform any actions
|
|
381 |
required to reset the application after an image-restart.
|
|
382 |
(for example: check if application files are still around, restart
|
|
383 |
subprocesses etc.)."
|
|
384 |
|
|
385 |
application notNil ifTrue:[
|
|
386 |
application restarted
|
|
387 |
].
|
0
|
388 |
! !
|
|
389 |
|
|
390 |
!StandardSystemView methodsFor:'destroying'!
|
|
391 |
|
135
|
392 |
terminate
|
|
393 |
application notNil ifTrue:[
|
|
394 |
application closeRequest
|
|
395 |
] ifFalse:[
|
|
396 |
super terminate
|
|
397 |
]
|
|
398 |
!
|
|
399 |
|
|
400 |
saveAndTerminate
|
|
401 |
application notNil ifTrue:[
|
|
402 |
application saveAndTerminateRequest
|
|
403 |
] ifFalse:[
|
|
404 |
super saveAndTerminate
|
|
405 |
]
|
|
406 |
!
|
|
407 |
|
0
|
408 |
destroy
|
132
|
409 |
self removeFromCurrentProject
|
|
410 |
windowGroup notNil ifTrue:[
|
|
411 |
windowGroup focusSequence:nil.
|
|
412 |
].
|
0
|
413 |
super destroy.
|
|
414 |
! !
|
|
415 |
|
24
|
416 |
!StandardSystemView methodsFor:'private'!
|
|
417 |
|
|
418 |
convertedIcon
|
|
419 |
"make certain, that the icon is a b&w bitmap;
|
72
|
420 |
do so by converting if required.
|
24
|
421 |
Will add a device supportsDeepIcons and only convert when needed;
|
72
|
422 |
for now, we always have to convert (since there are only Xdisplays)."
|
24
|
423 |
|
|
424 |
|deviceIcon|
|
|
425 |
|
|
426 |
icon isNil ifTrue:[^ nil].
|
|
427 |
|
81
|
428 |
device supportsDeepIcons ifFalse:[
|
|
429 |
icon depth ~~ 1 ifTrue:[
|
|
430 |
"
|
|
431 |
dither to monochrome
|
|
432 |
"
|
|
433 |
deviceIcon := icon asMonochromeFormOn:device.
|
|
434 |
] ifFalse:[
|
|
435 |
deviceIcon := icon
|
|
436 |
]
|
24
|
437 |
].
|
|
438 |
deviceIcon notNil ifTrue:[
|
81
|
439 |
"
|
|
440 |
get device pixmap (i.e. allocate colors & resource)
|
|
441 |
"
|
72
|
442 |
deviceIcon := deviceIcon on:device
|
24
|
443 |
].
|
|
444 |
^ deviceIcon
|
|
445 |
! !
|
|
446 |
|
0
|
447 |
!StandardSystemView methodsFor:'realization'!
|
|
448 |
|
46
|
449 |
physicalCreate
|
|
450 |
"common code for create & recreate"
|
|
451 |
|
|
452 |
drawableId := device
|
72
|
453 |
createWindowFor:self
|
|
454 |
origin:(left @ top)
|
|
455 |
extent:(width @ height)
|
|
456 |
minExtent:minExtent
|
|
457 |
maxExtent:maxExtent
|
|
458 |
borderWidth:borderWidth
|
|
459 |
subViewOf:nil
|
|
460 |
onTop:(self createOnTop)
|
|
461 |
inputOnly:(self inputOnly)
|
|
462 |
label:label
|
|
463 |
cursor:cursor
|
|
464 |
icon:icon
|
|
465 |
iconView:iconView.
|
46
|
466 |
|
|
467 |
extentChanged := false.
|
|
468 |
originChanged := false.
|
|
469 |
|
81
|
470 |
(borderColor notNil and:[borderColor ~~ Black]) ifTrue:[
|
|
471 |
borderColor := borderColor on:device.
|
|
472 |
self setBorderColor
|
72
|
473 |
].
|
81
|
474 |
|
|
475 |
"/ (viewGravity notNil "and:[viewGravity ~~ #NorthWest]") ifTrue:[
|
|
476 |
"/ device setWindowGravity:viewGravity in:drawableId
|
|
477 |
"/ ].
|
|
478 |
|
|
479 |
"/ (bitGravity notNil "and:[bitGravity ~~ #NorthWest]") ifTrue:[
|
|
480 |
"/ device setBitGravity:bitGravity in:drawableId
|
|
481 |
"/ ].
|
72
|
482 |
|
46
|
483 |
borderShape notNil ifTrue:[
|
72
|
484 |
device setWindowBorderShape:(borderShape id) in:drawableId
|
46
|
485 |
].
|
|
486 |
viewShape notNil ifTrue:[
|
72
|
487 |
device setWindowShape:(viewShape id) in:drawableId
|
46
|
488 |
].
|
|
489 |
(backed notNil and:[backed ~~ false]) ifTrue:[
|
72
|
490 |
device setBackingStore:backed in:drawableId
|
46
|
491 |
].
|
|
492 |
saveUnder ifTrue:[
|
72
|
493 |
device setSaveUnder:true in:drawableId
|
46
|
494 |
].
|
|
495 |
!
|
|
496 |
|
0
|
497 |
create
|
|
498 |
"create - make certain that icon is available"
|
|
499 |
|
24
|
500 |
icon := self convertedIcon.
|
2
|
501 |
super create.
|
12
|
502 |
|
2
|
503 |
iconView notNil ifTrue:[
|
72
|
504 |
iconView create.
|
|
505 |
device setWindowIconWindow:iconView in:drawableId
|
24
|
506 |
].
|
|
507 |
iconLabel notNil ifTrue:[
|
72
|
508 |
device setIconName:iconLabel in:drawableId
|
2
|
509 |
]
|
0
|
510 |
!
|
|
511 |
|
|
512 |
openWithExtent:anExtent
|
|
513 |
"set extent and open - for ST-80 compatibility"
|
|
514 |
|
|
515 |
self extent:anExtent.
|
|
516 |
self open
|
94
|
517 |
!
|
|
518 |
|
|
519 |
openWithPriority:aPriority
|
|
520 |
"open the view, run the windowgroup process at
|
135
|
521 |
other than UserScehdulingPriority."
|
94
|
522 |
|
|
523 |
self open.
|
|
524 |
windowGroup process priority:aPriority.
|
0
|
525 |
! !
|
|
526 |
|
72
|
527 |
!StandardSystemView methodsFor:'printing & storing'!
|
|
528 |
|
|
529 |
displayString
|
118
|
530 |
"just for your convenience in inspectors ...
|
|
531 |
... add the views label to the displayString."
|
72
|
532 |
|
|
533 |
|s|
|
|
534 |
|
|
535 |
s := super displayString.
|
118
|
536 |
label notNil ifTrue:[
|
72
|
537 |
s := s , '(' , label , ')'
|
|
538 |
].
|
|
539 |
^ s
|
69
|
540 |
! !
|
|
541 |
|
0
|
542 |
!StandardSystemView methodsFor:'accessing'!
|
|
543 |
|
|
544 |
label
|
|
545 |
"return the views name in the title area"
|
|
546 |
|
|
547 |
^ label
|
|
548 |
!
|
|
549 |
|
|
550 |
label:aString
|
|
551 |
"define the views name in the windows title area"
|
|
552 |
|
|
553 |
label := aString.
|
|
554 |
drawableId notNil ifTrue: [
|
72
|
555 |
device setWindowName:aString in:drawableId.
|
|
556 |
"
|
|
557 |
unbuffered - to make it visible right NOW
|
|
558 |
"
|
|
559 |
device synchronizeOutput.
|
0
|
560 |
]
|
|
561 |
!
|
|
562 |
|
24
|
563 |
iconLabel
|
|
564 |
"return the name displayed in the icon"
|
|
565 |
|
|
566 |
^ iconLabel
|
|
567 |
!
|
|
568 |
|
|
569 |
iconLabel:aString
|
|
570 |
"define the name to be displayed in the icon"
|
|
571 |
|
|
572 |
iconLabel := aString.
|
|
573 |
drawableId notNil ifTrue:[
|
72
|
574 |
device setIconName:aString in:drawableId.
|
|
575 |
"
|
|
576 |
unbuffered - to make it visible right NOW
|
|
577 |
"
|
|
578 |
device synchronizeOutput.
|
24
|
579 |
]
|
|
580 |
!
|
|
581 |
|
12
|
582 |
name
|
24
|
583 |
"return the topViews label"
|
|
584 |
|
12
|
585 |
^ label
|
|
586 |
!
|
|
587 |
|
0
|
588 |
icon
|
|
589 |
"return the form defined as icon"
|
|
590 |
|
|
591 |
^ icon
|
|
592 |
!
|
|
593 |
|
|
594 |
icon:aForm
|
|
595 |
"define the form (bitmap) used as icon"
|
|
596 |
|
24
|
597 |
|invertedIcon i|
|
12
|
598 |
|
0
|
599 |
icon := aForm.
|
12
|
600 |
icon notNil ifTrue:[
|
72
|
601 |
drawableId notNil ifTrue:[
|
|
602 |
icon depth ~~ 1 ifTrue:[
|
|
603 |
icon := icon asMonochromeFormOn:device.
|
|
604 |
].
|
|
605 |
"icons assume 1s as black - invert icon if the device thinks different"
|
|
606 |
(device depth == 1 and:[device whitepixel ~~ 0]) ifTrue:[
|
|
607 |
i := icon on:device.
|
|
608 |
i notNil ifTrue:[
|
|
609 |
invertedIcon := Form width:icon width height:icon height on:device.
|
|
610 |
invertedIcon function:#copy.
|
|
611 |
invertedIcon foreground:Color noColor background:Color allColor.
|
|
612 |
invertedIcon copyFrom:i x:0 y:0 toX:0 y:0 width:icon width height:icon height.
|
|
613 |
i := invertedIcon.
|
|
614 |
]
|
|
615 |
] ifFalse:[
|
|
616 |
i := icon on:device.
|
|
617 |
].
|
|
618 |
(i notNil and:[i id notNil]) ifTrue:[
|
|
619 |
device setWindowIcon:i in:drawableId
|
|
620 |
]
|
|
621 |
]
|
0
|
622 |
]
|
|
623 |
!
|
|
624 |
|
|
625 |
iconView
|
|
626 |
"return the view used as icon-view"
|
|
627 |
|
|
628 |
^ iconView
|
|
629 |
!
|
|
630 |
|
|
631 |
iconView:aView
|
|
632 |
"specify the view to be used as icon"
|
|
633 |
|
|
634 |
iconView := aView.
|
|
635 |
drawableId notNil ifTrue:[
|
72
|
636 |
aView create.
|
|
637 |
device setWindowIconWindow:aView in:drawableId
|
0
|
638 |
]
|
|
639 |
!
|
|
640 |
|
|
641 |
iconName:aString
|
24
|
642 |
"this method will vanish soon ... - for backward compatibility"
|
0
|
643 |
|
24
|
644 |
self iconLabel:aString
|
0
|
645 |
!
|
|
646 |
|
|
647 |
maximumSize:anExtent
|
24
|
648 |
"same as maxExtent: for ST-80 compatibility"
|
0
|
649 |
|
|
650 |
^ self maxExtent:anExtent
|
|
651 |
!
|
|
652 |
|
135
|
653 |
minimumSize
|
|
654 |
"same as minExtent for ST-80 compatibility"
|
|
655 |
|
|
656 |
^ self minExtent
|
|
657 |
!
|
|
658 |
|
0
|
659 |
minimumSize:anExtent
|
24
|
660 |
"same as minExtent: for ST-80 compatibility"
|
0
|
661 |
|
|
662 |
^ self minExtent:anExtent
|
|
663 |
!
|
|
664 |
|
|
665 |
minExtent
|
|
666 |
"return the views minimum allowed extent"
|
|
667 |
|
|
668 |
^ minExtent
|
|
669 |
!
|
|
670 |
|
|
671 |
minExtent:min
|
|
672 |
"define the minimum extent the view may have -
|
|
673 |
depends on good-will of window manager"
|
|
674 |
|
|
675 |
minExtent := min.
|
|
676 |
(width notNil and:[height notNil]) ifTrue:[
|
72
|
677 |
((width < (minExtent x)) or:
|
|
678 |
[height < (minExtent y)]) ifTrue: [
|
|
679 |
self extent:minExtent
|
|
680 |
]
|
0
|
681 |
]
|
|
682 |
!
|
|
683 |
|
|
684 |
maxExtent
|
|
685 |
"return the views maximum allowed extent"
|
|
686 |
|
|
687 |
^ maxExtent
|
|
688 |
!
|
|
689 |
|
|
690 |
maxExtent:max
|
|
691 |
"define the maximum extent the view may have -
|
|
692 |
depends on good-will of window manager"
|
|
693 |
|
|
694 |
maxExtent := max.
|
|
695 |
(width notNil and:[height notNil]) ifTrue:[
|
72
|
696 |
((width > (maxExtent x)) or:
|
|
697 |
[height > (maxExtent y)]) ifTrue: [
|
|
698 |
self extent:maxExtent
|
|
699 |
]
|
0
|
700 |
]
|
135
|
701 |
!
|
|
702 |
|
|
703 |
sizeFixed:aBoolean
|
|
704 |
"this prevents the view from resizing itself when realized.
|
|
705 |
For normal topViews, this is void, since they dont do this anyway.
|
|
706 |
However, modalBoxes typically resize themselfes to the preferedExtent
|
|
707 |
of their components, which can be turned off by setting sizeFixed to true."
|
|
708 |
|
|
709 |
sizeFixed := aBoolean
|
|
710 |
!
|
|
711 |
|
|
712 |
application
|
|
713 |
"return the topViews application.
|
|
714 |
This is new protocol for ST-80 compatibility and not yet fully supported"
|
|
715 |
|
|
716 |
^ application
|
|
717 |
!
|
|
718 |
|
|
719 |
application:anApplicationModel
|
|
720 |
"set the topViews application.
|
|
721 |
This is new protocol for ST-80 compatibility and not yet fully supported"
|
|
722 |
|
|
723 |
application := anApplicationModel
|
0
|
724 |
! !
|
89
|
725 |
|
|
726 |
!StandardSystemView methodsFor:'event handling'!
|
|
727 |
|
|
728 |
focusOut
|
|
729 |
"the view lost keyboard focus"
|
|
730 |
|
|
731 |
|v|
|
|
732 |
|
|
733 |
windowGroup notNil ifTrue:[
|
|
734 |
(v := windowGroup focusView) notNil ifTrue:[
|
|
735 |
v showNoFocus
|
|
736 |
]
|
|
737 |
].
|
|
738 |
!
|
|
739 |
|
|
740 |
focusIn
|
|
741 |
"the view got the keyboard focus"
|
|
742 |
|
|
743 |
|v|
|
|
744 |
|
|
745 |
windowGroup notNil ifTrue:[
|
|
746 |
(v := windowGroup focusView) notNil ifTrue:[
|
|
747 |
v showFocus
|
|
748 |
]
|
|
749 |
].
|
|
750 |
!
|
|
751 |
|
|
752 |
mapped
|
|
753 |
"the view got mapped"
|
|
754 |
|
|
755 |
super mapped.
|
|
756 |
"
|
|
757 |
ask for the focus - this avoids having to click on the
|
|
758 |
view with WM's which need an explicit click.
|
|
759 |
Q: is this a good idea ?
|
|
760 |
"
|
|
761 |
TakeFocusWhenMapped == true ifTrue:[
|
|
762 |
self getKeyboardFocus.
|
|
763 |
]
|
|
764 |
! !
|