280 |
280 |
281 addTopView:aView |
281 addTopView:aView |
282 "add a topview to the group" |
282 "add a topview to the group" |
283 |
283 |
284 topViews isNil ifTrue:[ |
284 topViews isNil ifTrue:[ |
285 topViews := OrderedCollection new. |
285 topViews := OrderedCollection new. |
286 ]. |
286 ]. |
287 topViews add:aView |
287 (topViews includesIdentical:aView) ifFalse:[ |
|
288 topViews add:aView |
|
289 ] |
|
290 |
|
291 "Modified: 6.3.1996 / 15:35:15 / cg" |
288 ! |
292 ! |
289 |
293 |
290 addView:aView |
294 addView:aView |
291 "add aView to the windowGroup" |
295 "add aView to the windowGroup" |
292 |
296 |
293 views isNil ifTrue:[ |
297 views isNil ifTrue:[ |
294 views := OrderedCollection new. |
298 views := OrderedCollection new. |
295 ]. |
299 ]. |
296 views add:aView |
300 (views includesIdentical:aView) ifFalse:[ |
|
301 views add:aView |
|
302 ] |
|
303 |
|
304 "Modified: 6.3.1996 / 15:35:41 / cg" |
297 ! |
305 ! |
298 |
306 |
299 device |
307 device |
300 "return the device, we receive our events from" |
308 "return the device, we receive our events from" |
301 |
309 |
775 (preEventHook notNil |
783 (preEventHook notNil |
776 and:[preEventHook processEvent:event]) ifTrue:[ |
784 and:[preEventHook processEvent:event]) ifTrue:[ |
777 ignore := true. |
785 ignore := true. |
778 ]. |
786 ]. |
779 ignore ifFalse:[ |
787 ignore ifFalse:[ |
780 "/ |
|
781 "/ FocusStepping is done right here |
|
782 "/ |
|
783 event isKeyPressEvent ifTrue:[ |
788 event isKeyPressEvent ifTrue:[ |
784 (key := event key) == #FocusNext ifTrue:[ |
789 key := event key. |
785 self focusNext. |
790 |
786 ignore := true |
791 "/ key == #FocusNext ifTrue:[ |
787 ]. |
792 "/ self focusNext. |
788 key == #FocusPrevious ifTrue:[ |
793 "/ ignore := true |
789 self focusPrevious. |
794 "/ ]. |
790 ignore := true |
795 "/ key == #FocusPrevious ifTrue:[ |
791 ]. |
796 "/ self focusPrevious. |
|
797 "/ ignore := true |
|
798 "/ ]. |
|
799 |
792 "/ key == #Tab ifTrue:[ |
800 "/ key == #Tab ifTrue:[ |
793 "/ focusView notNil ifTrue:[ |
801 "/ focusView notNil ifTrue:[ |
794 "/ focusView canTab ifTrue:[ |
802 "/ focusView canTab ifTrue:[ |
795 "/ self focusNext. |
803 "/ self focusNext. |
796 "/ ignore := true |
804 "/ ignore := true |
901 ] |
909 ] |
902 ] |
910 ] |
903 ! |
911 ! |
904 |
912 |
905 waitForExposeFor:aView |
913 waitForExposeFor:aView |
906 "wait for a noExpose on aView, then process all exposes. |
914 "wait for a noExpose event for aView, then process all exposes. |
907 To be used after a scroll" |
915 To be used after a scroll. |
|
916 This is very Xspecific and not needed with other systems |
|
917 (i.e. a synthetic noExpose may be generated there)." |
908 |
918 |
909 mySensor waitForExposeFor:aView. |
919 mySensor waitForExposeFor:aView. |
910 AbortSignal catch:[ |
920 AbortSignal catch:[ |
911 self processExposeEvents |
921 self processExposeEvents |
912 ] |
922 ] |
|
923 |
|
924 "Modified: 6.3.1996 / 15:58:36 / cg" |
913 ! ! |
925 ! ! |
914 |
926 |
915 !WindowGroup methodsFor:'focus control'! |
927 !WindowGroup methodsFor:'focus control'! |
916 |
928 |
917 focusNext |
929 focusNext |
918 "give focus to next view in focusSequence" |
930 "give focus to the next view in the focusSequence" |
919 |
931 |
920 |index| |
932 |index last nextTop nextSequence| |
921 |
933 |
922 focusSequence size == 0 ifTrue:[^ self]. |
934 focusSequence isNil ifTrue:[ |
|
935 focusSequence := topViews first focusSequence. |
|
936 ]. |
|
937 |
|
938 (last := focusSequence size) == 0 ifTrue:[^ self]. |
923 focusView notNil ifTrue:[ |
939 focusView notNil ifTrue:[ |
924 index := (focusSequence indexOf:focusView) + 1. |
940 index := (focusSequence indexOf:focusView) + 1. |
925 index > focusSequence size ifTrue:[index := 1]. |
941 index > last ifTrue:[ |
|
942 index := 1. |
|
943 "/ another topView ? |
|
944 "/ topViews size > 1 ifTrue:[ |
|
945 "/ index := topViews identityIndexOf:(focusView topView). |
|
946 "/ (index ~~ 0 and:[index < topViews size]) ifTrue:[ |
|
947 "/ nextTop := topViews at:index+1. |
|
948 "/ nextSequence := nextTop focusSequence. |
|
949 "/ nextSequence size ~~ 0 ifTrue:[ |
|
950 "/ nextTop raiseDeiconified. |
|
951 "/ focusSequence := nextSequence. |
|
952 "/ ] |
|
953 "/ ] |
|
954 "/ ] |
|
955 ]. |
926 ] ifFalse:[ |
956 ] ifFalse:[ |
927 index := 1. |
957 index := 1. |
928 ]. |
958 ]. |
929 self focusView:(focusSequence at:index) |
959 self focusView:(focusSequence at:index) |
930 |
960 |
931 " |
961 " |
932 |top v1 v2| |
962 |top v1 v2| |
938 top windowGroup focusSequence:(Array with:v1 with:v2). |
968 top windowGroup focusSequence:(Array with:v1 with:v2). |
939 top windowGroup focusOn:v1. |
969 top windowGroup focusOn:v1. |
940 (Delay forSeconds:10) wait. |
970 (Delay forSeconds:10) wait. |
941 top windowGroup focusNext. |
971 top windowGroup focusNext. |
942 " |
972 " |
|
973 |
|
974 "Modified: 6.3.1996 / 15:53:17 / cg" |
943 ! |
975 ! |
944 |
976 |
945 focusPrevious |
977 focusPrevious |
946 "give focus to previous view in focusSequence" |
978 "give focus to previous view in focusSequence" |
947 |
979 |
948 |index| |
980 |index| |
949 |
981 |
|
982 focusSequence isNil ifTrue:[ |
|
983 focusSequence := topViews first focusSequence. |
|
984 ]. |
950 focusSequence size == 0 ifTrue:[^ self]. |
985 focusSequence size == 0 ifTrue:[^ self]. |
951 focusView notNil ifTrue:[ |
986 focusView notNil ifTrue:[ |
952 index := (focusSequence indexOf:focusView) - 1. |
987 index := (focusSequence indexOf:focusView) - 1. |
953 index < 1 ifTrue:[index := focusSequence size]. |
988 index < 1 ifTrue:[index := focusSequence size]. |
954 ] ifFalse:[ |
989 ] ifFalse:[ |
955 index := focusSequence size. |
990 index := focusSequence size. |
956 ]. |
991 ]. |
957 self focusView:(focusSequence at:index) |
992 self focusView:(focusSequence at:index) |
|
993 |
|
994 "Modified: 6.3.1996 / 15:46:08 / cg" |
958 ! |
995 ! |
959 |
996 |
960 focusSequence |
997 focusSequence |
961 "return the focus sequence for focusNext/focusPrevious. |
998 "return my focus sequence for focusNext/focusPrevious. |
962 Focus is stepped in the order in which subviews occur in |
999 Focus is stepped in the order in which subviews occur in |
963 the sequence" |
1000 the sequence" |
964 |
1001 |
965 ^ focusSequence |
1002 ^ focusSequence |
|
1003 |
|
1004 "Modified: 6.3.1996 / 15:46:35 / cg" |
966 ! |
1005 ! |
967 |
1006 |
968 focusSequence:aSequenceableCollection |
1007 focusSequence:aSequenceableCollection |
969 "define the focus sequence for focusNext/focusPrevious. |
1008 "define the focus sequence for focusNext/focusPrevious. |
970 Focus is stepped in the order in which subviews occur in |
1009 Focus is stepped in the order in which subviews occur in |