StdSysV.st
changeset 89 ea2bf46eb669
parent 82 98a70bce6d51
child 94 8931597dfa3c
equal deleted inserted replaced
88:8f9c629a4245 89:ea2bf46eb669
    11 "
    11 "
    12 
    12 
    13 View subclass:#StandardSystemView
    13 View subclass:#StandardSystemView
    14        instanceVariableNames:'label icon iconView iconLabel
    14        instanceVariableNames:'label icon iconView iconLabel
    15 			      minExtent maxExtent'
    15 			      minExtent maxExtent'
    16        classVariableNames:   'DefaultIcon'
    16        classVariableNames:   'DefaultIcon TakeFocusWhenMapped'
    17        poolDictionaries:''
    17        poolDictionaries:''
    18        category:'Views-Basic'
    18        category:'Views-Basic'
    19 !
    19 !
    20 
    20 
    21 StandardSystemView comment:'
    21 StandardSystemView comment:'
    22 COPYRIGHT (c) 1989 by Claus Gittinger
    22 COPYRIGHT (c) 1989 by Claus Gittinger
    23 	      All Rights Reserved
    23 	      All Rights Reserved
    24 
    24 
    25 $Header: /cvs/stx/stx/libview/Attic/StdSysV.st,v 1.14 1994-11-21 16:43:21 claus Exp $
    25 $Header: /cvs/stx/stx/libview/Attic/StdSysV.st,v 1.15 1995-02-06 00:37:53 claus Exp $
    26 '!
    26 '!
    27 
    27 
    28 !StandardSystemView class methodsFor:'documentation'!
    28 !StandardSystemView class methodsFor:'documentation'!
    29 
    29 
    30 copyright
    30 copyright
    41 "
    41 "
    42 !
    42 !
    43 
    43 
    44 version
    44 version
    45 "
    45 "
    46 $Header: /cvs/stx/stx/libview/Attic/StdSysV.st,v 1.14 1994-11-21 16:43:21 claus Exp $
    46 $Header: /cvs/stx/stx/libview/Attic/StdSysV.st,v 1.15 1995-02-06 00:37:53 claus Exp $
    47 "
    47 "
    48 !
    48 !
    49 
    49 
    50 documentation
    50 documentation
    51 "
    51 "
   111 		     label:aLabel 
   111 		     label:aLabel 
   112 		      icon:nil
   112 		      icon:nil
   113 		 minExtent:minExtent
   113 		 minExtent:minExtent
   114 		 maxExtent:nil.
   114 		 maxExtent:nil.
   115     newView model:aModel.
   115     newView model:aModel.
   116     newView controller:(self defaultController new view:newView).
   116 "/    newView controller:(self defaultController new view:newView).
   117     ^ newView
   117     ^ newView
   118 !
   118 !
   119 
   119 
   120 label:aLabel
   120 label:aLabel
   121     "create a new topView and define its label"
   121     "create a new topView and define its label"
   221     maxExtent := (device width) @ (device height).
   221     maxExtent := (device width) @ (device height).
   222     icon := self class defaultIcon.
   222     icon := self class defaultIcon.
   223     name := self class name.
   223     name := self class name.
   224 !
   224 !
   225 
   225 
       
   226 initEvents
       
   227     super initEvents.
       
   228     self enableFocusEvents.
       
   229 !
       
   230 
   226 defaultController
   231 defaultController
   227     "for ST-80 compatibility only - not used in ST/X"
   232     "for ST-80 compatibility only - not used in ST/X"
   228 
   233 
   229     ^ StandardSystemController
   234     ^ nil "/ StandardSystemController
   230 !
   235 !
   231 
   236 
   232 addToCurrentProject
   237 addToCurrentProject
   233     "add the receiver (a topview) to the current projects set-of-views.
   238     "add the receiver (a topview) to the current projects set-of-views.
   234      (If there is a current project)"
   239      (If there is a current project)"
   282     self recreate.
   287     self recreate.
   283 
   288 
   284     "if I was mapped, do it again"
   289     "if I was mapped, do it again"
   285     realized ifTrue:[
   290     realized ifTrue:[
   286 	"if it was iconified, try to remap iconified"
   291 	"if it was iconified, try to remap iconified"
   287 	shown ifFalse:[
   292 	device mapView:self id:drawableId iconified:(shown not) 
   288 	    device mapView:self id:drawableId iconified:true
   293 		   atX:left y:top width:width height:height.
   289 		       atX:left y:top width:width height:height
       
   290 	] ifTrue:[
       
   291 	    device mapView:self id:drawableId iconified:false
       
   292 		       atX:left y:top width:width height:height
       
   293 	].
       
   294 
   294 
   295 	"and restart the window-group process"
   295 	"and restart the window-group process"
   296 	windowGroup notNil ifTrue:[
   296 	windowGroup notNil ifTrue:[
   297 	    windowGroup restart
   297 	    windowGroup restart
   298 	]
   298 	]
   334     ((self left > (device width - dX)) or:[
   334     ((self left > (device width - dX)) or:[
   335       self top > (device height - dY)]) ifTrue:[
   335       self top > (device height - dY)]) ifTrue:[
   336 	'moving view into visible area' errorPrintNewline.
   336 	'moving view into visible area' errorPrintNewline.
   337 	self origin:(device width - dX) @ (device height - dY)
   337 	self origin:(device width - dX) @ (device height - dY)
   338     ]
   338     ]
       
   339 !
       
   340 
       
   341 realize
       
   342     super realize.
       
   343     windowGroup notNil ifTrue:[
       
   344 	windowGroup focusSequence:(self focusSequence)
       
   345     ]
       
   346 !
       
   347 
       
   348 focusSequence
       
   349     "return a sequence which defines the order in which the focus
       
   350      is passed for FocusNext and FocusPrevious keys.
       
   351      All views which like to support these keys should redefine
       
   352      this method and return a collection of (sub-) views"
       
   353 
       
   354     ^ nil
       
   355 
   339 ! !
   356 ! !
   340 
   357 
   341 !StandardSystemView methodsFor:'destroying'!
   358 !StandardSystemView methodsFor:'destroying'!
   342 
   359 
   343 destroy
   360 destroy
   651 	 [height > (maxExtent y)]) ifTrue: [
   668 	 [height > (maxExtent y)]) ifTrue: [
   652 	    self extent:maxExtent
   669 	    self extent:maxExtent
   653 	]
   670 	]
   654     ]
   671     ]
   655 ! !
   672 ! !
       
   673 
       
   674 !StandardSystemView methodsFor:'event handling'!
       
   675 
       
   676 focusOut
       
   677     "the view lost keyboard focus"
       
   678 
       
   679     |v|
       
   680 
       
   681     windowGroup notNil ifTrue:[
       
   682 	(v := windowGroup focusView) notNil ifTrue:[
       
   683 	    v showNoFocus
       
   684 	]
       
   685     ].
       
   686 !
       
   687 
       
   688 focusIn
       
   689     "the view got the keyboard focus"
       
   690 
       
   691     |v|
       
   692 
       
   693     windowGroup notNil ifTrue:[
       
   694 	(v := windowGroup focusView) notNil ifTrue:[
       
   695 	    v showFocus
       
   696 	]
       
   697     ].
       
   698 !
       
   699 
       
   700 mapped
       
   701     "the view got mapped"
       
   702 
       
   703     super mapped.
       
   704     "
       
   705      ask for the focus - this avoids having to click on the
       
   706      view with WM's which need an explicit click.
       
   707      Q: is this a good idea ?
       
   708     "
       
   709     TakeFocusWhenMapped == true ifTrue:[
       
   710 	self getKeyboardFocus.
       
   711     ]
       
   712 ! !
       
   713