pass info if focus change was explicit (i.e. Tab-key) or by window manager.
authorClaus Gittinger <cg@exept.de>
Sat, 27 Jan 1996 16:35:09 +0100
changeset 385 15fd1c806d2a
parent 384 3801bf11d1e2
child 386 f9a80cac659e
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
KeybdFwd.st
KeyboardForwarder.st
PseudoV.st
SimpleView.st
StandardSystemView.st
StdSysV.st
WGroup.st
WindowGroup.st
--- a/KeybdFwd.st	Sat Jan 27 16:03:24 1996 +0100
+++ b/KeybdFwd.st	Sat Jan 27 16:35:09 1996 +0100
@@ -316,6 +316,20 @@
     ]
 ! !
 
+!KeyboardForwarder methodsFor:'focus forwarding'!
+
+showFocus:explicit
+    destinationView notNil ifTrue:[destinationView showFocus:explicit]
+
+    "Created: 27.1.1996 / 13:06:53 / cg"
+!
+
+showNoFocus:explicit
+    destinationView notNil ifTrue:[destinationView showNoFocus:explicit]
+
+    "Created: 27.1.1996 / 13:07:52 / cg"
+! !
+
 !KeyboardForwarder methodsFor:'queries'!
 
 checkCondition:type key:key view:aView
@@ -358,5 +372,5 @@
 !KeyboardForwarder class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Attic/KeybdFwd.st,v 1.9 1995-11-23 17:45:20 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Attic/KeybdFwd.st,v 1.10 1996-01-27 15:34:55 cg Exp $'
 ! !
--- a/KeyboardForwarder.st	Sat Jan 27 16:03:24 1996 +0100
+++ b/KeyboardForwarder.st	Sat Jan 27 16:35:09 1996 +0100
@@ -316,6 +316,20 @@
     ]
 ! !
 
+!KeyboardForwarder methodsFor:'focus forwarding'!
+
+showFocus:explicit
+    destinationView notNil ifTrue:[destinationView showFocus:explicit]
+
+    "Created: 27.1.1996 / 13:06:53 / cg"
+!
+
+showNoFocus:explicit
+    destinationView notNil ifTrue:[destinationView showNoFocus:explicit]
+
+    "Created: 27.1.1996 / 13:07:52 / cg"
+! !
+
 !KeyboardForwarder methodsFor:'queries'!
 
 checkCondition:type key:key view:aView
@@ -358,5 +372,5 @@
 !KeyboardForwarder class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/KeyboardForwarder.st,v 1.9 1995-11-23 17:45:20 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/KeyboardForwarder.st,v 1.10 1996-01-27 15:34:55 cg Exp $'
 ! !
--- a/PseudoV.st	Sat Jan 27 16:03:24 1996 +0100
+++ b/PseudoV.st	Sat Jan 27 16:35:09 1996 +0100
@@ -237,10 +237,10 @@
      v open.
      [v shown] whileFalse:[Processor yield].
      [v shown] whileTrue:[   
-        (Delay forSeconds:1) wait.
-        v cursor:(Cursor normal).
-        (Delay forSeconds:1) wait.
-        v cursor:(Cursor wait).
+	(Delay forSeconds:1) wait.
+	v cursor:(Cursor normal).
+	(Delay forSeconds:1) wait.
+	v cursor:(Cursor wait).
      ]
     "
 
@@ -255,23 +255,23 @@
     |id|
 
     aCursor notNil ifTrue:[
-        (aCursor ~~ cursor) ifTrue:[
-            cursor := aCursor.
-            drawableId notNil ifTrue:[
-                cursor := cursor on:device.
+	(aCursor ~~ cursor) ifTrue:[
+	    cursor := aCursor.
+	    drawableId notNil ifTrue:[
+		cursor := cursor on:device.
 		cursor isNil ifTrue:[ ^ self].
-                id := cursor id.
-                id isNil ifTrue:[
-                    'PSEUDOVIEW: nil cursorId ignored; shape=' errorPrint. cursor shape errorPrintNL.
-                    ^ self
-                ].
-                device setCursor:id in:drawableId.
-                (showImmediately and:[realized]) ifTrue:[
-                    "flush, to make cursor immediately visible"
-                    device flush
-                ]
-            ]
-        ]
+		id := cursor id.
+		id isNil ifTrue:[
+		    'PSEUDOVIEW: nil cursorId ignored; shape=' errorPrint. cursor shape errorPrintNL.
+		    ^ self
+		].
+		device setCursor:id in:drawableId.
+		(showImmediately and:[realized]) ifTrue:[
+		    "flush, to make cursor immediately visible"
+		    device flush
+		]
+	    ]
+	]
     ]
 
     "
