EventMonitor.st
author Claus Gittinger <cg@exept.de>
Tue, 25 Jun 1996 21:48:47 +0200
changeset 640 7608b07af7bb
parent 433 703d84558f6f
child 1021 31349a9be7ac
permissions -rw-r--r--
show untranslated key as well

"
 COPYRIGHT (c) 1991 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.
"

StandardSystemView subclass:#EventMonitor
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Tools'
!

!EventMonitor  class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1991 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
"
    like xev - show events.
    You can use this to check your keyboard mappings, for example.
    start with: 
	EventMonitor open
    and watch the output on xterm.
"
! !

!EventMonitor  class methodsFor:'defaults'!

defaultExtent
    ^ 200 @ 200
!

defaultLabel
    ^ 'Event Monitor'
! !

!EventMonitor methodsFor:'events'!

buttonMotion:state x:x y:y
    'buttonMotion x:' print. x print. ' y:' print. y print.
    ' state:' print. state printNL
!

buttonPress:button x:x y:y
    'buttonPress x:' print. x print. ' y:' print. y print.
    ' button:' print. button printNL
!

buttonRelease:button x:x y:y
    'buttonRelease x:' print. x print. ' y:' print. y print.
    ' button:' print. button printNL
!

configureX:x y:y width:newWidth height:newHeight
    'configure x:' print. x print. ' y:' print. y print.
    ' width:' print. newWidth print. ' height:' print. newHeight printNL.

    ^ super configureX:x y:y width:newWidth height:newHeight

    "Modified: 7.3.1996 / 15:05:15 / cg"
!

focusIn
    'focusIn' printNL.

    "Created: 7.3.1996 / 15:06:18 / cg"
!

focusOut
    'focusOut' printNL.

    "Created: 7.3.1996 / 15:06:21 / cg"
!

keyPress:key x:x y:y
    |untranslatedKey|

    'KeyPress x:' print. x print. ' y:' print. y print.
    (key isMemberOf:Character) ifTrue:[
        ' character key:' print. key print.
        ' (' print. key asciiValue print. ')' print
    ] ifFalse:[
        ' symbolic key:' print. key storeString print.
        untranslatedKey := device keyboardMap keyAtValue:key ifAbsent:key.
        untranslatedKey ~~ key ifTrue:[
            ' untranslated key:' print. untranslatedKey print
        ]
    ].

    '' printCR
!

keyRelease:key x:x y:y
    |untranslatedKey|

    'KeyRelease x:' print. x print. ' y:' print. y print.
    (key isMemberOf:Character) ifTrue:[
        ' character key:' print. key print.
        ' (' print. key asciiValue print. ')' print
    ] ifFalse:[
        ' symbolic key:' print. key storeString print.
        untranslatedKey := device keyboardMap keyAtValue:key ifAbsent:key.
        untranslatedKey ~~ key ifTrue:[
            ' untranslated key:' print. untranslatedKey print
        ]
    ].

    '' printCR
!

mapped
    'mapped' printNL
!

pointerEnter:state x:x y:y
    'pointerEnter x:' print. x print. ' y:' print. y print.
    ' state:' print. state printNL
!

pointerLeave:state 
    'pointerLeave state:' print. state printNL
!

unmapped
    'unmapped' printNL
!

visibilityChange:how
    'visibilityChange:' print. how storeString printNL
! !

!EventMonitor methodsFor:'initialization'!

initialize
    |l|

    super initialize.

    l := Label label:'see event trace\on standard output' withCRs in:self.
    l borderWidth:0
! !

!EventMonitor methodsFor:'realization'!

initEvents
"/    self enableButtonEvents.
"/    self enableButtonMotionEvents.
    self enableMotionEvents.
    self enableKeyReleaseEvents.
    self enableEnterLeaveEvents.
    self enableFocusEvents.
    self enableEvent:#visibilityChange

    "Modified: 7.3.1996 / 15:06:42 / cg"
! !

!EventMonitor  class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/EventMonitor.st,v 1.12 1996-06-25 19:48:47 cg Exp $'
! !