60
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
77
|
3 |
All Rights Reserved
|
60
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
'From Smalltalk/X, Version:2.10.5 on 25-mar-1995 at 11:44:17 am'!
|
|
16 |
|
|
17 |
Object subclass:#EventListener
|
77
|
18 |
instanceVariableNames:''
|
60
|
19 |
classVariableNames:''
|
|
20 |
poolDictionaries:''
|
77
|
21 |
category:'Interface-Support'
|
60
|
22 |
!
|
|
23 |
|
|
24 |
!EventListener class methodsFor:'documentation'!
|
|
25 |
|
|
26 |
version
|
|
27 |
"
|
98
|
28 |
$Header: /cvs/stx/stx/libview2/EventListener.st,v 1.5 1995-08-29 23:43:11 claus Exp $
|
60
|
29 |
"
|
|
30 |
!
|
|
31 |
|
|
32 |
documentation
|
|
33 |
"
|
98
|
34 |
abstract class for event listeners. EventListeners can be used to intercept
|
|
35 |
incoming events (keyboard & mouse) directly from a sensor, or even
|
|
36 |
for a complete display device.
|
|
37 |
One application is the automatic help, which tracks entering/leaving
|
|
38 |
views, to popup some help message. See concrete code in ActiveHelp.
|
|
39 |
For each intercepted event, a corresponding method is called for in instances
|
|
40 |
of myself - these should return true, if the event is to be ignored (i.e.
|
|
41 |
assumed to be processed and consumed by the reader, or false, if the normal
|
|
42 |
event procedure should be performed. Since this is an abstract class,
|
|
43 |
all of my intercept methods return false. They are meant to be redefined
|
|
44 |
in concrete subclasses.
|
60
|
45 |
"
|
|
46 |
!
|
|
47 |
|
|
48 |
copyright
|
|
49 |
"
|
|
50 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
77
|
51 |
All Rights Reserved
|
60
|
52 |
|
|
53 |
This software is furnished under a license and may be used
|
|
54 |
only in accordance with the terms of that license and with the
|
|
55 |
inclusion of the above copyright notice. This software may not
|
|
56 |
be provided or otherwise made available to, or used by, any
|
|
57 |
other person. No title to or ownership of the software is
|
|
58 |
hereby transferred.
|
|
59 |
"
|
|
60 |
|
|
61 |
|
|
62 |
! !
|
|
63 |
|
|
64 |
!EventListener methodsFor:'events'!
|
|
65 |
|
|
66 |
buttonRelease:button x:x y:y view:aView
|
|
67 |
^ false
|
|
68 |
|
|
69 |
!
|
|
70 |
|
|
71 |
keyPress:key x:x y:y view:aView
|
|
72 |
^ false
|
|
73 |
|
|
74 |
!
|
|
75 |
|
|
76 |
buttonMultiPress:button x:x y:y view:aView
|
|
77 |
^ false
|
|
78 |
|
|
79 |
!
|
|
80 |
|
|
81 |
buttonPress:button x:x y:y view:aView
|
|
82 |
^ false
|
|
83 |
|
|
84 |
!
|
|
85 |
|
|
86 |
buttonMotion:state x:x y:y view:aView
|
|
87 |
^ false
|
|
88 |
!
|
|
89 |
|
|
90 |
pointerLeave:state view:view
|
|
91 |
^ false
|
|
92 |
|
|
93 |
!
|
|
94 |
|
|
95 |
pointerEnter:state x:x y:y view:view
|
|
96 |
^ false
|
|
97 |
|
|
98 |
!
|
|
99 |
|
|
100 |
buttonShiftPress:button x:x y:y view:aView
|
|
101 |
^ false
|
|
102 |
|
|
103 |
!
|
|
104 |
|
|
105 |
keyRelease:key x:x y:y view:aView
|
|
106 |
^ false
|
|
107 |
|
|
108 |
! !
|
|
109 |
|
|
110 |
!EventListener methodsFor:'listen'!
|
|
111 |
|
|
112 |
listen
|
|
113 |
"install myself as listener"
|
|
114 |
|
|
115 |
WindowSensor eventListener:self
|
|
116 |
|
|
117 |
"
|
|
118 |
|listener|
|
|
119 |
|
|
120 |
listener := EventListener new.
|
|
121 |
listener listen.
|
|
122 |
(Delay forSeconds:20) wait.
|
|
123 |
listener unlisten
|
|
124 |
"
|
|
125 |
!
|
|
126 |
|
|
127 |
unlisten
|
|
128 |
"uninstall myself as listener"
|
|
129 |
|
|
130 |
WindowSensor eventListener:nil
|
|
131 |
! !
|