@@ -282,10 +282,10 @@
      v open.
      [v shown] whileFalse:[Processor yield].
      [v shown] whileTrue:[   
-        (Delay forSeconds:1) wait.
-        v cursor:(Cursor normal).
-        (Delay forSeconds:1) wait.
-        v cursor:(Cursor wait).
+	(Delay forSeconds:1) wait.
+	v cursor:(Cursor normal).
+	(Delay forSeconds:1) wait.
+	v cursor:(Cursor wait).
      ]
     "
 
@@ -1079,13 +1079,13 @@
 !
 
 focusIn
-    "got keayboard focus - do nothing here"
+    "got keyboard focus - do nothing here"
 
     ^ self
 !
 
 focusOut
-    "lost keayboard focus - do nothing here"
+    "lost keyboard focus - do nothing here"
 
     ^ self
 !
@@ -1543,5 +1543,5 @@
 !PseudoView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Attic/PseudoV.st,v 1.50 1996-01-18 14:05:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Attic/PseudoV.st,v 1.51 1996-01-27 15:34:58 cg Exp $'
 ! !
--- a/SimpleView.st	Sat Jan 27 16:03:24 1996 +0100
+++ b/SimpleView.st	Sat Jan 27 16:35:09 1996 +0100
@@ -3381,15 +3381,15 @@
 !
 
 focusIn
-    "got keyboard focus"
-
-    self showFocus
+    "got keyboard focus (via the window manager)"
+
+    self showFocus:false
 !
 
 focusOut
-    "lost keyboard focus"
-
-    self showNoFocus
+    "lost keyboard focus (via the window manager)"
+
+    self showNoFocus:false
 !
 
 hasKeyboardFocus:aBoolean
@@ -4374,6 +4374,13 @@
     ^ self canHandle:aKey
 !
 
+canTab
+    superView notNil ifTrue:[
+	^ superView canTab
+    ].
+    ^ true
+!
+
 delegatesTo:someone
     "return true, if I delegate events to someone"
 
@@ -5034,35 +5041,45 @@
     ^ self
 !
 
-showFocus
-    "highlight myself somehow to tell user that I have the focus"
+showFocus:explicit
+    "highlight myself somehow to tell user that I have the focus.
+     Explicit tells if the focus came via focusStepping (i.e. tabbing)
+     or via the window manager (i.e. pointer entering).
+     Only change my border, if this is an explicit focusChange."
 
     |delta|
 
