1 " |
1 " |
2 COPYRIGHT (c) 1995 by Claus Gittinger |
2 COPYRIGHT (c) 1995 by Claus Gittinger |
3 All Rights Reserved |
3 All Rights Reserved |
4 |
4 |
5 This software is furnished under a license and may be used |
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 |
6 only in accordance with the terms of that license and with the |
7 inclusion of the above copyright notice. This software may not |
7 inclusion of the above copyright notice. This software may not |
8 be provided or otherwise made available to, or used by, any |
8 be provided or otherwise made available to, or used by, any |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 "{ Package: 'stx:libview' }" |
12 "{ Package: 'stx:libview' }" |
13 |
13 |
14 View subclass:#TopView |
14 View subclass:#TopView |
15 instanceVariableNames:'type iconified keyboardProcessor' |
15 instanceVariableNames:'type iconified keyboardProcessor' |
16 classVariableNames:'TakeFocusWhenMapped ForceModalBoxesToOpenAtCenter |
16 classVariableNames:'TakeFocusWhenMapped ForceModalBoxesToOpenAtCenter |
17 ForceModalBoxesToOpenAtPointer MasterSlaveMask WindowTypeMask |
17 ForceModalBoxesToOpenAtPointer MasterSlaveMask WindowTypeMask |
18 TypeMaster TypeSlave TypePartner TypeDialog TypePopUp |
18 TypeMaster TypeSlave TypePartner TypeDialog TypePopUp |
19 TypeUndecorated TypeToolWindow TypeToolDialog MDIClientMask |
19 TypeUndecorated TypeToolWindow TypeToolDialog MDIClientMask |
20 MDIClient TypeScreenDialog CurrentWindowMoved |
20 MDIClient TypeScreenDialog CurrentWindowMoveStart |
21 CurrentWindowMoveStart CurrentWindowMoveState' |
21 CurrentWindowMoveState CurrentWindowBeingMoved' |
22 poolDictionaries:'' |
22 poolDictionaries:'' |
23 category:'Views-Basic' |
23 category:'Views-Basic' |
24 ! |
24 ! |
25 |
25 |
26 !TopView class methodsFor:'documentation'! |
26 !TopView class methodsFor:'documentation'! |
27 |
27 |
28 copyright |
28 copyright |
29 " |
29 " |
30 COPYRIGHT (c) 1995 by Claus Gittinger |
30 COPYRIGHT (c) 1995 by Claus Gittinger |
31 All Rights Reserved |
31 All Rights Reserved |
32 |
32 |
33 This software is furnished under a license and may be used |
33 This software is furnished under a license and may be used |
34 only in accordance with the terms of that license and with the |
34 only in accordance with the terms of that license and with the |
35 inclusion of the above copyright notice. This software may not |
35 inclusion of the above copyright notice. This software may not |
36 be provided or otherwise made available to, or used by, any |
36 be provided or otherwise made available to, or used by, any |
46 |
46 |
47 Do not get confused by the name TopView - your applications |
47 Do not get confused by the name TopView - your applications |
48 topViews are typically instances of StandardSystemView. |
48 topViews are typically instances of StandardSystemView. |
49 |
49 |
50 [instance variables:] |
50 [instance variables:] |
51 type <Integer> encodes master/slave relationship: |
51 type <Integer> encodes master/slave relationship: |
52 #normal, #master, #slave or #partner |
52 #normal, #master, #slave or #partner |
53 for modeless views |
53 for modeless views |
54 (the #master-, #slave- or #partner-type links multiple views |
54 (the #master-, #slave- or #partner-type links multiple views |
55 into a windowManagers windowGroup -> for de-iconification) |
55 into a windowManagers windowGroup -> for de-iconification) |
56 |
56 |
57 encodes window type: |
57 encodes window type: |
58 #normal, #dialog, #popup, #undecorated |
58 #normal, #dialog, #popup, #undecorated |
59 |
59 |
60 [see also:] |
60 [see also:] |
61 StandardSystemView PopUpView DialogBox |
61 StandardSystemView PopUpView DialogBox |
62 ( introduction to view programming :html: programming/viewintro.html ) |
62 ( introduction to view programming :html: programming/viewintro.html ) |
63 |
63 |
64 [author:] |
64 [author:] |
65 Claus Gittinger |
65 Claus Gittinger |
66 " |
66 " |
67 ! |
67 ! |
68 |
68 |
69 examples |
69 examples |
70 " |
70 " |
74 |
74 |
75 The bahavior is controlled by ST/X, and controlled by the open vs. openModeless vs. openModal message. |
75 The bahavior is controlled by ST/X, and controlled by the open vs. openModeless vs. openModal message. |
76 |
76 |
77 Modeless: |
77 Modeless: |
78 regular style: |
78 regular style: |
79 [exBegin] |
79 [exBegin] |
80 |v| |
80 |v| |
81 |
81 |
82 v := TopView new. |
82 v := TopView new. |
83 v extent:200@200. |
83 v extent:200@200. |
84 v open |
84 v open |
85 [exEnd] |
85 [exEnd] |
86 |
86 |
87 dialog: |
87 dialog: |
88 [exBegin] |
88 [exBegin] |
89 |v| |
89 |v| |
90 |
90 |
91 v := TopView new. |
91 v := TopView new. |
92 v beDialogView. |
92 v beDialogView. |
93 v extent:200@200. |
93 v extent:200@200. |
94 v open |
94 v open |
95 Delay waitForSeconds:10. v destroy. |
95 Delay waitForSeconds:10. v destroy. |
96 [exEnd] |
96 [exEnd] |
97 |
97 |
98 popUp (always on top): |
98 popUp (always on top): |
99 [exBegin] |
99 [exBegin] |
100 |v| |
100 |v| |
101 |
101 |
102 v := TopView new. |
102 v := TopView new. |
103 v bePopUpView. |
103 v bePopUpView. |
104 v extent:200@200. |
104 v extent:200@200. |
105 v open. |
105 v open. |
106 Delay waitForSeconds:10. v destroy. |
106 Delay waitForSeconds:10. v destroy. |
107 [exEnd] |
107 [exEnd] |
108 |
108 |
109 undecorated (looks loke popUp, but is not always on top): |
109 undecorated (looks loke popUp, but is not always on top): |
110 [exBegin] |
110 [exBegin] |
111 |v| |
111 |v| |
112 |
112 |
113 v := TopView new. |
113 v := TopView new. |
114 v beUndecorated. |
114 v beUndecorated. |
115 v extent:200@200. |
115 v extent:200@200. |
116 v open. |
116 v open. |
117 Delay waitForSeconds:10. v destroy. |
117 Delay waitForSeconds:10. v destroy. |
118 [exEnd] |
118 [exEnd] |
119 |
119 |
120 toolwindow (looks loke normal, but has smaller windowTitle-area on win32): |
120 toolwindow (looks loke normal, but has smaller windowTitle-area on win32): |
121 [exBegin] |
121 [exBegin] |
122 |v| |
122 |v| |
123 |
123 |
124 v := TopView new. |
124 v := TopView new. |
125 v beToolWindow. |
125 v beToolWindow. |
126 v extent:200@200. |
126 v extent:200@200. |
127 v open. |
127 v open. |
128 Delay waitForSeconds:10. v destroy. |
128 Delay waitForSeconds:10. v destroy. |
129 [exEnd] |
129 [exEnd] |
130 |
130 |
131 toolwindow dialog (looks loke normal, but has smaller windowTitle-area on win32): |
131 toolwindow dialog (looks loke normal, but has smaller windowTitle-area on win32): |
132 [exBegin] |
132 [exBegin] |
133 |v| |
133 |v| |
134 |
134 |
135 v := TopView new. |
135 v := TopView new. |
136 v beToolDialog. |
136 v beToolDialog. |
137 v extent:200@200. |
137 v extent:200@200. |
138 v open. |
138 v open. |
139 Delay waitForSeconds:10. v destroy. |
139 Delay waitForSeconds:10. v destroy. |
140 [exEnd] |
140 [exEnd] |
141 |
141 |
142 Modal: |
142 Modal: |
143 regular style: |
143 regular style: |
144 [exBegin] |
144 [exBegin] |
145 |v| |
145 |v| |
146 |
146 |
147 v := TopView new. |
147 v := TopView new. |
148 v extent:200@200. |
148 v extent:200@200. |
149 v openModal |
149 v openModal |
150 [exEnd] |
150 [exEnd] |
151 |
151 |
152 dialog: |
152 dialog: |
153 [exBegin] |
153 [exBegin] |
154 |v| |
154 |v| |
155 |
155 |
156 v := TopView new. |
156 v := TopView new. |
157 v beDialogView. |
157 v beDialogView. |
158 v extent:200@200. |
158 v extent:200@200. |
159 v openModal |
159 v openModal |
160 [exEnd] |
160 [exEnd] |
161 |
161 |
162 popUp (always on top): |
162 popUp (always on top): |
163 [exBegin] |
163 [exBegin] |
164 |v| |
164 |v| |
165 |
165 |
166 v := TopView new. |
166 v := TopView new. |
167 v bePopUpView. |
167 v bePopUpView. |
168 v extent:200@200. |
168 v extent:200@200. |
169 v openModal |
169 v openModal |
170 [exEnd] |
170 [exEnd] |
171 |
171 |
172 undecorated (looks loke popUp, but is not always on top): |
172 undecorated (looks loke popUp, but is not always on top): |
173 [exBegin] |
173 [exBegin] |
174 |v| |
174 |v| |
175 |
175 |
176 v := TopView new. |
176 v := TopView new. |
177 v beUndecorated. |
177 v beUndecorated. |
178 v extent:200@200. |
178 v extent:200@200. |
179 v openModal |
179 v openModal |
180 [exEnd] |
180 [exEnd] |
181 |
181 |
182 " |
182 " |
|
183 ! ! |
|
184 |
|
185 !TopView class methodsFor:'accessing'! |
|
186 |
|
187 currentWindowBeingMoved |
|
188 "the current window move operation |
|
189 (only used with modeless popup windows; i.e. windows without decoration, |
|
190 which want to be moved by click-motion on the background)" |
|
191 |
|
192 ^ CurrentWindowBeingMoved |
|
193 |
|
194 "Created: / 03-03-2011 / 19:20:34 / cg" |
183 ! ! |
195 ! ! |
184 |
196 |
185 !TopView class methodsFor:'class initialization'! |
197 !TopView class methodsFor:'class initialization'! |
186 |
198 |
187 initialize |
199 initialize |
340 and also de/iconify together with their master(s). |
352 and also de/iconify together with their master(s). |
341 (i.e. they follow their master(s))." |
353 (i.e. they follow their master(s))." |
342 |
354 |
343 "/ the nonInteger handling code is for backward compatibility only. |
355 "/ the nonInteger handling code is for backward compatibility only. |
344 type isInteger ifTrue:[ |
356 type isInteger ifTrue:[ |
345 type := (type bitClear:MasterSlaveMask) bitOr:TypeMaster. |
357 type := (type bitClear:MasterSlaveMask) bitOr:TypeMaster. |
346 ^ self. |
358 ^ self. |
347 ]. |
359 ]. |
348 type := #master |
360 type := #master |
349 |
361 |
350 " |
362 " |
351 see example in TopView>>beSlave |
363 see example in TopView>>beSlave |
358 "make this a partner-view. Each partner-view will automatically |
370 "make this a partner-view. Each partner-view will automatically |
359 close other partner views (within the same windowGroup) when closed." |
371 close other partner views (within the same windowGroup) when closed." |
360 |
372 |
361 "/ the nonInteger handling code is for backward compatibility only. |
373 "/ the nonInteger handling code is for backward compatibility only. |
362 type isInteger ifTrue:[ |
374 type isInteger ifTrue:[ |
363 type := (type bitClear:MasterSlaveMask) bitOr:TypePartner. |
375 type := (type bitClear:MasterSlaveMask) bitOr:TypePartner. |
364 ^ self. |
376 ^ self. |
365 ]. |
377 ]. |
366 type := #partner |
378 type := #partner |
367 |
379 |
368 " |
380 " |
369 create two topViews within the same group: |
381 create two topViews within the same group: |
421 whenever any master of the windowgroup is closed. |
433 whenever any master of the windowgroup is closed. |
422 See also: #bePartner" |
434 See also: #bePartner" |
423 |
435 |
424 "/ the nonInteger handling code is for backward compatibility only. |
436 "/ the nonInteger handling code is for backward compatibility only. |
425 type isInteger ifTrue:[ |
437 type isInteger ifTrue:[ |
426 type := (type bitClear:MasterSlaveMask) bitOr:TypeSlave. |
438 type := (type bitClear:MasterSlaveMask) bitOr:TypeSlave. |
427 ^ self. |
439 ^ self. |
428 ]. |
440 ]. |
429 type := #slave |
441 type := #slave |
430 |
442 |
431 " |
443 " |
432 create two topViews within the same group: |
444 create two topViews within the same group: |
449 ! |
461 ! |
450 |
462 |
451 beToolDialog |
463 beToolDialog |
452 "/ the nonInteger handling code is for backward compatibility only. |
464 "/ the nonInteger handling code is for backward compatibility only. |
453 type isInteger ifTrue:[ |
465 type isInteger ifTrue:[ |
454 type := (type bitClear:WindowTypeMask) bitOr:TypeToolDialog. |
466 type := (type bitClear:WindowTypeMask) bitOr:TypeToolDialog. |
455 ^ self. |
467 ^ self. |
456 ]. |
468 ]. |
457 type := #dialog |
469 type := #dialog |
458 ! |
470 ! |
459 |
471 |
460 beToolWindow |
472 beToolWindow |
461 "/ the nonInteger handling code is for backward compatibility only. |
473 "/ the nonInteger handling code is for backward compatibility only. |
462 type isInteger ifTrue:[ |
474 type isInteger ifTrue:[ |
463 type := (type bitClear:WindowTypeMask) bitOr:TypeToolWindow. |
475 type := (type bitClear:WindowTypeMask) bitOr:TypeToolWindow. |
464 ^ self. |
476 ^ self. |
465 ]. |
477 ]. |
466 type := nil |
478 type := nil |
467 ! |
479 ! |
468 |
480 |
469 beUndecorated |
481 beUndecorated |
470 "make me an undecorated Window" |
482 "make me an undecorated Window" |
471 |
483 |
472 "/ the nonInteger handling code is for backward compatibility only. |
484 "/ the nonInteger handling code is for backward compatibility only. |
473 type isInteger ifTrue:[ |
485 type isInteger ifTrue:[ |
474 type := (type bitClear:WindowTypeMask) bitOr:TypeUndecorated. |
486 type := (type bitClear:WindowTypeMask) bitOr:TypeUndecorated. |
475 ^ self. |
487 ^ self. |
476 ]. |
488 ]. |
477 type := nil |
489 type := nil |
478 ! |
490 ! |
479 |
491 |
480 focusSequence:aCollectionOfSubcomponents |
492 focusSequence:aCollectionOfSubcomponents |
481 "define the sequence for stepping through my components." |
493 "define the sequence for stepping through my components." |
482 |
494 |
483 windowGroup isNil ifTrue:[ |
495 windowGroup isNil ifTrue:[ |
484 windowGroup := self windowGroupClass new. |
496 windowGroup := self windowGroupClass new. |
485 ]. |
497 ]. |
486 windowGroup focusSequence:aCollectionOfSubcomponents. |
498 windowGroup focusSequence:aCollectionOfSubcomponents. |
487 |
499 |
488 "Created: 6.3.1996 / 15:37:11 / cg" |
500 "Created: 6.3.1996 / 15:37:11 / cg" |
489 "Modified: 30.4.1996 / 15:41:40 / cg" |
501 "Modified: 30.4.1996 / 15:41:40 / cg" |
528 keyPress:key x:x y:y |
540 keyPress:key x:x y:y |
529 "notice: this ought to be moved into the upcoming |
541 "notice: this ought to be moved into the upcoming |
530 StandardSystemViewController." |
542 StandardSystemViewController." |
531 |
543 |
532 <resource: #keyboard ( #Tab |
544 <resource: #keyboard ( #Tab |
533 #FocusNext #FocusPrevious |
545 #FocusNext #FocusPrevious |
534 #CursorDown #CursorUp ) > |
546 #CursorDown #CursorUp ) > |
535 |
547 |
536 windowGroup notNil ifTrue:[ |
548 windowGroup notNil ifTrue:[ |
537 key == #Tab ifTrue:[ |
549 key == #Tab ifTrue:[ |
538 self sensor shiftDown ifTrue:[ |
550 self sensor shiftDown ifTrue:[ |
539 windowGroup focusPrevious |
551 windowGroup focusPrevious |
540 ] ifFalse:[ |
552 ] ifFalse:[ |
541 windowGroup focusNext |
553 windowGroup focusNext |
542 ]. |
554 ]. |
543 ^ self. |
555 ^ self. |
544 ]. |
556 ]. |
545 (key == #FocusNext or:[key == #CursorDown]) ifTrue:[ |
557 (key == #FocusNext or:[key == #CursorDown]) ifTrue:[ |
546 windowGroup focusNext. |
558 windowGroup focusNext. |
547 ^ self. |
559 ^ self. |
548 ]. |
560 ]. |
549 (key == #FocusPrevious or:[key == #CursorUp]) ifTrue:[ |
561 (key == #FocusPrevious or:[key == #CursorUp]) ifTrue:[ |
550 windowGroup focusPrevious. |
562 windowGroup focusPrevious. |
551 ^ self. |
563 ^ self. |
552 ]. |
564 ]. |
553 ]. |
565 ]. |
554 |
566 |
555 super keyPress:key x:x y:y |
567 super keyPress:key x:x y:y |
556 |
568 |
557 "Created: / 01-02-1996 / 22:08:30 / cg" |
569 "Created: / 01-02-1996 / 22:08:30 / cg" |
604 |
616 |
605 ^ self |
617 ^ self |
606 |
618 |
607 "Created: / 31-10-2007 / 01:25:33 / cg" |
619 "Created: / 31-10-2007 / 01:25:33 / cg" |
608 "Modified: / 05-11-2007 / 12:11:17 / cg" |
620 "Modified: / 05-11-2007 / 12:11:17 / cg" |
|
621 ! ! |
|
622 |
|
623 !TopView methodsFor:'event handling-window move'! |
|
624 |
|
625 doWindowMove |
|
626 "a window move operation |
|
627 (only used with modeless popup windows; i.e. windows without decoration, |
|
628 which want to be moved by click-motion on the background)" |
|
629 |
|
630 |delta| |
|
631 |
|
632 CurrentWindowBeingMoved == self ifTrue:[ |
|
633 delta := device pointerPosition - CurrentWindowMoveStart. |
|
634 (CurrentWindowMoveState notNil |
|
635 or:[ delta r > 5 ]) ifTrue:[ |
|
636 CurrentWindowMoveState := #inMove. |
|
637 CurrentWindowMoveStart := device pointerPosition. |
|
638 self origin:(self origin + delta). |
|
639 ]. |
|
640 ]. |
|
641 |
|
642 "Created: / 03-03-2011 / 19:13:08 / cg" |
|
643 ! |
|
644 |
|
645 endWindowMove |
|
646 "a window move operation |
|
647 (only used with modeless popup windows; i.e. windows without decoration, |
|
648 which want to be moved by click-motion on the background)" |
|
649 |
|
650 CurrentWindowBeingMoved := nil. |
|
651 |
|
652 "Created: / 03-03-2011 / 19:17:24 / cg" |
|
653 ! |
|
654 |
|
655 startWindowMove |
|
656 "a window move operation |
|
657 (only used with modeless popup windows; i.e. windows without decoration, |
|
658 which want to be moved by click-motion on the background)" |
|
659 |
|
660 CurrentWindowBeingMoved := self. |
|
661 CurrentWindowMoveStart := device pointerPosition. |
|
662 CurrentWindowMoveState := nil. |
|
663 |
|
664 "Created: / 03-03-2011 / 19:09:39 / cg" |
609 ! ! |
665 ! ! |
610 |
666 |
611 !TopView methodsFor:'help'! |
667 !TopView methodsFor:'help'! |
612 |
668 |
613 flyByHelpDependsOnPositionIn:aView |
669 flyByHelpDependsOnPositionIn:aView |
677 see (or redefine) preferFirstInputFieldWhenAssigningInitialFocus)" |
733 see (or redefine) preferFirstInputFieldWhenAssigningInitialFocus)" |
678 |
734 |
679 |firstInputField firstConsumer firstCursorConsumer consumer| |
735 |firstInputField firstConsumer firstCursorConsumer consumer| |
680 |
736 |
681 self allSubViewsDo:[:v | |
737 self allSubViewsDo:[:v | |
682 (firstInputField isNil and:[v isInputField]) ifTrue:[ |
738 (firstInputField isNil and:[v isInputField]) ifTrue:[ |
683 firstInputField := v |
739 firstInputField := v |
684 ]. |
740 ]. |
685 (firstConsumer isNil and:[v isKeyboardConsumer]) ifTrue:[ |
741 (firstConsumer isNil and:[v isKeyboardConsumer]) ifTrue:[ |
686 firstConsumer := v |
742 firstConsumer := v |
687 ]. |
743 ]. |
688 (firstCursorConsumer isNil and:[v isCursorKeyConsumer]) ifTrue:[ |
744 (firstCursorConsumer isNil and:[v isCursorKeyConsumer]) ifTrue:[ |
689 firstCursorConsumer := v |
745 firstCursorConsumer := v |
690 ]. |
746 ]. |
691 ]. |
747 ]. |
692 self preferFirstInputFieldWhenAssigningInitialFocus ifTrue:[ |
748 self preferFirstInputFieldWhenAssigningInitialFocus ifTrue:[ |
693 consumer := firstInputField. |
749 consumer := firstInputField. |
694 ]. |
750 ]. |
695 consumer := (consumer ? firstConsumer ? firstCursorConsumer). |
751 consumer := (consumer ? firstConsumer ? firstCursorConsumer). |
696 consumer notNil ifTrue:[ |
752 consumer notNil ifTrue:[ |
697 device platformName = 'WIN32' ifTrue:[ |
753 device platformName = 'WIN32' ifTrue:[ |
698 self windowGroup focusView:consumer byTab:true. |
754 self windowGroup focusView:consumer byTab:true. |
699 ] ifFalse:[ |
755 ] ifFalse:[ |
700 consumer requestFocus. |
756 consumer requestFocus. |
701 "/ consumer requestFocus. - could be denied; but we force it here |
757 "/ consumer requestFocus. - could be denied; but we force it here |
702 windowGroup focusView:consumer byTab:false. |
758 windowGroup focusView:consumer byTab:false. |
703 ]. |
759 ]. |
704 ]. |
760 ]. |
705 |
761 |
706 "Modified: / 29-08-2006 / 14:32:30 / cg" |
762 "Modified: / 29-08-2006 / 14:32:30 / cg" |
707 ! |
763 ! |
708 |
764 |
749 |
805 |
750 postRealize |
806 postRealize |
751 super postRealize. |
807 super postRealize. |
752 |
808 |
753 keyboardProcessor isNil ifTrue:[ |
809 keyboardProcessor isNil ifTrue:[ |
754 keyboardProcessor := KeyboardProcessor new. |
810 keyboardProcessor := KeyboardProcessor new. |
755 ]. |
811 ]. |
756 |
812 |
757 device realizedTopViewHookFor:self |
813 device realizedTopViewHookFor:self |
758 ! |
814 ! |
759 |
815 |
760 realize |
816 realize |
761 self isMarkedAsUnmappedModalBox ifTrue:[ |
817 self isMarkedAsUnmappedModalBox ifTrue:[ |
762 "/ must clear this flag |
818 "/ must clear this flag |
763 "/ - otherwise realize thinks it is already realized. |
819 "/ - otherwise realize thinks it is already realized. |
764 realized := false. |
820 realized := false. |
765 self unmarkAsUnmappedModalBox. |
821 self unmarkAsUnmappedModalBox. |
766 ]. |
822 ]. |
767 super realize. |
823 super realize. |
768 ! |
824 ! |
769 |
825 |
770 release |
826 release |
771 keyboardProcessor notNil ifTrue:[ |
827 keyboardProcessor notNil ifTrue:[ |
772 keyboardProcessor release. |
828 keyboardProcessor release. |
773 keyboardProcessor := nil. |
829 keyboardProcessor := nil. |
774 ]. |
830 ]. |
775 super release |
831 super release |
776 ! ! |
832 ! ! |
777 |
833 |
778 !TopView methodsFor:'misc'! |
834 !TopView methodsFor:'misc'! |
855 withCursor:aCursor do:aBlock |
911 withCursor:aCursor do:aBlock |
856 "evaluate aBlock while showing aCursor in all my views. |
912 "evaluate aBlock while showing aCursor in all my views. |
857 Return the value as returned by aBlock." |
913 Return the value as returned by aBlock." |
858 |
914 |
859 windowGroup notNil ifTrue:[ |
915 windowGroup notNil ifTrue:[ |
860 ^ windowGroup withCursor:aCursor do:aBlock |
916 ^ windowGroup withCursor:aCursor do:aBlock |
861 ]. |
917 ]. |
862 ^ super withCursor:aCursor do:aBlock |
918 ^ super withCursor:aCursor do:aBlock |
863 ! ! |
919 ! ! |
864 |
920 |
865 !TopView methodsFor:'queries'! |
921 !TopView methodsFor:'queries'! |
1026 however many subclasses redefine this to compute the actual value |
1082 however many subclasses redefine this to compute the actual value |
1027 depending on the sizes of the contents or subcomponents." |
1083 depending on the sizes of the contents or subcomponents." |
1028 |
1084 |
1029 "/ If I have an explicit preferredExtent.. |
1085 "/ If I have an explicit preferredExtent.. |
1030 explicitExtent notNil ifTrue:[ |
1086 explicitExtent notNil ifTrue:[ |
1031 ^ explicitExtent |
1087 ^ explicitExtent |
1032 ]. |
1088 ]. |
1033 |
1089 |
1034 "/ If I have a cached preferredExtent value.. |
1090 "/ If I have a cached preferredExtent value.. |
1035 preferredExtent notNil ifTrue:[ |
1091 preferredExtent notNil ifTrue:[ |
1036 ^ preferredExtent |
1092 ^ preferredExtent |
1037 ]. |
1093 ]. |
1038 ^ self class defaultExtent |
1094 ^ self class defaultExtent |
1039 |
1095 |
1040 "Modified: 19.7.1996 / 20:45:41 / cg" |
1096 "Modified: 19.7.1996 / 20:45:41 / cg" |
1041 ! |
1097 ! |
1052 This is used by the device as a decoration hint." |
1108 This is used by the device as a decoration hint." |
1053 |
1109 |
1054 |t| |
1110 |t| |
1055 |
1111 |
1056 type isInteger ifTrue:[ |
1112 type isInteger ifTrue:[ |
1057 t := type bitAnd:WindowTypeMask. |
1113 t := type bitAnd:WindowTypeMask. |
1058 t == TypeUndecorated ifTrue:[^ #undecorated]. |
1114 t == TypeUndecorated ifTrue:[^ #undecorated]. |
1059 t == TypeDialog ifTrue:[^ #dialog]. |
1115 t == TypeDialog ifTrue:[^ #dialog]. |
1060 t == TypePopUp ifTrue:[^ #popUp]. |
1116 t == TypePopUp ifTrue:[^ #popUp]. |
1061 t == TypeToolWindow ifTrue:[^ #toolWindow]. |
1117 t == TypeToolWindow ifTrue:[^ #toolWindow]. |
1062 t == TypeToolDialog ifTrue:[^ #toolDialog]. |
1118 t == TypeToolDialog ifTrue:[^ #toolDialog]. |
1063 ^ #normal |
1119 ^ #normal |
1064 ]. |
1120 ]. |
1065 "/ the nonInteger handling code is for backward compatibility only. |
1121 "/ the nonInteger handling code is for backward compatibility only. |
1066 ^ super windowStyle |
1122 ^ super windowStyle |
1067 ! ! |
1123 ! ! |
1068 |
1124 |
1127 "/ by sending a closerequest always and letting popUps |
1183 "/ by sending a closerequest always and letting popUps |
1128 "/ respond by hiding ??? |
1184 "/ respond by hiding ??? |
1129 |
1185 |
1130 (windowGroup notNil |
1186 (windowGroup notNil |
1131 and:[ windowGroup isModal ]) ifTrue:[ |
1187 and:[ windowGroup isModal ]) ifTrue:[ |
1132 masterGroup := windowGroup previousGroup. |
1188 masterGroup := windowGroup previousGroup. |
1133 myApplication := self application. |
1189 myApplication := self application. |
1134 |
1190 |
1135 (myApplication notNil |
1191 (myApplication notNil |
1136 and:[ masterGroup isNil or:[myApplication ~= masterGroup application]]) ifTrue:[ |
1192 and:[ masterGroup isNil or:[myApplication ~= masterGroup application]]) ifTrue:[ |
1137 AbortOperationRequest handle:[:ex | |
1193 AbortOperationRequest handle:[:ex | |
1138 "/ in case the close is cought by the application |
1194 "/ in case the close is cought by the application |
1139 ^ self. |
1195 ^ self. |
1140 ] do:[ |
1196 ] do:[ |
1141 myApplication closeRequest. |
1197 myApplication closeRequest. |
1142 |
1198 |
1143 "/ if myApp called closeDownViews, it wants me to hide. |
1199 "/ if myApp called closeDownViews, it wants me to hide. |
1144 "/ otherwise, it has redefined closeRequest to return without closeDownViews. |
1200 "/ otherwise, it has redefined closeRequest to return without closeDownViews. |
1145 realized ifTrue:[ |
1201 realized ifTrue:[ |
1146 "/ closeDownViews was not called - app wants me to remain open |
1202 "/ closeDownViews was not called - app wants me to remain open |
1147 ^ self |
1203 ^ self |
1148 ]. |
1204 ]. |
1149 ]. |
1205 ]. |
1150 ]. |
1206 ]. |
1151 ]. |
1207 ]. |
1152 super hide. |
1208 super hide. |
1153 ! |
1209 ! |
1154 |
1210 |
1155 map |
1211 map |
1156 "make the view visible on the screen. |
1212 "make the view visible on the screen. |
1157 For topViews, the windowManager will choose (or ask for) the |
1213 For topViews, the windowManager will choose (or ask for) the |
1158 views position on the screen. |
1214 views position on the screen. |
1159 Notice: |
1215 Notice: |
1160 Actually, this method is only valid for topViews; |
1216 Actually, this method is only valid for topViews; |
1161 however, it is defined here to allow things like 'Button new realize'" |
1217 however, it is defined here to allow things like 'Button new realize'" |
1162 |
1218 |
1163 self mapAt:(self origin) iconified:false |
1219 self mapAt:(self origin) iconified:false |
1164 ! |
1220 ! |
1165 |
1221 |
1166 mapIconified |
1222 mapIconified |
1167 "make the view visible but iconified. |
1223 "make the view visible but iconified. |
1168 In contrast to map, which does it non-iconified" |
1224 In contrast to map, which does it non-iconified" |
1169 |
1225 |
1170 realized ifFalse:[ |
1226 realized ifFalse:[ |
1171 " |
1227 " |
1172 now, make the view visible |
1228 now, make the view visible |
1173 " |
1229 " |
1174 realized := true. |
1230 realized := true. |
1175 device |
1231 device |
1176 mapView:self id:drawableId iconified:true |
1232 mapView:self id:drawableId iconified:true |
1177 atX:left y:top width:width height:height |
1233 atX:left y:top width:width height:height |
1178 minExtent:(self minExtent) maxExtent:(self maxExtent) |
1234 minExtent:(self minExtent) maxExtent:(self maxExtent) |
1179 ] |
1235 ] |
1180 |
1236 |
1181 "Modified: 25.2.1997 / 22:44:33 / cg" |
1237 "Modified: 25.2.1997 / 22:44:33 / cg" |
1182 "Created: 24.7.1997 / 12:48:21 / cg" |
1238 "Created: 24.7.1997 / 12:48:21 / cg" |
1183 ! |
1239 ! |
1394 masterSlaveMessage:aSelector inGroup:aWindowGroup |
1450 masterSlaveMessage:aSelector inGroup:aWindowGroup |
1395 "send aSelector to partners and/or slaves. |
1451 "send aSelector to partners and/or slaves. |
1396 This is a private helper for destroy / mapped / unmapped" |
1452 This is a private helper for destroy / mapped / unmapped" |
1397 |
1453 |
1398 aWindowGroup notNil ifTrue:[ |
1454 aWindowGroup notNil ifTrue:[ |
1399 "/ |
1455 "/ |
1400 "/ if I am a master or partner, send to all slaves |
1456 "/ if I am a master or partner, send to all slaves |
1401 "/ |
1457 "/ |
1402 (self isMaster or:[self isPartner]) ifTrue:[ |
1458 (self isMaster or:[self isPartner]) ifTrue:[ |
1403 aWindowGroup slavesDo:[:v | v perform:aSelector]. |
1459 aWindowGroup slavesDo:[:v | v perform:aSelector]. |
1404 ]. |
1460 ]. |
1405 "/ |
1461 "/ |
1406 "/ if I am a partner, send to all partners |
1462 "/ if I am a partner, send to all partners |
1407 "/ |
1463 "/ |
1408 self isPartner ifTrue:[ |
1464 self isPartner ifTrue:[ |
1409 aWindowGroup partnersDo:[:v | v ~~ self ifTrue:[v perform:aSelector]]. |
1465 aWindowGroup partnersDo:[:v | v ~~ self ifTrue:[v perform:aSelector]]. |
1410 ]. |
1466 ]. |
1411 ]. |
1467 ]. |
1412 ! |
1468 ! |
1413 |
1469 |
1414 unmapped |
1470 unmapped |
1415 "the recevier was unmapped (i.e. iconified); |
1471 "the recevier was unmapped (i.e. iconified); |
1416 look for partners and slaves." |
1472 look for partners and slaves." |
1417 |
1473 |
1418 |r| |
1474 |r| |
1419 |
1475 |
1420 (windowGroup notNil and:[windowGroup isModal]) ifTrue:[ |
1476 (windowGroup notNil and:[windowGroup isModal]) ifTrue:[ |
1421 "keep the realized flag true (to avoid exiting the modal event loop). |
1477 "keep the realized flag true (to avoid exiting the modal event loop). |
1422 Consider this a kludge." |
1478 Consider this a kludge." |
1423 self markAsUnmappedModalBox. |
1479 self markAsUnmappedModalBox. |
1424 r := realized. |
1480 r := realized. |
1425 ] ifFalse:[ |
1481 ] ifFalse:[ |
1426 self unmarkAsUnmappedModalBox. |
1482 self unmarkAsUnmappedModalBox. |
1427 r := realized := false. |
1483 r := realized := false. |
1428 ]. |
1484 ]. |
1429 super unmapped. |
1485 super unmapped. |
1430 realized := r. |
1486 realized := r. |
1431 |
1487 |
1432 "/ |
1488 "/ |