19 WindowLabelFormat DefaultMinExtent' |
19 WindowLabelFormat DefaultMinExtent' |
20 poolDictionaries:'' |
20 poolDictionaries:'' |
21 category:'Views-Basic' |
21 category:'Views-Basic' |
22 ! |
22 ! |
23 |
23 |
24 !StandardSystemView class methodsFor:'documentation'! |
|
25 |
|
26 copyright |
|
27 " |
|
28 COPYRIGHT (c) 1989 by Claus Gittinger |
|
29 All Rights Reserved |
|
30 |
|
31 This software is furnished under a license and may be used |
|
32 only in accordance with the terms of that license and with the |
|
33 inclusion of the above copyright notice. This software may not |
|
34 be provided or otherwise made available to, or used by, any |
|
35 other person. No title to or ownership of the software is |
|
36 hereby transferred. |
|
37 " |
|
38 ! |
|
39 |
|
40 documentation |
|
41 " |
|
42 I represent standard application topViews |
|
43 i.e. those views which have a title-label, an icon etc. |
|
44 |
|
45 The name `StandardSystemView' is probably misleading and |
|
46 results from ST-80 (rel2.x) compatibility reasons. |
|
47 Think of it as an ApplicationWindow. |
|
48 |
|
49 |
|
50 In ST/X, StandardSystemViews were subclassed for special views |
|
51 in the past (for example: FileBrowser, ChangesBrowser etc.). |
|
52 Although this worked, it may lead to the following |
|
53 problems and inconveniences: |
|
54 - applications inherit a big number of methods through the |
|
55 SimpleView->View->TopView->StandardSystemView hierarchy. |
|
56 There is quite a danger that by accident, some method gets |
|
57 redefined which is required by one of those classes. |
|
58 (typical candidates are: terminate, destroy, open ...) |
|
59 This may lead to strange effects, which may not be obvious to |
|
60 non experts ... |
|
61 |
|
62 - applications with multiple topViews are difficult to implement |
|
63 and manage. |
|
64 |
|
65 - use of a windowBuilder is difficult. |
|
66 |
|
67 For all those reasons, we HIGHLY recommend to NOT define applications |
|
68 as subclasses of StandardSystemView, but instead base them on |
|
69 ApplicationModel, and reference the topView(s) as instance variables of |
|
70 if (if at all). |
|
71 |
|
72 [instance variables:] |
|
73 label <String> the label in the windows title |
|
74 |
|
75 icon <Form> the icon |
|
76 [ignored if the display does not |
|
77 support icons] |
|
78 |
|
79 iconView <View> an optional icon-view (for animated icons) |
|
80 [ignored if the display does not |
|
81 supports this] |
|
82 |
|
83 iconLabel <String> the label in the icon |
|
84 [ignored if the display does not |
|
85 support label-tabs with icons] |
|
86 |
|
87 minExtent <Point> the minimum size |
|
88 No limit, if nil |
|
89 [the window manager may have its own |
|
90 limit; typically some small area] |
|
91 |
|
92 maxExtent <Point> the maximum size |
|
93 No limit, if nil. |
|
94 [the window manager may have its own |
|
95 limit; typically the screen size] |
|
96 |
|
97 sizeFixed <Boolean> prevents the view from resizing itself |
|
98 (especially to freeze a dialogs size) |
|
99 |
|
100 application <AppModel> if nonNil, thats the application |
|
101 Many requests (such as open/close etc. |
|
102 are forwarded to it, if present. |
|
103 |
24 |
104 |
25 |
105 |
26 |
106 [class variables:] |
|
107 |
|
108 DefaultIcon <Form> cached default icon |
|
109 |
|
110 TakeFocusWhenMapped <Boolean> if true, views grab the keyboard |
|
111 focus (convenient with some stupid |
|
112 windowManagers) |
|
113 |
|
114 IncludeHostNameInLabel <Boolean> if true, the windows title shall |
|
115 include the hostname. |
|
116 (convenient if you have many remote |
|
117 views open simultaneously) |
|
118 |
|
119 WindowLabelFormat <Boolean> specifies the format for windowLabels |
|
120 |
27 |
121 |
28 |
122 [author:] |
|
123 Claus Gittinger |
|
124 |
|
125 [see also:] |
|
126 WindowGroup |
|
127 ApplicationModel |
|
128 " |
|
129 |
|
130 ! |
|
131 |
|
132 examples |
|
133 " |
|
134 simple, empty topView: |
|
135 [exBegin] |
|
136 |topView| |
|
137 |
|
138 topView := StandardSystemView new. |
|
139 topView label:'my first view'. |
|
140 topView extent:200 @ 200. |
|
141 topView open. |
|
142 [exEnd] |
|
143 |
|
144 with an icon & iconLabel: |
|
145 [exBegin] |
|
146 |topView| |
|
147 |
|
148 topView := StandardSystemView extent:200 @ 200. |
|
149 topView label:'Hello world'. |
|
150 |
|
151 topView icon:(Image fromFile:'hello_world.icon'). |
|
152 topView open. |
|
153 [exEnd] |
|
154 |
29 |
155 |
30 |
156 with an animated iconView [not supported on all display devices]: |
|
157 [exBegin] |
|
158 |iconView topView| |
|
159 |
|
160 iconView := ClockView new. |
|
161 |
|
162 topView := StandardSystemView extent:200 @ 200. |
|
163 topView label:'Hello world'. |
|
164 |
|
165 topView iconView:iconView. |
|
166 topView open. |
|
167 [exEnd] |
|
168 |
31 |
169 |
32 |
170 placing a subView into it: |
|
171 [exBegin] |
|
172 |topView button| |
|
173 |
|
174 topView := StandardSystemView new. |
|
175 topView label:'my second view'. |
|
176 topView extent:200 @ 200. |
|
177 |
|
178 button := Button label:'close' in:topView. |
|
179 button action:[topView destroy]. |
|
180 |
|
181 topView open. |
|
182 [exEnd] |
|
183 |
|
184 same, relative sized subview: |
|
185 [exBegin] |
|
186 |topView button| |
|
187 |
|
188 topView := StandardSystemView new. |
|
189 topView label:'my second view'. |
|
190 topView extent:200 @ 200. |
|
191 |
|
192 button := Button label:'close' in:topView. |
|
193 button action:[topView destroy]. |
|
194 button origin:0.25 @ 0.25 corner:0.75 @ 0.75. |
|
195 |
|
196 topView open. |
|
197 [exEnd] |
|
198 |
|
199 multiple buttons in a panel in a topView: |
|
200 [exBegin] |
|
201 |topView panel button1 button2 button3| |
|
202 |
|
203 topView := StandardSystemView new. |
|
204 topView label:'my second view'. |
|
205 topView extent:200 @ 200. |
|
206 |
|
207 panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:topView. |
|
208 panel inset:10. |
|
209 panel level:-1. |
|
210 |
|
211 button1 := Button label:'one' in:panel. |
|
212 button1 action:[Transcript showCR:'one pressed']. |
|
213 |
|
214 button2 := Button label:'two' in:panel. |
|
215 button2 action:[Transcript showCR:'two pressed']. |
|
216 |
|
217 button3 := Button label:'three' in:panel. |
|
218 button3 action:[Transcript showCR:'three pressed']. |
|
219 |
|
220 topView open. |
|
221 [exEnd] |
|
222 " |
|
223 ! ! |
|
224 |
|
225 !StandardSystemView class methodsFor:'instance creation'! |
|
226 |
|
227 extent:anExtent label:aLabel icon:aForm |
|
228 "create a new topView and define its extent, label and icon" |
|
229 |
|
230 ^ self origin:nil extent:anExtent |
|
231 label:aLabel icon:aForm |
|
232 minExtent:nil maxExtent:nil |
|
233 ! |
|
234 |
|
235 extent:anExtent label:aLabel icon:aForm minExtent:minExtent |
|
236 ^ self origin:nil extent:anExtent |
|
237 label:aLabel icon:aForm |
|
238 minExtent:minExtent maxExtent:nil |
|
239 ! |
|
240 |
|
241 extent:anExtent label:aLabel icon:aForm minExtent:minExtent maxExtent:maxExtent |
|
242 ^ self origin:nil extent:anExtent |
|
243 label:aLabel icon:aForm |
|
244 minExtent:minExtent maxExtent:maxExtent |
|
245 ! |
|
246 |
|
247 extent:anExtent label:aLabel minExtent:minExtent |
|
248 "create a new topView and define its extent, label and minumum extent" |
|
249 |
|
250 ^ self origin:nil extent:anExtent |
|
251 label:aLabel icon:nil |
|
252 minExtent:minExtent maxExtent:nil |
|
253 ! |
|
254 |
|
255 label:aLabel |
|
256 "create a new topView and define its label" |
|
257 |
|
258 ^ self origin:nil extent:nil |
|
259 label:aLabel icon:nil |
|
260 minExtent:nil maxExtent:nil |
|
261 ! |
|
262 |
|
263 label:aLabel icon:aForm |
|
264 "create a new topView and define its label and icon" |
|
265 |
|
266 ^ self origin:nil extent:nil |
|
267 label:aLabel icon:aForm |
|
268 minExtent:nil maxExtent:nil |
|
269 ! |
|
270 |
|
271 label:aLabel icon:aForm minExtent:anExtent |
|
272 "create a new topView and define its label, icon and minumum extent" |
|
273 |
|
274 ^ self origin:nil extent:nil |
|
275 label:aLabel icon:aForm |
|
276 minExtent:anExtent maxExtent:nil |
|
277 ! |
|
278 |
|
279 label:aLabel icon:aForm minExtent:minExtent maxExtent:maxExtent |
|
280 "create a new topView and define its label, icon, min and max extents" |
|
281 |
|
282 ^ self origin:nil extent:nil |
|
283 label:aLabel icon:aForm |
|
284 minExtent:minExtent maxExtent:maxExtent |
|
285 ! |
|
286 |
|
287 label:aLabel minExtent:anExtent |
|
288 "create a new topView and define its label and minimum extent" |
|
289 |
|
290 ^ self origin:nil extent:nil |
|
291 label:aLabel icon:nil |
|
292 minExtent:anExtent maxExtent:nil |
|
293 ! |
|
294 |
|
295 model:aModel label:aLabel minimumSize:minExtent |
|
296 "ST80-style instance creation" |
|
297 |
|
298 |newView| |
|
299 |
|
300 newView := self origin:nil |
|
301 extent:minExtent |
|
302 label:aLabel |
|
303 icon:nil |
|
304 minExtent:minExtent |
|
305 maxExtent:nil. |
|
306 newView model:aModel. |
|
307 "/ newView controller:(self defaultControllerClass new view:newView). |
|
308 ^ newView |
|
309 ! |
|
310 |
|
311 origin:anOrigin extent:anExtent label:aLabel |
|
312 "create a new topView and define its origin, extent and label" |
|
313 |
|
314 ^ self origin:anOrigin extent:anExtent |
|
315 label:aLabel icon:nil |
|
316 minExtent:nil maxExtent:nil |
|
317 ! |
|
318 |
|
319 origin:anOrigin label:aLabel icon:aForm |
|
320 minExtent:minExtent maxExtent:maxExtent |
|
321 "create a new topView and define its origin, extent, label, icon |
|
322 and extent-boundaries." |
|
323 |
|
324 ^ self origin:anOrigin extent:nil |
|
325 label:aLabel icon:aForm |
|
326 minExtent:minExtent maxExtent:maxExtent |
|
327 ! ! |
|
328 |
|
329 !StandardSystemView class methodsFor:'Compatibility-VW'! |
|
330 |
|
331 promptForOpen:aBoolean |
|
332 "not implemented here" |
|
333 ! ! |
|
334 |
|
335 !StandardSystemView class methodsFor:'class initialization'! |
|
336 |
|
337 initialize |
|
338 IncludeHostNameInLabel := false. |
|
339 WindowLabelFormat := self defaultWindowLabelFormat. |
|
340 |
|
341 TakeFocusWhenMapped := (Display notNil and:[Display platformName = 'WIN32']). |
|
342 |
|
343 "Created: / 20.8.1997 / 14:16:32 / cg" |
|
344 "Modified: / 24.8.1998 / 17:16:33 / cg" |
|
345 ! ! |
|
346 |
|
347 !StandardSystemView class methodsFor:'defaults'! |
|
348 |
|
349 defaultExtent |
|
350 "return a standardSystemViews default window extent" |
|
351 |
|
352 DefaultExtent notNil ifTrue:[ |
|
353 ^ DefaultExtent |
|
354 ]. |
|
355 ^ super defaultExtent |
|
356 |
|
357 "Created: 15.8.1997 / 01:36:21 / cg" |
|
358 ! |
|
359 |
|
360 defaultIcon |
|
361 "return a topViews default window icon" |
|
362 |
|
363 <resource: #style (#ICON #ICON_FILE)> |
|
364 |
|
365 |n nm i| |
|
366 |
|
367 (i := DefaultIcon) isNil ifTrue:[ |
|
368 i := self classResources at:'ICON' default:nil. |
|
369 i isNil ifTrue:[ |
|
370 "/ OperatingSystem platformName == #win32 ifTrue:[ |
|
371 "/ n := 'stx_16x16.xpm'. |
|
372 "/ ] ifFalse:[ |
|
373 "/ n := 'SmalltalkX.xbm'. |
|
374 "/ ]. |
|
375 nm := ClassResources at:'ICON_FILE' default:n. |
|
376 nm notNil ifTrue:[ |
|
377 i := Smalltalk imageFromFileNamed:nm inPackage:'stx:libtool'. |
|
378 ]. |
|
379 i isNil ifTrue:[ |
|
380 i := self defaultSTXIcon |
|
381 ]. |
|
382 ]. |
|
383 i notNil ifTrue:[ |
|
384 DefaultIcon := i := i onDevice:Display |
|
385 ] |
|
386 ]. |
|
387 ^ i |
|
388 |
|
389 " |
|
390 DefaultIcon := nil. |
|
391 self defaultIcon inspect |
|
392 " |
|
393 |
|
394 "Modified: / 25.5.1999 / 15:36:49 / cg" |
|
395 ! |
|
396 |
|
397 defaultLabel |
|
398 "return the default label for views of my kind. |
|
399 This can be redefined in subclasses or overwritten in |
|
400 initialize methods." |
|
401 |
|
402 ^ self nameWithoutPrefix. "/ 'aView' |
|
403 |
|
404 "Modified: / 27.9.1999 / 11:38:57 / cg" |
|
405 ! |
|
406 |
|
407 defaultWindowLabelFormat |
|
408 "%2 is the hostName; |
|
409 %1 is the actual window label." |
|
410 |
|
411 "/ ^ '%2:%1'. "/ the old format |
|
412 "/ ^ '%1 @ %2'. |
|
413 ^ '%1 [%2]'. |
|
414 ! |
|
415 |
|
416 includeHostNameInLabel |
|
417 "return the flag which controls if a views label should |
|
418 include the hostname. |
|
419 This flag is usually set/cleared in your private.rc file; |
|
420 the default is false." |
|
421 |
|
422 ^ IncludeHostNameInLabel |
|
423 |
|
424 "Created: 10.9.1995 / 19:21:16 / claus" |
|
425 ! |
|
426 |
|
427 includeHostNameInLabel:aBoolean |
|
428 "set/clear the flag which controls if a views label should |
|
429 include the hostname - this is highly useful if you have |
|
430 multiple smalltalks open simultaneously ... |
|
431 This flag is usually set/cleared in your private.rc file; |
|
432 the default is false." |
|
433 |
|
434 IncludeHostNameInLabel := aBoolean |
|
435 |
|
436 "Modified: 24.4.1996 / 09:09:21 / cg" |
|
437 ! |
|
438 |
|
439 takeFocusWhenMapped |
|
440 ^ TakeFocusWhenMapped |
|
441 |
|
442 " |
|
443 StandardSystemView takeFocusWhenMapped |
|
444 " |
|
445 ! |
|
446 |
|
447 updateStyleCache |
|
448 "extract values from the styleSheet and cache them in class variables" |
|
449 |
|
450 <resource: #style (#'standardSystemView.defaultExtent')> |
|
451 |
|
452 DefaultExtent := StyleSheet at:'standardSystemView.defaultExtent' default:nil. |
|
453 |
|
454 " |
|
455 self updateStyleCache |
|
456 " |
|
457 |
|
458 "Modified: 31.8.1995 / 03:01:14 / claus" |
|
459 "Created: 15.8.1997 / 01:34:37 / cg" |
|
460 "Modified: 20.10.1997 / 15:13:50 / cg" |
|
461 ! |
|
462 |
|
463 windowLabelFormat |
|
464 ^ WindowLabelFormat |
|
465 ! |
|
466 |
|
467 windowLabelFormat:aFormatString |
|
468 WindowLabelFormat := aFormatString |
|
469 ! ! |
|
470 |
|
471 !StandardSystemView class methodsFor:'image specs'! |
|
472 |
|
473 defaultSTXIcon |
|
474 <resource: #programImage> |
|
475 |
|
476 ^ self defaultSTXIcon3. |
|
477 ! |
|
478 |
|
479 defaultSTXIcon1 |
|
480 "This resource specification was automatically generated |
|
481 by the ImageEditor of ST/X." |
|
482 |
|
483 "Do not manually edit this!! If it is corrupted, |
|
484 the ImageEditor may not be able to read the specification." |
|
485 |
|
486 " |
|
487 self defaultSTXIcon1 inspect |
|
488 ImageEditor openOnClass:self andSelector:#defaultSTXIcon1 |
|
489 Icon flushCachedIcons |
|
490 " |
|
491 |
|
492 <resource: #image> |
|
493 |
|
494 ^Icon |
|
495 constantNamed:#'StandardSystemView class defaultSTXIcon1' |
|
496 ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#[2]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@E@@@@AP@D@@V@D@@APF@@@F&@@@AV@@@@&@@@@%P@@@&F@@@VBP@@V@I@@V@@P@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 0 127 127 184 231 231]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@X@A PGB@LX@_@A8@G@@<@GX@9 GC@8D@@@@@@b') ; yourself); yourself] |
|
497 ! |
|
498 |
|
499 defaultSTXIcon2 |
|
500 "This resource specification was automatically generated |
|
501 by the ImageEditor of ST/X." |
|
502 |
|
503 "Do not manually edit this!! If it is corrupted, |
|
504 the ImageEditor may not be able to read the specification." |
|
505 |
|
506 " |
|
507 self defaultSTXIcon2 inspect |
|
508 ImageEditor openOnClass:self andSelector:#defaultSTXIcon2 |
|
509 Icon flushCachedIcons |
|
510 " |
|
511 |
|
512 <resource: #image> |
|
513 |
|
514 ^Icon |
|
515 constantNamed:#'StandardSystemView class defaultSTXIcon2' |
|
516 ifAbsentPut:[(Depth8Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
517 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@HB@@@@@@@@@@@@@@@@@@@B@ @@@@@@@@H@@@@@@@@@@ H@@@@@@@H@@@@@@@@@@@@B@ @@ |
|
518 @@H@@@@@@@@@@@@@@@H@@@H@@@@@@@@@@@@@@@@B@ H@@@@@@@@@@@@@@@@@@@H@@@@@@@@@@@@@@@@@@@HB@ @@@@@@@@@@@@@@@@H@@@H@@@@@@@@@@@@@ |
|
519 @ H@@@@@@ @@@@@@@@@@@ H@@@@@@@@B@@@@@@@@@ H@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[184 231 231 63 63 63 0 127 127]; yourself] |
|
520 ! |
|
521 |
|
522 defaultSTXIcon3 |
|
523 "This resource specification was automatically generated |
|
524 by the ImageEditor of ST/X." |
|
525 |
|
526 "Do not manually edit this!! If it is corrupted, |
|
527 the ImageEditor may not be able to read the specification." |
|
528 |
|
529 " |
|
530 self defaultSTXIcon3 inspect |
|
531 ImageEditor openOnClass:self andSelector:#defaultSTXIcon3 |
|
532 Icon flushCachedIcons |
|
533 " |
|
534 |
|
535 <resource: #image> |
|
536 |
|
537 ^Icon |
|
538 constantNamed:#'StandardSystemView class defaultSTXIcon3' |
|
539 ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#[2]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@E@@@@AP@D@@V@D@@APF@@@FF@@@AV@@@@&@@@@%P@@@$F@@@T@X@@T@I@@T@@P@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 0 204 51 0 112 0]; yourself] |
|
540 ! ! |
|
541 |
|
542 !StandardSystemView class methodsFor:'startup'! |
|
543 |
|
544 start |
|
545 "create, realize the view - this topview and all its subviews will |
|
546 run as a separate process with its own windowGroup. |
|
547 This method exists for backward compatibility - use open." |
|
548 |
|
549 ^ self open |
|
550 ! ! |
|
551 |
|
552 !StandardSystemView methodsFor:'Compatibility-ST80'! |
|
553 |
|
554 maximumSize |
|
555 "same as maxExtent; for ST-80 compatibility" |
|
556 |
|
557 ^ self maxExtent |
|
558 ! |
|
559 |
|
560 maximumSize:anExtent |
|
561 "same as maxExtent; for ST-80 compatibility" |
|
562 |
|
563 ^ self maxExtent:anExtent |
|
564 ! |
|
565 |
|
566 menuBar |
|
567 "return my menuBar or nil if I have none. |
|
568 This is only valid for topViews which were built with the UIBuilder." |
|
569 |
|
570 ^ application builder menuBar |
|
571 |
|
572 "Created: / 27.10.1997 / 16:23:13 / cg" |
|
573 ! |
|
574 |
|
575 minimumSize |
|
576 "same as minExtent; for ST-80 compatibility" |
|
577 |
|
578 ^ self minExtent |
|
579 ! |
|
580 |
|
581 minimumSize:anExtent |
|
582 "same as minExtent; for ST-80 compatibility" |
|
583 |
|
584 ^ self minExtent:anExtent |
|
585 ! |
|
586 |
|
587 quit |
|
588 "same as closeRequest |
|
589 (but sometimes sent via the sensors event queue from VW programs)" |
|
590 |
|
591 self closeRequest |
|
592 |
|
593 "Created: / 30.10.1997 / 19:23:01 / cg" |
|
594 "Modified: / 3.8.1998 / 20:04:22 / cg" |
|
595 ! ! |
|
596 |
|
597 !StandardSystemView methodsFor:'accessing'! |
|
598 |
|
599 application |
|
600 "return the topViews application. |
|
601 This is new protocol for ST-80 compatibility and not yet fully supported" |
|
602 |
|
603 ^ application |
|
604 ! |
|
605 |
|
606 application:anApplicationModel |
|
607 "set the topViews application. |
|
608 This is new protocol for ST-80 compatibility and not yet fully supported" |
|
609 |
|
610 application := anApplicationModel. |
|
611 anApplicationModel notNil ifTrue:[ |
|
612 anApplicationModel window isNil ifTrue:[ |
|
613 anApplicationModel window:self |
|
614 ] |
|
615 ] |
|
616 |
|
617 "Modified: 18.4.1996 / 14:55:44 / cg" |
|
618 ! ! |
|
619 |
|
620 !StandardSystemView methodsFor:'accessing-behavior'! |
|
621 |
|
622 bePartner |
|
623 "define me as a partner-View. |
|
624 All partners within the applications windowGroup iconify/deiconify together." |
|
625 |
|
626 self setWindowGroupFromApplication. |
|
627 super bePartner. |
|
628 |
|
629 " |
|
630 see example in TopView>>bePartner |
|
631 " |
|
632 |
|
633 "Created: 22.9.1995 / 17:40:15 / claus" |
|
634 "Modified: 6.3.1996 / 16:16:42 / cg" |
|
635 ! |
|
636 |
|
637 beSlave |
|
638 "define me as a slave-View. |
|
639 All slaves within the applications windowGroup iconify/deiconify with the masterView(s) |
|
640 (i.e. they follow their master(s))" |
|
641 |
|
642 self setWindowGroupFromApplication. |
|
643 super beSlave. |
|
644 |
|
645 " |
|
646 see example in TopView>>beSlave |
|
647 " |
|
648 |
|
649 "Created: 22.9.1995 / 17:40:15 / claus" |
|
650 "Modified: 6.3.1996 / 16:16:50 / cg" |
|
651 ! |
|
652 |
|
653 sendWindowEvents:collectionOfEventSymbols |
|
654 "define the events that are to be forwarded to the application. |
|
655 This is being implemented ..." |
|
656 |
|
657 windowEventsForApplication := collectionOfEventSymbols |
|
658 ! |
|
659 |
|
660 sizeFixed:aBoolean |
|
661 "this prevents the view from resizing itself when realized. |
|
662 For normal topViews, this is void, since they dont do this anyway. |
|
663 |
|
664 However, modalBoxes (especially: DialogBoxes) typically resize themselfes |
|
665 to the preferredExtent of their components. In some cases, this behavior is |
|
666 not desired and it should be turned off by setting sizeFixed to true. |
|
667 |
|
668 To avoid confusion: |
|
669 This does NOT prevent the window manager from resizing the view, |
|
670 instead it tells the view to NOT resize ITSELF." |
|
671 |
|
672 sizeFixed := aBoolean. |
|
673 |
|
674 "example: dialog which resizes itself on #open: |
|
675 (thereby ignoring the 200@200 extent) |
|
676 |
|
677 |dialog| |
|
678 |
|
679 dialog := Dialog new. |
|
680 dialog addInputFieldOn:'' asValue. |
|
681 dialog addOkButton. |
|
682 dialog extent:200@200. |
|
683 dialog open. |
|
684 |
33 |
685 |
34 |
686 using sizeFixed: |
|
687 |
|
688 |dialog| |
|
689 |
|
690 dialog := Dialog new. |
|
691 dialog addInputFieldOn:'' asValue. |
|
692 dialog addOkButton. |
|
693 dialog extent:200@200; sizeFixed:true. |
|
694 dialog open. |
|
695 |
35 |
696 |
36 |
697 using openWithExtent (also sets sizeFixed): |
|
698 |
37 |
699 |dialog| |
|
700 |
38 |
701 dialog := Dialog new. |
|
702 dialog addInputFieldOn:'' asValue. |
|
703 dialog addOkButton. |
|
704 dialog openWithExtent:200@200. |
|
705 " |
|
706 ! ! |
|
707 |
39 |
708 !StandardSystemView methodsFor:'accessing-channels'! |
|
709 |
40 |
710 labelChannel |
|
711 "return the labelChannel - or nil" |
|
712 |
41 |
713 ^ labelChannel. |
|
714 ! |
|
715 |
42 |
716 labelChannel:aValueHolder |
|
717 "set the labelChannel - a valueHolder holding a string |
|
718 which is shown as title bar" |
|
719 |
43 |
720 |prev| |
|
721 |
44 |
722 prev := labelChannel. |
|
723 labelChannel := aValueHolder. |
|
724 self setupChannel:aValueHolder for:nil withOld:prev. |
|
725 ! ! |
|
726 |
|
727 !StandardSystemView methodsFor:'accessing-dimensions'! |
|
728 |
|
729 maxExtent |
|
730 "return the views maximum allowed extent" |
|
731 |
|
732 ^ maxExtent |
|
733 ! |
|
734 |
|
735 maxExtent:max |
|
736 "define the maximum extent the view may have - |
|
737 depends on good-will of window manager" |
|
738 |
|
739 maxExtent ~= max ifTrue:[ |
|
740 maxExtent := max. |
|
741 maxExtent x isNil ifTrue:[ |
|
742 maxExtent := 99999 @ maxExtent y. |
|
743 ]. |
|
744 maxExtent y isNil ifTrue:[ |
|
745 maxExtent := maxExtent x @ 99999. |
|
746 ]. |
|
747 |
|
748 drawableId notNil ifTrue:[ |
|
749 device setWindowMinExtent:nil maxExtent:max in:drawableId |
|
750 ]. |
|
751 |
|
752 "/ if my current extent is larger than the new |
|
753 "/ maxExtent, adjust. |
|
754 |
|
755 (width notNil and:[height notNil]) ifTrue:[ |
|
756 ((width > (max x)) or: |
|
757 [height > (max y)]) ifTrue: [ |
|
758 self extent:(max min:self extent) |
|
759 ] |
|
760 ] |
|
761 ]. |
|
762 ! |
|
763 |
|
764 minExtent |
|
765 "return the views minimum allowed extent" |
|
766 |
|
767 ^ minExtent |
|
768 ! |
|
769 |
|
770 minExtent:min |
|
771 "define the minimum extent the view may have - |
|
772 depends on good-will of window manager" |
|
773 |
|
774 minExtent ~= min ifTrue:[ |
|
775 minExtent := min. |
|
776 drawableId notNil ifTrue:[ |
|
777 device setWindowMinExtent:min maxExtent:nil in:drawableId |
|
778 ]. |
|
779 |
|
780 "/ if my current extent is smaller than the new |
|
781 "/ minExtent, adjust. |
|
782 |
|
783 (width notNil and:[height notNil]) ifTrue:[ |
|
784 ((width < (min x)) or: |
|
785 [height < (min y)]) ifTrue: [ |
|
786 self extent:(min max:self extent) |
|
787 ] |
|
788 ] |
|
789 ] |
|
790 |
|
791 ! ! |
|
792 |
|
793 !StandardSystemView methodsFor:'accessing-look'! |
|
794 |
|
795 icon |
|
796 "return the form defined as icon" |
|
797 |
|
798 ^ icon value |
|
799 ! |
|
800 |
|
801 icon:aFormOrImage |
|
802 "define the form or image (bitmap) used as icon" |
|
803 |
|
804 |i m iconValue| |
|
805 |
|
806 icon := aFormOrImage. |
|
807 iconValue := icon value. |
|
808 iconValue notNil ifTrue:[ |
|
809 drawableId notNil ifTrue:[ |
|
810 i := self convertedIcon:iconValue. |
|
811 (i notNil and:[i id notNil]) ifTrue:[ |
|
812 (m := iconValue mask) notNil ifTrue:[ |
|
813 m := self convertedIconMask:m. |
|
814 ]. |
|
815 device setWindowIcon:i mask:m in:drawableId |
|
816 ] |
|
817 ] |
|
818 ] |
|
819 |
|
820 "Modified: 4.4.1997 / 16:20:52 / cg" |
|
821 ! |
|
822 |
|
823 iconLabel |
|
824 "return the name displayed in the icon" |
|
825 |
|
826 ^ iconLabel |
|
827 ! |
|
828 |
|
829 iconLabel:aString |
|
830 "define the name to be displayed in the icon" |
|
831 |
|
832 |newLabel| |
|
833 |
|
834 (newLabel := aString string) ~= iconLabel ifTrue:[ |
|
835 iconLabel := newLabel. |
|
836 drawableId notNil ifTrue:[ |
|
837 device setIconName:newLabel in:drawableId. |
|
838 " |
|
839 unbuffered - to make it visible right NOW |
|
840 " |
|
841 device flush. |
|
842 ] |
|
843 ] |
|
844 ! |
|
845 |
|
846 iconMask |
|
847 "return the form defined as iconMask. |
|
848 Notice, that many windowManagers ignore this mask |
|
849 (usually, only managers which place icons on the background desktop |
|
850 care for an icon - if at all ...)" |
|
851 |
|
852 |mask| |
|
853 |
|
854 "/ only images possibly have iconMasks |
|
855 icon notNil ifTrue:[ |
|
856 (mask := icon value mask) notNil ifTrue:[ |
|
857 ^ self convertedIconMask:mask |
|
858 ] |
|
859 ]. |
|
860 |
|
861 ^ nil |
|
862 |
|
863 "Modified: 4.4.1997 / 16:39:00 / cg" |
|
864 ! |
|
865 |
|
866 iconName:aString |
|
867 "this method will vanish soon ... - for backward compatibility" |
|
868 |
|
869 <resource:#obsolete> |
|
870 |
|
871 self obsoleteMethodWarning:'use #iconLabel:'. |
|
872 self iconLabel:aString |
|
873 ! |
|
874 |
|
875 iconView |
|
876 "return the view used as icon-view" |
|
877 |
|
878 ^ iconView |
|
879 ! |
|
880 |
|
881 iconView:aView |
|
882 "specify the view to be used as icon. |
|
883 This may not be supported on all display types" |
|
884 |
|
885 iconView := aView. |
|
886 drawableId notNil ifTrue:[ |
|
887 aView create. |
|
888 device setWindowIconWindow:aView in:drawableId. |
|
889 aView setRealized:true. |
|
890 ] |
|
891 |
|
892 "Modified: 4.4.1997 / 16:21:37 / cg" |
|
893 ! |
|
894 |
|
895 label |
|
896 "return the views name in the title area" |
|
897 |
|
898 ^ label |
|
899 ! |
|
900 |
|
901 label:aString |
|
902 "define the views name in the windows title area. |
|
903 If IncludeHostNameInLabel is true, prepend the hostname |
|
904 (you will appreciate this, if you are working on multiple |
|
905 machines simultaneously - as I do ...)" |
|
906 |
|
907 |newLabel| |
|
908 |
|
909 (newLabel := aString string) ~= label ifTrue:[ |
|
910 label := newLabel. |
|
911 drawableId notNil ifTrue: [ |
|
912 device setWindowName:(self windowLabelFor:label) in:drawableId. |
|
913 shown ifTrue:[ |
|
914 " |
|
915 unbuffered - to make it visible right NOW |
|
916 " |
|
917 device flush. |
|
918 ] |
|
919 ] |
|
920 ] |
|
921 |
|
922 "Created: / 8.9.1995 / 19:37:06 / claus" |
|
923 "Modified: / 8.9.1995 / 19:39:18 / claus" |
|
924 "Modified: / 3.8.1998 / 17:05:10 / cg" |
|
925 ! |
|
926 |
|
927 label:labelString iconLabel:iconLabelString |
|
928 "set both the label and the iconLabel" |
|
929 |
|
930 self label:labelString. |
|
931 self iconLabel:iconLabelString |
|
932 ! ! |
|
933 |
|
934 !StandardSystemView methodsFor:'change & update'! |
|
935 |
|
936 update:something with:aParameter from:changedObject |
|
937 "the MVC way of changing the label ..." |
|
938 |
|
939 changedObject notNil ifTrue:[ |
|
940 changedObject == labelChannel ifTrue:[ |
|
941 self label:labelChannel value. |
|
942 ^ self |
|
943 ]. |
|
944 ]. |
|
945 ^ super update:something with:aParameter from:changedObject |
|
946 ! ! |
|
947 |
|
948 !StandardSystemView methodsFor:'destroying'! |
|
949 |
|
950 release |
|
951 self removeFromCurrentProject. |
|
952 labelChannel notNil ifTrue:[ |
|
953 labelChannel removeDependent:self. |
|
954 labelChannel := nil. |
|
955 ]. |
|
956 windowGroup notNil ifTrue:[ |
|
957 windowGroup focusSequence:nil. |
|
958 ]. |
|
959 super release. |
|
960 ! |
|
961 |
|
962 saveAndTerminate |
|
963 "save & terminate request from the windowManager. The application should |
|
964 save its data/files/text etc. somehow and close. |
|
965 If there is an application, let it decide how do do that. |
|
966 Otherwise, forward it to superclasses which knows how to do this. |
|
967 (it defaults to a terminate there). |
|
968 Notice, that not all windowmanagers are nice enough |
|
969 to send this request; some simply distroy the view." |
|
970 |
|
971 application notNil ifTrue:[ |
|
972 application saveAndTerminateRequestFor:self |
|
973 ] ifFalse:[ |
|
974 super saveAndTerminate |
|
975 ] |
|
976 ! |
|
977 |
|
978 terminate |
|
979 "terminate request from the windowManager. If there is an application, |
|
980 let it decide if it really wants to be close. Otherwise, forward it to |
|
981 superclasses terminate which knows how to do this. |
|
982 Notice, that not all windowmanagers are nice enough |
|
983 to send this request; some simply distroy the view." |
|
984 |
|
985 application notNil ifTrue:[ |
|
986 application closeRequestFor:self |
|
987 ] ifFalse:[ |
|
988 self closeRequest. |
|
989 ] |
|
990 |
|
991 "Modified: / 3.8.1998 / 19:49:45 / cg" |
|
992 ! ! |
|
993 |
|
994 !StandardSystemView methodsFor:'event handling'! |
|
995 |
|
996 focusIn |
|
997 "the view got the keyboard focus (via the window manager). |
|
998 I.e. the mouse was moved out into the topView area - restore the |
|
999 focus to the previous focusView.." |
|
1000 |
|
1001 |v| |
|
1002 |
|
1003 windowGroup notNil ifTrue:[ |
|
1004 "/ I got the focus - tell the current focus-windowgroup |
|
1005 "/ that its focus is gone elsewhere ... |
|
1006 "/ 'focusIn ' print. windowGroup process name printCR. |
|
1007 "/ 'focusView is ' print. windowGroup focusView printCR. |
|
1008 |
|
1009 WindowGroup takeFocusFromDevice:device. |
|
1010 |
|
1011 v := windowGroup focusView. |
|
1012 v isNil ifTrue:[ |
|
1013 UserPreferences current focusFollowsMouse ~~ false ifTrue:[ |
|
1014 v := windowGroup pointerView. |
|
1015 "/ 'pointerView is ' print. v printCR. |
|
1016 (v notNil |
|
1017 and:[v isKeyboardConsumer not |
|
1018 and:[v wantsFocusWithPointerEnter not]]) ifTrue:[ |
|
1019 "/ no - not this one |
|
1020 "/ 'not a kbdConsumer' printCR. |
|
1021 v := nil. |
|
1022 ] |
|
1023 ] |
|
1024 ]. |
|
1025 v isNil ifTrue:[ |
|
1026 self assignInitialKeyboardFocus. |
|
1027 ] ifFalse:[ |
|
1028 "/ v requestFocus. - will be denied; but we must force it here |
|
1029 windowGroup focusView:v byTab:false. |
|
1030 ] |
|
1031 ]. |
|
1032 super focusIn |
|
1033 |
|
1034 "Modified: / 23.5.1999 / 14:00:20 / cg" |
|
1035 ! |
|
1036 |
|
1037 focusOut |
|
1038 "the top-view lost the keyboard focus (via the window manager). |
|
1039 I.e. the mouse was moved out of the topView area." |
|
1040 |
|
1041 |v| |
|
1042 |
|
1043 windowGroup notNil ifTrue:[ |
|
1044 (v := windowGroup focusView) notNil ifTrue:[ |
|
1045 v showNoFocus:(windowGroup explicitFocusView == v). |
|
1046 v hasKeyboardFocus:false. |
|
1047 ] |
|
1048 ]. |
|
1049 super focusOut |
|
1050 |
|
1051 "Modified: 25.2.1997 / 23:19:46 / cg" |
|
1052 ! |
|
1053 |
|
1054 showActivity:someMessage |
|
1055 "some activityNotification shalt be communicated to |
|
1056 the user. Forward it to my application (if any). |
|
1057 (that one should know how to deal with it). |
|
1058 Otherwise, simply ignore it." |
|
1059 |
|
1060 application notNil ifTrue:[ |
|
1061 application showActivity:someMessage |
|
1062 ] |
|
1063 |
|
1064 "Created: 16.12.1995 / 18:40:44 / cg" |
|
1065 "Modified: 23.4.1996 / 21:38:11 / cg" |
|
1066 ! ! |
|
1067 |
|
1068 !StandardSystemView methodsFor:'initialization & release'! |
|
1069 |
|
1070 addToCurrentProject |
|
1071 "add the receiver (a topview) to the current projects set-of-views. |
|
1072 (If there is a current project)" |
|
1073 |
|
1074 |p| |
|
1075 |
|
1076 " |
|
1077 the following check allows systems |
|
1078 without projects and changeSets |
|
1079 " |
|
1080 (Project notNil and:[(p := Project current) notNil]) ifTrue:[ |
|
1081 p addView: self |
|
1082 ] |
|
1083 ! |
|
1084 |
|
1085 defaultControllerClass |
|
1086 "for ST-80 compatibility only - not used in ST/X" |
|
1087 |
|
1088 ^ nil "/ StandardSystemController |
|
1089 ! |
|
1090 |
|
1091 initEvents |
|
1092 super initEvents. |
|
1093 self enableFocusEvents. |
|
1094 ! |
|
1095 |
|
1096 initialize |
|
1097 super initialize. |
|
1098 |
|
1099 borderWidth := 2. "- notice: many window managers ignore this" |
|
1100 device platformName = 'WIN32' ifTrue:[ |
|
1101 minExtent := 0 @ 0. |
|
1102 ] ifFalse:[ |
|
1103 minExtent := 10 @ 10. |
|
1104 ]. |
|
1105 |
|
1106 "/ This code is bad for 2 reasons: |
|
1107 "/ - KDE (3.2) WM does not show the maximize button if the maxExtent is restricted. |
|
1108 "/ - why restrict the size of a window? |
|
1109 "/ maxExtent := device usableExtent "- (0 @ device captionHeight)". |
|
1110 |
|
1111 label isNil ifTrue:[label := self class defaultLabel]. |
|
1112 icon isNil ifTrue:[icon := self class defaultIcon]. |
|
1113 |
|
1114 "Modified: 14.6.1996 / 17:18:28 / stefan" |
|
1115 ! |
|
1116 |
|
1117 reAdjustGeometry |
|
1118 "sent as a final step when an image is restarted. |
|
1119 when we come up on a smaller display, |
|
1120 make certain, that the receiver is visible" |
|
1121 |
|
1122 |dX dY limitRight limitBottom| |
|
1123 |
|
1124 dX := (device horizontalPixelPerMillimeter * 20) rounded. |
|
1125 dY := (device verticalPixelPerMillimeter * 20) rounded. |
|
1126 |
|
1127 limitRight := device usableWidth - dX. |
|
1128 limitBottom := device usableHeight - dY. |
|
1129 ((self left > limitRight) or:[ |
|
1130 self top > limitBottom]) ifTrue:[ |
|
1131 'StandardSystemView [info]: moving view into visible area' infoPrintCR. |
|
1132 self origin:limitRight @ limitBottom |
|
1133 ] |
|
1134 |
|
1135 "Modified: 10.1.1997 / 15:12:19 / cg" |
|
1136 ! |
|
1137 |
|
1138 reinitialize |
|
1139 "reopen the receiver if if was visible before. |
|
1140 This is called right after snapIn; Notice, that all instance variables |
|
1141 (such as shown, realized etc.) are left-overs from the time the snapout |
|
1142 was done. Remap the receiver, if it was mapped at snapout time" |
|
1143 |
|
1144 |myController| |
|
1145 |
|
1146 "if I have already been reinited - return" |
|
1147 drawableId notNil ifTrue:[ |
|
1148 ^ self |
|
1149 ]. |
|
1150 |
|
1151 "have to kludge with the controller |
|
1152 - otherwise its startup performs unwanted actions ..." |
|
1153 |
|
1154 myController := controller. |
|
1155 controller := nil. |
|
1156 |
|
1157 "physically create the view & subviews" |
|
1158 self recreate. |
|
1159 |
|
1160 "if I was iconified (not realized), remap iconified" |
|
1161 device |
|
1162 mapView:self id:drawableId iconified:(realized "shown" not) |
|
1163 atX:left y:top width:width height:height |
|
1164 minExtent:minExtent maxExtent:maxExtent. |
|
1165 |
|
1166 "and restart the window-group process" |
|
1167 windowGroup notNil ifTrue:[ |
|
1168 windowGroup restart |
|
1169 ]. |
|
1170 |
|
1171 "restore controller" |
|
1172 controller := myController |
|
1173 |
|
1174 "Modified: / 6.5.1999 / 09:50:13 / cg" |
|
1175 ! |
|
1176 |
|
1177 removeFromCurrentProject |
|
1178 "remove the receiver (a topview) from the current projects set-of-views. |
|
1179 (If there is a current project)" |
|
1180 |
|
1181 |p| |
|
1182 |
|
1183 " |
|
1184 the following check allows systems |
|
1185 without projects and changeSets |
|
1186 " |
|
1187 (Project notNil and:[(p := Project current) notNil]) ifTrue:[ |
|
1188 p removeView:self |
|
1189 ] |
|
1190 ! |
|
1191 |
|
1192 restarted |
|
1193 "sent by my windowGroup, when restarted from an image. |
|
1194 Nothing done here, but can be redefined to perform any actions |
|
1195 required to reset the application after an image-restart. |
|
1196 (for example: check if application files are still around, restart |
|
1197 subprocesses etc.)." |
|
1198 |
|
1199 application notNil ifTrue:[ |
|
1200 application restarted |
|
1201 ]. |
|
1202 ! ! |
|
1203 |
|
1204 !StandardSystemView methodsFor:'printing & storing'! |
|
1205 |
|
1206 displayString |
|
1207 "just for your convenience in inspectors ... |
|
1208 ... add the views label to the displayString." |
|
1209 |
|
1210 |s| |
|
1211 |
|
1212 s := super displayString. |
|
1213 label notNil ifTrue:[ |
|
1214 s := s , '(' , label , ')' |
|
1215 ]. |
|
1216 ^ s |
|
1217 ! ! |
|
1218 |
|
1219 !StandardSystemView methodsFor:'private'! |
|
1220 |
|
1221 convertedIcon |
|
1222 "make certain, that the icon is compatible with my device; |
|
1223 this means converting it to a format (typically: monochrome) which |
|
1224 the device supports. Return a compatible version of the icon." |
|
1225 |
|
1226 ^ self convertedIcon:icon |
|
1227 |
|
1228 "Modified: 10.6.1996 / 19:42:20 / cg" |
|
1229 ! |
|
1230 |
|
1231 convertedIcon:iconArg |
|
1232 "make certain, that the image argument is compatible with my device; |
|
1233 this means converting it to a format (typically: monochrome) which |
|
1234 the device supports. Return a compatible version of the icon." |
|
1235 |
|
1236 |deviceIcon d toMono toDeep icon| |
|
1237 |
|
1238 icon := iconArg value. |
|
1239 icon isNil ifTrue:[^ nil]. |
|
1240 |
|
1241 toMono := toDeep := false. |
|
1242 |
|
1243 d := icon depth. |
|
1244 device supportsDeepIcons ifFalse:[ |
|
1245 (d ~~ 1 or:[icon isImage]) ifTrue:[ |
|
1246 " |
|
1247 dither to monochrome |
|
1248 " |
|
1249 toMono := true. |
|
1250 ] |
|
1251 ] ifTrue:[ |
|
1252 d == 1 ifTrue:[ |
|
1253 icon colorMap notNil ifTrue:[ |
|
1254 icon isImage ifFalse:[ |
|
1255 toMono := true. |
|
1256 ] ifTrue:[ |
|
1257 toDeep := true. |
|
1258 ] |
|
1259 ] |
|
1260 ] ifFalse:[ |
|
1261 d ~~ device depth ifTrue:[ |
|
1262 icon isImage ifFalse:[ |
|
1263 toMono := true. |
|
1264 ] ifTrue:[ |
|
1265 toDeep := true. |
|
1266 ] |
|
1267 ] |
|
1268 ] |
|
1269 ]. |
|
1270 |
|
1271 deviceIcon := icon. |
|
1272 toMono ifTrue:[ |
|
1273 deviceIcon := icon asMonochromeFormOn:device. |
|
1274 ]. |
|
1275 toDeep ifTrue:[ |
|
1276 deviceIcon := (Image implementorForDepth:device depth) |
|
1277 fromImage:icon. |
|
1278 ]. |
|
1279 |
|
1280 deviceIcon notNil ifTrue:[ |
|
1281 " |
|
1282 get device pixmap (i.e. allocate colors & resource) |
|
1283 " |
|
1284 deviceIcon := deviceIcon onDevice:device |
|
1285 ]. |
|
1286 ^ deviceIcon |
|
1287 |
|
1288 "Created: 10.6.1996 / 19:41:31 / cg" |
|
1289 "Modified: 17.6.1997 / 11:46:44 / cg" |
|
1290 ! |
|
1291 |
|
1292 convertedIconMask:aMask |
|
1293 "return a version of the argument which can be used as an iconMask |
|
1294 on my device. Typically, this means conversion to a monochrome |
|
1295 mask - future versions may add alpha channel masks, if the device supports |
|
1296 them ..." |
|
1297 |
|
1298 device supportsIconMasks ifFalse:[^ nil]. |
|
1299 |
|
1300 aMask depth ~~ 1 ifTrue:[ |
|
1301 ^ aMask asMonochromeFormOn:device |
|
1302 ]. |
|
1303 ^ aMask |
|
1304 |
|
1305 "Modified: / 28.4.1999 / 20:00:00 / cg" |
|
1306 ! |
|
1307 |
|
1308 setWindowGroupFromApplication |
|
1309 "get the applications topView and set my windowGroup to its wg." |
|
1310 |
|
1311 |win master| |
|
1312 |
|
1313 windowGroup isNil ifTrue:[ |
|
1314 application notNil ifTrue:[ |
|
1315 (win := application window) notNil ifTrue:[ |
|
1316 win ~~ self ifTrue:[ |
|
1317 windowGroup := win windowGroup. |
|
1318 ^ self |
|
1319 ]. |
|
1320 (master := application masterApplication) notNil ifTrue:[ |
|
1321 (win := master window) notNil ifTrue:[ |
|
1322 windowGroup := win windowGroup. |
|
1323 ^ self |
|
1324 ]. |
|
1325 ]. |
|
1326 ] |
|
1327 ] |
|
1328 ]. |
|
1329 |
|
1330 "Created: 22.9.1995 / 17:40:36 / claus" |
|
1331 "Modified: 6.3.1996 / 16:17:32 / cg" |
|
1332 ! |
|
1333 |
|
1334 windowLabelFor:labelString |
|
1335 "return an expanded labelString, according to the hostName-in-window setting. |
|
1336 The labelString may include positional parameters: |
|
1337 %1 - the actual label |
|
1338 %2 - the hostname |
|
1339 %3 - the userName |
|
1340 %4 - the processId |
|
1341 %5 - the TOP-directories name |
|
1342 %6 - the TOP-directories path |
|
1343 " |
|
1344 |
|
1345 |wg proc id pidString lbl windowLabelFormat| |
|
1346 |
|
1347 (IncludeHostNameInLabel == true |
|
1348 and:[(windowLabelFormat := self class windowLabelFormat) notNil]) ifTrue:[ |
|
1349 (wg := self windowGroup) notNil ifTrue:[ |
|
1350 (proc := wg process) notNil ifTrue:[ |
|
1351 (id := proc id) notNil ifTrue:[ |
|
1352 pidString := id printString |
|
1353 ] |
|
1354 ] |
|
1355 ]. |
|
1356 lbl := windowLabelFormat |
|
1357 bindWith:labelString |
|
1358 with:[OperatingSystem getHostName] |
|
1359 with:[OperatingSystem getLoginName] |
|
1360 with:pidString |
|
1361 with:[(Smalltalk getPackageDirectoryForPackage:'stx') directory baseName] |
|
1362 with:[(Smalltalk getPackageDirectoryForPackage:'stx') directory pathName]. |
|
1363 ^ lbl |
|
1364 ]. |
|
1365 ^ labelString |
|
1366 |
|
1367 "Created: / 22-09-1997 / 10:10:32 / cg" |
|
1368 "Modified: / 22-08-2006 / 11:42:53 / cg" |
|
1369 ! ! |
|
1370 |
|
1371 !StandardSystemView methodsFor:'queries'! |
|
1372 |
|
1373 focusSequence |
|
1374 "return a sequence which defines the order in which the focus |
|
1375 is passed for FocusNext and FocusPrevious keys. |
|
1376 |
|
1377 All views which like to support these keys should either redefine |
|
1378 this method and return a collection of (sub-) views. |
|
1379 Or, if the model is some applicationModel, it may itself define |
|
1380 the focusSequence. |
|
1381 Or, somehow let me (via focusSequence:) know about the order. |
|
1382 |
|
1383 Notice: I dont think this is good style: the focusSequence seems |
|
1384 to belong into the controller or the builder ..." |
|
1385 |
|
1386 "/ |
|
1387 "/ if I have an application, its supposed to |
|
1388 "/ know about the focusSequence |
|
1389 "/ |
|
1390 application notNil ifTrue:[ |
|
1391 ^ application focusSequence |
|
1392 ]. |
|
1393 |
|
1394 "/ is that really a good idea ? |
|
1395 |
|
1396 (model notNil |
|
1397 and:[(model respondsTo:#focusSequence) |
|
1398 and:[model ~~ self]]) ifTrue:[ |
|
1399 ^ model focusSequence |
|
1400 ]. |
|
1401 ^ nil |
|
1402 |
|
1403 "Modified: / 31.10.1997 / 19:14:02 / cg" |
|
1404 ! |
|
1405 |
|
1406 processName |
|
1407 "return a string to be shown for my process in the |
|
1408 process monitor. This has no semantic meaning, but exists |
|
1409 for your convenience only." |
|
1410 |
|
1411 application notNil ifTrue:[ |
|
1412 ^ application processName |
|
1413 ]. |
|
1414 label notNil ifTrue:[^ label]. |
|
1415 ^ super processName |
|
1416 |
|
1417 "Modified: 24.4.1996 / 09:47:01 / cg" |
|
1418 ! ! |
|
1419 |
|
1420 !StandardSystemView methodsFor:'realization'! |
|
1421 |
|
1422 collapse |
|
1423 "iconify the receiver" |
|
1424 |
|
1425 shown ifTrue:[ |
|
1426 self unmap. |
|
1427 |
|
1428 "if it was iconified, try to remap iconified" |
|
1429 device |
|
1430 mapView:self id:drawableId iconified:true |
|
1431 atX:left y:top width:width height:height |
|
1432 minExtent:minExtent maxExtent:maxExtent. |
|
1433 shown := false. |
|
1434 ]. |
|
1435 |
|
1436 " |
|
1437 |top| |
|
1438 |
|
1439 top := StandardSystemView new. |
|
1440 top label:'hello'. |
|
1441 top openAndWait. |
|
1442 Delay waitForSeconds:2. |
|
1443 top collapse. |
|
1444 Delay waitForSeconds:2. |
|
1445 top expand. |
|
1446 " |
|
1447 |
|
1448 "Modified: 24.7.1997 / 12:32:17 / cg" |
|
1449 ! |
|
1450 |
|
1451 create |
|
1452 "create - make certain that icon is available" |
|
1453 |
|
1454 super create. |
|
1455 |
|
1456 iconView notNil ifTrue:[ |
|
1457 iconView create. |
|
1458 device setWindowIconWindow:iconView in:drawableId. |
|
1459 iconView setRealized:true. |
|
1460 ]. |
|
1461 iconLabel notNil ifTrue:[ |
|
1462 device setIconName:iconLabel string in:drawableId |
|
1463 ] |
|
1464 |
|
1465 "Modified: 10.6.1996 / 20:14:50 / cg" |
|
1466 ! |
|
1467 |
|
1468 expand |
|
1469 "de-iconify the receiver at its old position" |
|
1470 |
|
1471 shown ifFalse:[ |
|
1472 self unmap. |
|
1473 |
|
1474 "if it was iconified, try to remap iconified" |
|
1475 device |
|
1476 mapView:self id:drawableId iconified:false |
|
1477 atX:left y:top width:width height:height |
|
1478 minExtent:minExtent maxExtent:maxExtent. |
|
1479 ]. |
|
1480 |
|
1481 " |
|
1482 |top| |
|
1483 |
|
1484 top := StandardSystemView new. |
|
1485 top label:'hello'. |
|
1486 top openAndWait. |
|
1487 top collapse. |
|
1488 Delay waitForSeconds:5. |
|
1489 top expand. |
|
1490 " |
|
1491 |
|
1492 "Modified: / 3.2.1998 / 16:02:56 / cg" |
|
1493 ! |
|
1494 |
|
1495 physicalCreate |
|
1496 "common code for create & recreate" |
|
1497 |
|
1498 |lbl iconValue icn icnMask windowClassNameString| |
|
1499 |
|
1500 lbl := self windowLabelFor:label. |
|
1501 |
|
1502 icon notNil ifTrue:[ |
|
1503 iconValue := icon value. |
|
1504 icn := self convertedIcon:iconValue. |
|
1505 (icnMask := iconValue mask) notNil ifTrue:[ |
|
1506 icnMask := self convertedIconMask:icnMask |
|
1507 ]. |
|
1508 deviceIcon := icn. |
|
1509 ]. |
|
1510 |
|
1511 "/ give global eventListeners a chance to intercept windowCreation |
|
1512 "/ and provide another origin (by payching my origin via setOrigin:). |
|
1513 WindowSensor preViewCreateNotification:self. |
|
1514 |
|
1515 drawableId := device |
|
1516 createWindowFor:self |
|
1517 type:(self windowType) |
|
1518 origin:(left @ top) |
|
1519 extent:(width @ height) |
|
1520 minExtent:minExtent |
|
1521 maxExtent:maxExtent |
|
1522 borderWidth:borderWidth |
|
1523 subViewOf:nil |
|
1524 style:(self windowStyle) |
|
1525 inputOnly:(self isInputOnly) |
|
1526 label:lbl |
|
1527 owner:nil |
|
1528 icon:icn iconMask:icnMask |
|
1529 iconView:iconView. |
|
1530 |
|
1531 Lobby registerChange:self. |
|
1532 |
|
1533 "/ give global listeners a chance to track views |
|
1534 WindowSensor postViewCreateNotification:self. |
|
1535 |
|
1536 self extentChangedFlag:false. |
|
1537 self originChangedFlag:false. |
|
1538 |
|
1539 (borderColor notNil and:[borderColor ~= Black]) ifTrue:[ |
|
1540 self setBorderColor |
|
1541 ]. |
|
1542 |
|
1543 "/ (viewGravity notNil "and:[viewGravity ~~ #NorthWest]") ifTrue:[ |
|
1544 "/ device setWindowGravity:viewGravity in:drawableId |
|
1545 "/ ]. |
|
1546 |
|
1547 "/ (bitGravity notNil "and:[bitGravity ~~ #NorthWest]") ifTrue:[ |
|
1548 "/ device setBitGravity:bitGravity in:drawableId |
|
1549 "/ ]. |
|
1550 |
|
1551 viewShape notNil ifTrue:[ |
|
1552 self setViewShape |
|
1553 ]. |
|
1554 |
|
1555 (backed notNil and:[backed ~~ false]) ifTrue:[ |
|
1556 device setBackingStore:backed in:drawableId |
|
1557 ]. |
|
1558 self saveUnder ifTrue:[ |
|
1559 device setSaveUnder:true in:drawableId |
|
1560 ]. |
|
1561 cursor notNil ifTrue:[ |
|
1562 self setCursor |
|
1563 ]. |
|
1564 |
|
1565 application isNil ifTrue:[ |
|
1566 (self class == StandardSystemView and:[subViews size == 1]) ifTrue:[ |
|
1567 "This is a subclass of SimpleView wrapped into a StandardSystemView" |
|
1568 windowClassNameString := subViews first className. |
|
1569 ] ifFalse:[ |
|
1570 windowClassNameString := self className. |
|
1571 ] |
|
1572 ] ifFalse:[ |
|
1573 windowClassNameString := application className. |
|
1574 ]. |
|
1575 self setWindowClass:('Stx.', windowClassNameString) name:"name"'bla'. |
|
1576 |
|
1577 "Modified: 14.6.1996 / 17:14:25 / stefan" |
|
1578 "Modified: 22.9.1997 / 10:11:16 / cg" |
|
1579 ! |
|
1580 |
|
1581 postRealize |
|
1582 "postRealize actions - tell the application (if any)." |
|
1583 |
|
1584 super postRealize. |
|
1585 "/ |
|
1586 "/ let the application add its views to the current project |
|
1587 "/ |
|
1588 application notNil ifTrue:[ |
|
1589 application opened:self. |
|
1590 ] ifFalse:[ |
|
1591 self addToCurrentProject. |
|
1592 ]. |
|
1593 |
|
1594 "Created: 24.7.1997 / 18:11:26 / cg" |
|
1595 ! |
|
1596 |
|
1597 preRealize |
|
1598 "invoked right before the view is realized. |
|
1599 preRealize actions - tell the application (if any)." |
|
1600 |
|
1601 super preRealize. |
|
1602 |
|
1603 application notNil ifTrue:[ |
|
1604 application aboutToOpen:self. |
|
1605 ]. |
|
1606 ! |
|
1607 |
|
1608 recreate |
|
1609 "recreate the view after a snap-in or a migration" |
|
1610 |
|
1611 super recreate. |
|
1612 |
|
1613 iconView notNil ifTrue:[ |
|
1614 iconView recreate. |
|
1615 device setWindowIconWindow:iconView in:drawableId. |
|
1616 iconView setRealized:true. |
|
1617 ] ifFalse:[ |
|
1618 icon notNil ifTrue:[ |
|
1619 self icon:(self convertedIcon:icon). |
|
1620 ]. |
|
1621 ]. |
|
1622 |
|
1623 iconLabel notNil ifTrue:[ |
|
1624 device setIconName:iconLabel in:drawableId |
|
1625 ] |
|
1626 |
|
1627 "Modified: 4.4.1997 / 16:16:40 / cg" |
|
1628 ! ! |
|
1629 |
|
1630 !StandardSystemView class methodsFor:'documentation'! |
|
1631 |
|
1632 version |
|
1633 ^ '$Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.168 2006-08-22 09:42:59 cg Exp $' |
|
1634 ! ! |
|
1635 |
45 |
1636 StandardSystemView initialize! |
46 StandardSystemView initialize! |