ToggleC.st
author claus
Sat, 18 Mar 1995 06:16:33 +0100
changeset 104 ca75c90df7a9
parent 88 7560534e9026
child 119 59758ff5b841
permissions -rw-r--r--
Initial revision

"
 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.
"

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

!ToggleController 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/Attic/ToggleC.st,v 1.2 1995-02-17 13:23:13 claus Exp $
"
!

documentation
"
    ToggleControllers redefine some of ButtonControllers behavior;
    user interaction: they always triggerOnDown, and ignore buttonrelease.
    Finally, every buttonPress leads to a toggle action.
"
! !

!ToggleController methodsFor:'initialization '!

initialize
    super initialize.
    triggerOnDown := true
! !

!ToggleController methodsFor:'event handling'!

buttonRelease:button x:x y:y
    ((button == 1) or:[button == #select]) ifFalse:[
	^ super buttonRelease:button x:x y:y
    ].
    "ignore"
!

buttonPress:button x:x y:y
    ((button == 1) or:[button == #select]) ifTrue:[
	view toggle
    ] ifFalse:[
	^ super buttonPress:button x:x y:y
    ].
! !