8 be provided or otherwise made available to, or used by, any |
8 be provided or otherwise made available to, or used by, any |
9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 |
12 |
13 View subclass:#StandardSystemView |
13 TopView subclass:#StandardSystemView |
14 instanceVariableNames:'label icon iconView iconLabel |
14 instanceVariableNames:'label icon iconView iconLabel |
15 minExtent maxExtent' |
15 minExtent maxExtent sizeFixed |
|
16 application' |
16 classVariableNames: 'DefaultIcon TakeFocusWhenMapped' |
17 classVariableNames: 'DefaultIcon TakeFocusWhenMapped' |
17 poolDictionaries:'' |
18 poolDictionaries:'' |
18 category:'Views-Basic' |
19 category:'Views-Basic' |
19 ! |
20 ! |
20 |
21 |
21 StandardSystemView comment:' |
22 StandardSystemView comment:' |
22 COPYRIGHT (c) 1989 by Claus Gittinger |
23 COPYRIGHT (c) 1989 by Claus Gittinger |
23 All Rights Reserved |
24 All Rights Reserved |
24 |
25 |
25 $Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.22 1995-04-02 11:10:48 claus Exp $ |
26 $Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.23 1995-05-03 00:25:28 claus Exp $ |
26 '! |
27 '! |
27 |
28 |
28 !StandardSystemView class methodsFor:'documentation'! |
29 !StandardSystemView class methodsFor:'documentation'! |
29 |
30 |
30 copyright |
31 copyright |
75 "return the default icon for views. |
70 "return the default icon for views. |
76 This can be redefined in subclasses or overwritten in |
71 This can be redefined in subclasses or overwritten in |
77 initialize methods." |
72 initialize methods." |
78 |
73 |
79 DefaultIcon isNil ifTrue:[ |
74 DefaultIcon isNil ifTrue:[ |
80 DefaultIcon := Image fromFile:'bitmaps/SmalltalkX.xbm'. |
75 DefaultIcon := Image fromFile:'SmalltalkX.xbm'. |
81 DefaultIcon notNil ifTrue:[ |
76 DefaultIcon notNil ifTrue:[ |
82 DefaultIcon := DefaultIcon on:Display |
77 DefaultIcon := DefaultIcon on:Display |
83 ] |
78 ] |
84 ]. |
79 ]. |
85 ^ DefaultIcon |
80 ^ DefaultIcon |
207 ! ! |
202 ! ! |
208 |
203 |
209 !StandardSystemView methodsFor:'initialization'! |
204 !StandardSystemView methodsFor:'initialization'! |
210 |
205 |
211 initialize |
206 initialize |
212 |screenCenter| |
|
213 |
|
214 super initialize. |
207 super initialize. |
215 |
208 |
216 self addToCurrentProject. |
|
217 |
|
218 screenCenter := device center. |
|
219 left := screenCenter x - (width // 2). |
|
220 top := screenCenter y - (height // 2). |
|
221 borderWidth := 2. "- notice: many window managers ignore this" |
209 borderWidth := 2. "- notice: many window managers ignore this" |
222 label isNil ifTrue:[label := self class defaultLabel]. |
|
223 minExtent := 10 @ 10. |
210 minExtent := 10 @ 10. |
224 maxExtent := (device width) @ (device height). |
211 maxExtent := (device width) @ (device height). |
|
212 label isNil ifTrue:[label := self class defaultLabel]. |
225 icon isNil ifTrue:[icon := self class defaultIcon]. |
213 icon isNil ifTrue:[icon := self class defaultIcon]. |
226 name := self class name. |
214 name := self class name. |
227 ! |
215 ! |
228 |
216 |
229 initEvents |
217 initEvents |
344 ! |
332 ! |
345 |
333 |
346 realize |
334 realize |
347 super realize. |
335 super realize. |
348 windowGroup notNil ifTrue:[ |
336 windowGroup notNil ifTrue:[ |
349 windowGroup focusSequence:(self focusSequence) |
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 ]. |
350 ] |
349 ] |
351 ! |
350 ! |
352 |
351 |
353 focusSequence |
352 focusSequence |
354 "return a sequence which defines the order in which the focus |
353 "return a sequence which defines the order in which the focus |
358 Or, if the model is some applicationModel, it may itself define |
357 Or, if the model is some applicationModel, it may itself define |
359 the focusSequence. |
358 the focusSequence. |
360 Notice: I dont think this is good style: the focusSequence seems |
359 Notice: I dont think this is good style: the focusSequence seems |
361 to belong into the controller, ..." |
360 to belong into the controller, ..." |
362 |
361 |
|
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 |
363 (model notNil |
370 (model notNil |
364 and:[(model respondsTo:#focusSequence) |
371 and:[(model respondsTo:#focusSequence) |
365 and:[model ~~ self]]) ifTrue:[ |
372 and:[model ~~ self]]) ifTrue:[ |
366 ^ model focusSequence |
373 ^ model focusSequence |
367 ]. |
374 ]. |
368 ^ nil |
375 ^ nil |
369 |
376 |
370 ! ! |
377 ! ! |
371 |
378 |
372 !StandardSystemView methodsFor:'destroying'! |
379 !StandardSystemView methodsFor:'destroying'! |
|
380 |
|
381 terminate |
|
382 application notNil ifTrue:[ |
|
383 application closeRequest |
|
384 ] ifFalse:[ |
|
385 super terminate |
|
386 ] |
|
387 ! |
|
388 |
|
389 saveAndTerminate |
|
390 application notNil ifTrue:[ |
|
391 application saveAndTerminateRequest |
|
392 ] ifFalse:[ |
|
393 super saveAndTerminate |
|
394 ] |
|
395 ! |
373 |
396 |
374 destroy |
397 destroy |
375 self removeFromCurrentProject |
398 self removeFromCurrentProject |
376 windowGroup notNil ifTrue:[ |
399 windowGroup notNil ifTrue:[ |
377 windowGroup focusSequence:nil. |
400 windowGroup focusSequence:nil. |
482 self open |
505 self open |
483 ! |
506 ! |
484 |
507 |
485 openWithPriority:aPriority |
508 openWithPriority:aPriority |
486 "open the view, run the windowgroup process at |
509 "open the view, run the windowgroup process at |
487 other than UserScehdulingPriority" |
510 other than UserScehdulingPriority." |
488 |
511 |
489 self open. |
512 self open. |
490 windowGroup process priority:aPriority. |
513 windowGroup process priority:aPriority. |
491 ! ! |
|
492 |
|
493 !StandardSystemView methodsFor:'misc'! |
|
494 |
|
495 withWaitCursorDo:aBlock |
|
496 "evaluate aBlock while showing a waitCursor in all my views" |
|
497 |
|
498 self withCursor:(Cursor wait) do:aBlock |
|
499 ! |
|
500 |
|
501 withCursor:aCursor do:aBlock |
|
502 "evaluate aBlock while showing aCursor in all my views" |
|
503 |
|
504 windowGroup notNil ifTrue:[ |
|
505 windowGroup withCursor:aCursor do:aBlock |
|
506 ] ifFalse:[ |
|
507 super withCursor:aCursor do:aBlock |
|
508 ] |
|
509 ! ! |
514 ! ! |
510 |
515 |
511 !StandardSystemView methodsFor:'printing & storing'! |
516 !StandardSystemView methodsFor:'printing & storing'! |
512 |
517 |
513 displayString |
518 displayString |
522 ]. |
527 ]. |
523 ^ s |
528 ^ s |
524 ! ! |
529 ! ! |
525 |
530 |
526 !StandardSystemView methodsFor:'accessing'! |
531 !StandardSystemView methodsFor:'accessing'! |
527 |
|
528 preferedExtent |
|
529 "return my preferred extent - this is the minimum size I would like to have. |
|
530 The default here is the classes default extent." |
|
531 |
|
532 ^ self class defaultExtent |
|
533 ! |
|
534 |
|
535 heightIncludingBorder |
|
536 "return the views overall-height" |
|
537 |
|
538 ^ height |
|
539 ! |
|
540 |
|
541 widthIncludingBorder |
|
542 "return the views overall-width" |
|
543 |
|
544 ^ width |
|
545 ! |
|
546 |
532 |
547 label |
533 label |
548 "return the views name in the title area" |
534 "return the views name in the title area" |
549 |
535 |
550 ^ label |
536 ^ label |
693 ((width > (maxExtent x)) or: |
685 ((width > (maxExtent x)) or: |
694 [height > (maxExtent y)]) ifTrue: [ |
686 [height > (maxExtent y)]) ifTrue: [ |
695 self extent:maxExtent |
687 self extent:maxExtent |
696 ] |
688 ] |
697 ] |
689 ] |
|
690 ! |
|
691 |
|
692 sizeFixed:aBoolean |
|
693 "this prevents the view from resizing itself when realized. |
|
694 For normal topViews, this is void, since they dont do this anyway. |
|
695 However, modalBoxes typically resize themselfes to the preferedExtent |
|
696 of their components, which can be turned off by setting sizeFixed to true." |
|
697 |
|
698 sizeFixed := aBoolean |
|
699 ! |
|
700 |
|
701 application |
|
702 "return the topViews application. |
|
703 This is new protocol for ST-80 compatibility and not yet fully supported" |
|
704 |
|
705 ^ application |
|
706 ! |
|
707 |
|
708 application:anApplicationModel |
|
709 "set the topViews application. |
|
710 This is new protocol for ST-80 compatibility and not yet fully supported" |
|
711 |
|
712 application := anApplicationModel |
698 ! ! |
713 ! ! |
699 |
714 |
700 !StandardSystemView methodsFor:'event handling'! |
715 !StandardSystemView methodsFor:'event handling'! |
701 |
716 |
702 focusOut |
717 focusOut |