-    drawableId notNil ifTrue:[
-	delta := DefaultFocusBorderWidth - borderWidth.
-	delta ~~ 0 ifTrue:[
-	    device moveWindow:drawableId x:left-delta y:top-delta
-	].
-	device setWindowBorderWidth:DefaultFocusBorderWidth in:drawableId.
-	device setWindowBorderColor:(DefaultFocusColor on:device) colorId in:drawableId.
+    explicit ifTrue:[
+	drawableId notNil ifTrue:[
+	    delta := DefaultFocusBorderWidth - borderWidth.
+	    delta ~~ 0 ifTrue:[
+		device moveWindow:drawableId x:left-delta y:top-delta
+	    ].
+	    device setWindowBorderWidth:DefaultFocusBorderWidth in:drawableId.
+	    device setWindowBorderColor:(DefaultFocusColor on:device) colorId in:drawableId.
+	]
     ]
 !
 
-showNoFocus
-    "undo the effect of showFocus"
+showNoFocus:explicit
+    "undo the effect of showFocus.
+     Explicit tells if the focus came via focusStepping (i.e. tabbing)
+     or via the window manager (i.e. pointer entering).
+     Only change my border, if this is an explicit focusChange."
 
     |delta|
 
-    drawableId notNil ifTrue:[
-	(windowGroup notNil
-	and:[windowGroup focusView == self]) ifTrue:[
-	    delta := DefaultFocusBorderWidth - borderWidth.
-	    delta ~~ 0 ifTrue:[
-		device moveWindow:drawableId x:left+delta y:top+delta
-	    ].
-	    device setWindowBorderWidth:borderWidth in:drawableId.
-	    self setBorderColor.
+    explicit ifTrue:[
+	drawableId notNil ifTrue:[
+	    (windowGroup notNil
+	    and:[windowGroup focusView == self]) ifTrue:[
+		delta := DefaultFocusBorderWidth - borderWidth.
+		delta ~~ 0 ifTrue:[
+		    device moveWindow:drawableId x:left+delta y:top+delta
+		].
+		device setWindowBorderWidth:borderWidth in:drawableId.
+		self setBorderColor.
+	    ]
 	]
     ]
 
@@ -5843,6 +5860,6 @@
 !SimpleView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.46 1996-01-24 15:32:08 ah Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.47 1996-01-27 15:35:03 cg Exp $'
 ! !
 SimpleView initialize!
--- a/StandardSystemView.st	Sat Jan 27 16:03:24 1996 +0100
+++ b/StandardSystemView.st	Sat Jan 27 16:35:09 1996 +0100
@@ -531,27 +531,35 @@
 !StandardSystemView methodsFor:'event handling'!
 
 focusIn
-    "the view got the keyboard focus"
+    "the view got the keyboard focus (via the window manager)"
 
     |v|
 
     windowGroup notNil ifTrue:[
 	(v := windowGroup focusView) notNil ifTrue:[
-	    v showFocus
+	    v showFocus:false.
+	    ^ self
 	]
     ].
+    delegate notNil ifTrue:[
+	delegate showFocus:false.
+    ]
 !
 
 focusOut
-    "the view lost keyboard focus"
+    "the view lost keyboard focus (via the window manager)"
 
     |v|
 
     windowGroup notNil ifTrue:[
 	(v := windowGroup focusView) notNil ifTrue:[
-	    v showNoFocus
+	    v showNoFocus:false.
+	    ^ self
 	]
     ].
+    delegate notNil ifTrue:[
+	delegate showNoFocus:false.
+    ]
 !
 
 mapped
@@ -577,7 +585,7 @@
 
 showActivity:someMessage
     application notNil ifTrue:[
-        application showActivity:someMessage
+	application showActivity:someMessage
     ]
 
     "Created: 16.12.1995 / 18:40:44 / cg"
@@ -936,5 +944,5 @@
 !StandardSystemView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.39 1995-12-16 17:43:19 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.40 1996-01-27 15:35:07 cg Exp $'
 ! !
--- a/StdSysV.st	Sat Jan 27 16:03:24 1996 +0100
+++ b/StdSysV.st	Sat Jan 27 16:35:09 1996 +0100
@@ -531,27 +531,35 @@
 !StandardSystemView methodsFor:'event handling'!
 
 focusIn
-    "the view got the keyboard focus"
+    "the view got the keyboard focus (via the window manager)"
 
     |v|
 
     windowGroup notNil ifTrue:[
 	(v := windowGroup focusView) notNil ifTrue:[
-	    v showFocus
+	    v showFocus:false.
+	    ^ self
 	]
     ].
+    delegate notNil ifTrue:[
+	delegate showFocus:false.
+    ]
 !
 
 focusOut
-    "the view lost keyboard focus"
+    "the view lost keyboard focus (via the window manager)"
 
     |v|
 
     windowGroup notNil ifTrue:[
 	(v := windowGroup focusView) notNil ifTrue:[
-	    v showNoFocus
+	    v showNoFocus:false.
+	    ^ self
 	]
     ].
+    delegate notNil ifTrue:[
+	delegate showNoFocus:false.
+    ]
 !
 
 mapped
@@ -577,7 +585,7 @@
 
 showActivity:someMessage
     application notNil ifTrue:[
-        application showActivity:someMessage
+	application showActivity:someMessage
     ]
 
     "Created: 16.12.1995 / 18:40:44 / cg"
@@ -936,5 +944,5 @@
 !StandardSystemView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Attic/StdSysV.st,v 1.39 1995-12-16 17:43:19 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Attic/StdSysV.st,v 1.40 1996-01-27 15:35:07 cg Exp $'
 ! !
--- a/WGroup.st	Sat Jan 27 16:03:24 1996 +0100
+++ b/WGroup.st	Sat Jan 27 16:35:09 1996 +0100
@@ -778,6 +778,24 @@
 			    self focusPrevious.
 			    ignore := true
 			].
+			event key == #Tab ifTrue:[
+			    focusView notNil ifTrue:[
+				focusView canTab ifTrue:[
+				    self focusNext.    
+				    ignore := true
+				]
+			    ] ifFalse:[
+				pointerView notNil ifTrue:[
+				    pointerView canTab ifTrue:[
+					self focusNext.
+					ignore := true.
+				    ]
+				] ifFalse:[
+				    self focusNext.
+				    ignore := true.
+				]
+			    ]
+			].
 		    ].
 		    event isPointerEnterEvent ifTrue:[
 			pointerView := event view
@@ -949,17 +967,17 @@
     "give focus to aViewOrNil"
 
     focusView notNil ifTrue:[
-	focusView focusOut.
+	focusView showNoFocus:true. "/ focusOut.
     ] ifFalse:[
 	pointerView notNil ifTrue:[
 	    pointerView ~~ aViewOrNil ifTrue:[
-		pointerView focusOut
+		pointerView showNoFocus:false "/ focusOut
 	    ]
 	].
     ].
     focusView := aViewOrNil.
     focusView notNil ifTrue:[
-	focusView focusIn
+	focusView showFocus:true. "/ focusIn
     ].
 
     "
@@ -972,7 +990,7 @@
      top windowGroup focusView:v1.
     "
 
-    "Modified: 9.1.1996 / 15:48:12 / cg"
+    "Modified: 27.1.1996 / 13:11:16 / cg"
 ! !
 
 !WindowGroup methodsFor:'initialization'!
@@ -1134,6 +1152,6 @@
 !WindowGroup class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Attic/WGroup.st,v 1.56 1996-01-26 17:43:40 ah Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Attic/WGroup.st,v 1.57 1996-01-27 15:35:09 cg Exp $'
 ! !
 WindowGroup initialize!
--- a/WindowGroup.st	Sat Jan 27 16:03:24 1996 +0100
+++ b/WindowGroup.st	Sat Jan 27 16:35:09 1996 +0100
@@ -778,6 +778,24 @@
 			    self focusPrevious.
 			    ignore := true
 			].
