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