PopUpListController.st
author claus
Thu, 07 Sep 1995 14:46:28 +0200
changeset 155 d6f3836d2b51
parent 136 80d2240b2cdc
child 174 d80a6cc3f9b2
permissions -rw-r--r--
.

"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

'From Smalltalk/X, Version:2.10.6 on 4-aug-1995 at 1:24:43 am'                  !

ButtonController subclass:#PopUpListController
	 instanceVariableNames:''
	 classVariableNames:''
	 poolDictionaries:''
	 category:'Interface-Support-Controllers'
!

PopUpListController comment:'
COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

$Header: /cvs/stx/stx/libwidg/PopUpListController.st,v 1.2 1995-09-07 12:45:41 claus Exp $
'!

!PopUpListController class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

version
"
$Header: /cvs/stx/stx/libwidg/PopUpListController.st,v 1.2 1995-09-07 12:45:41 claus Exp $
"
!

documentation
"
    redefined the behavior on various keys if my view has the focus.
"
! !

!PopUpListController methodsFor:'event handling'!

keyPress:key x:x y:y
    "pull menu on Return and space, if I am the focusView of my group
     (i.e. if I got an explicit focus)"

    <resource: #keyboard (#CursorUp #CursorDown)>

    view hasFocus ifTrue:[
	(key == #Return) ifTrue:[
	    view menu shown ifTrue:[
		self halt.
		^ self.
	    ].
	].
	(key == #CursorUp or:[key == #CursorDown]) ifTrue:[
	    view menu shown ifTrue:[
		key == #CursorUp ifTrue:[view menu selectNext]
				 ifFalse:[view menu selectPrevious].
		^ self.
	    ].
	].
	(key == #Return or:[key == Character space]) ifTrue:[
	    view menu exclusivePointer:false.
	    view menu hideOnRelease:true.
	    view popMenu.
	    view menu exclusivePointer:true.
	    ^ self.
	]
    ].
    view keyPress:key x:x y:y
! !