+			event key == #Tab ifTrue:[
+			    focusView notNil ifTrue:[
+				focusView canTab ifTrue:[
+				    self focusNext.    
+				    ignore := true
+				]
+			    ] ifFalse:[
+				pointerView notNil ifTrue:[
+				    pointerView canTab ifTrue:[
+					self focusNext.
+					ignore := true.
+				    ]
+				] ifFalse:[
+				    self focusNext.
+				    ignore := true.
+				]
+			    ]
+			].
 		    ].
 		    event isPointerEnterEvent ifTrue:[
 			pointerView := event view
@@ -949,17 +967,17 @@
     "give focus to aViewOrNil"
 
     focusView notNil ifTrue:[
-	focusView focusOut.
+	focusView showNoFocus:true. "/ focusOut.
     ] ifFalse:[
 	pointerView notNil ifTrue:[
 	    pointerView ~~ aViewOrNil ifTrue:[
-		pointerView focusOut
+		pointerView showNoFocus:false "/ focusOut
 	    ]
 	].
     ].
     focusView := aViewOrNil.
     focusView notNil ifTrue:[
-	focusView focusIn
+	focusView showFocus:true. "/ focusIn
     ].
 
     "
@@ -972,7 +990,7 @@
      top windowGroup focusView:v1.
     "
 
-    "Modified: 9.1.1996 / 15:48:12 / cg"
+    "Modified: 27.1.1996 / 13:11:16 / cg"
 ! !
 
 !WindowGroup methodsFor:'initialization'!
@@ -1134,6 +1152,6 @@
 !WindowGroup class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.56 1996-01-26 17:43:40 ah Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.57 1996-01-27 15:35:09 cg Exp $'
 ! !
 WindowGroup initialize!