StdSysV.st
changeset 89 ea2bf46eb669
parent 82 98a70bce6d51
child 94 8931597dfa3c
--- a/StdSysV.st	Mon Feb 06 01:30:10 1995 +0100
+++ b/StdSysV.st	Mon Feb 06 01:38:04 1995 +0100
@@ -13,7 +13,7 @@
 View subclass:#StandardSystemView
        instanceVariableNames:'label icon iconView iconLabel
 			      minExtent maxExtent'
-       classVariableNames:   'DefaultIcon'
+       classVariableNames:   'DefaultIcon TakeFocusWhenMapped'
        poolDictionaries:''
        category:'Views-Basic'
 !
@@ -22,7 +22,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/Attic/StdSysV.st,v 1.14 1994-11-21 16:43:21 claus Exp $
+$Header: /cvs/stx/stx/libview/Attic/StdSysV.st,v 1.15 1995-02-06 00:37:53 claus Exp $
 '!
 
 !StandardSystemView class methodsFor:'documentation'!
@@ -43,7 +43,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/Attic/StdSysV.st,v 1.14 1994-11-21 16:43:21 claus Exp $
+$Header: /cvs/stx/stx/libview/Attic/StdSysV.st,v 1.15 1995-02-06 00:37:53 claus Exp $
 "
 !
 
@@ -113,7 +113,7 @@
 		 minExtent:minExtent
 		 maxExtent:nil.
     newView model:aModel.
-    newView controller:(self defaultController new view:newView).
+"/    newView controller:(self defaultController new view:newView).
     ^ newView
 !
 
@@ -223,10 +223,15 @@
     name := self class name.
 !
 
+initEvents
+    super initEvents.
+    self enableFocusEvents.
+!
+
 defaultController
     "for ST-80 compatibility only - not used in ST/X"
 
-    ^ StandardSystemController
+    ^ nil "/ StandardSystemController
 !
 
 addToCurrentProject
@@ -284,13 +289,8 @@
     "if I was mapped, do it again"
     realized ifTrue:[
 	"if it was iconified, try to remap iconified"
-	shown ifFalse:[
-	    device mapView:self id:drawableId iconified:true
-		       atX:left y:top width:width height:height
-	] ifTrue:[
-	    device mapView:self id:drawableId iconified:false
-		       atX:left y:top width:width height:height
-	].
+	device mapView:self id:drawableId iconified:(shown not) 
+		   atX:left y:top width:width height:height.
 
 	"and restart the window-group process"
 	windowGroup notNil ifTrue:[
@@ -336,6 +336,23 @@
 	'moving view into visible area' errorPrintNewline.
 	self origin:(device width - dX) @ (device height - dY)
     ]
+!
+
+realize
+    super realize.
+    windowGroup notNil ifTrue:[
+	windowGroup focusSequence:(self focusSequence)
+    ]
+!
+
+focusSequence
+    "return a sequence which defines the order in which the focus
+     is passed for FocusNext and FocusPrevious keys.
+     All views which like to support these keys should redefine
+     this method and return a collection of (sub-) views"
+
+    ^ nil
+
 ! !
 
 !StandardSystemView methodsFor:'destroying'!
@@ -653,3 +670,44 @@
 	]
     ]
 ! !
+
+!StandardSystemView methodsFor:'event handling'!
+
+focusOut
+    "the view lost keyboard focus"
+
+    |v|
+
+    windowGroup notNil ifTrue:[
+	(v := windowGroup focusView) notNil ifTrue:[
+	    v showNoFocus
+	]
+    ].
+!
+
+focusIn
+    "the view got the keyboard focus"
+
+    |v|
+
+    windowGroup notNil ifTrue:[
+	(v := windowGroup focusView) notNil ifTrue:[
+	    v showFocus
+	]
+    ].
+!
+
+mapped
+    "the view got mapped"
+
+    super mapped.
+    "
+     ask for the focus - this avoids having to click on the
+     view with WM's which need an explicit click.
+     Q: is this a good idea ?
+    "
+    TakeFocusWhenMapped == true ifTrue:[
+	self getKeyboardFocus.
+    ]
+! !
+