EventListener.st
author Claus Gittinger <cg@exept.de>
Thu, 25 Apr 1996 18:32:07 +0200
changeset 221 ea942fe5dc04
parent 213 9fac751c6499
child 222 c51b06f6bf9a
permissions -rw-r--r--
documentation

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



Object subclass:#EventListener
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Support'
!

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


!

documentation
"
    abstract class for event listeners. EventListeners can be used to intercept
    incoming events (keyboard & mouse) directly from a sensor, or even
    for a complete display device.
    One application is the automatic help, which tracks entering/leaving
    views, to popup some help message. See concrete code in ActiveHelp.
    For each intercepted event, a corresponding method is called for in instances
    of myself - these should return true, if the event is to be ignored (i.e.
    assumed to be processed and consumed by the reader, or false, if the normal
    event procedure should be performed. Since this is an abstract class,
    all of my intercept methods return false. They are meant to be redefined
    in concrete subclasses.

    [see also:]
        WindowSensor WindowEvent WindowGroup
"
! !

!EventListener methodsFor:'events'!

buttonMotion:state x:x y:y view:aView
    "not handled here - should be redefined in a concrete subclas"

    ^ false

    "Modified: 23.4.1996 / 21:57:54 / cg"
!

buttonMultiPress:button x:x y:y view:aView
    "not handled here - should be redefined in a concrete subclas"

    ^ false

    "Modified: 23.4.1996 / 21:57:58 / cg"
!

buttonPress:button x:x y:y view:aView
    "not handled here - should be redefined in a concrete subclas"

    ^ false

    "Modified: 23.4.1996 / 21:58:01 / cg"
!

buttonRelease:button x:x y:y view:aView
    "not handled here - should be redefined in a concrete subclas"

    ^ false

    "Modified: 23.4.1996 / 21:58:03 / cg"
!

buttonShiftPress:button x:x y:y view:aView
    "not handled here - should be redefined in a concrete subclas"

    ^ false

    "Modified: 23.4.1996 / 21:58:06 / cg"
!

keyPress:key x:x y:y view:aView
    "not handled here - should be redefined in a concrete subclas"

    ^ false

    "Modified: 23.4.1996 / 21:58:08 / cg"
!

keyRelease:key x:x y:y view:aView
    "not handled here - should be redefined in a concrete subclas"

    ^ false

    "Modified: 23.4.1996 / 21:58:11 / cg"
!

pointerEnter:state x:x y:y view:view
    "not handled here - should be redefined in a concrete subclas"

    ^ false

    "Modified: 23.4.1996 / 21:58:14 / cg"
!

pointerLeave:state view:view
    "not handled here - should be redefined in a concrete subclas"

    ^ false

    "Modified: 23.4.1996 / 21:58:17 / cg"
! !

!EventListener methodsFor:'listen'!

listen
    "install myself as listener"

    WindowSensor eventListener:self

    "
     |listener|

     listener := EventListener new.
     listener listen.
     (Delay forSeconds:20) wait.
     listener unlisten
    "
!

unlisten
    "uninstall myself as listener"

    WindowSensor eventListener:nil 
! !

!EventListener class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libview2/EventListener.st,v 1.10 1996-04-23 19:58:32 cg Exp $'
! !