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 |
Object subclass:#EventListener
|
212
|
16 |
instanceVariableNames:''
|
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'Interface-Support'
|
60
|
20 |
!
|
|
21 |
|
|
22 |
!EventListener class methodsFor:'documentation'!
|
|
23 |
|
123
|
24 |
copyright
|
|
25 |
"
|
|
26 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
27 |
All Rights Reserved
|
|
28 |
|
|
29 |
This software is furnished under a license and may be used
|
|
30 |
only in accordance with the terms of that license and with the
|
|
31 |
inclusion of the above copyright notice. This software may not
|
|
32 |
be provided or otherwise made available to, or used by, any
|
|
33 |
other person. No title to or ownership of the software is
|
|
34 |
hereby transferred.
|
|
35 |
"
|
|
36 |
|
|
37 |
|
60
|
38 |
!
|
|
39 |
|
|
40 |
documentation
|
|
41 |
"
|
98
|
42 |
abstract class for event listeners. EventListeners can be used to intercept
|
|
43 |
incoming events (keyboard & mouse) directly from a sensor, or even
|
|
44 |
for a complete display device.
|
|
45 |
One application is the automatic help, which tracks entering/leaving
|
|
46 |
views, to popup some help message. See concrete code in ActiveHelp.
|
|
47 |
For each intercepted event, a corresponding method is called for in instances
|
|
48 |
of myself - these should return true, if the event is to be ignored (i.e.
|
|
49 |
assumed to be processed and consumed by the reader, or false, if the normal
|
|
50 |
event procedure should be performed. Since this is an abstract class,
|
|
51 |
all of my intercept methods return false. They are meant to be redefined
|
|
52 |
in concrete subclasses.
|
212
|
53 |
|
|
54 |
[see also:]
|
|
55 |
WindowSensor WindowEvent WindowGroup
|
60
|
56 |
"
|
|
57 |
! !
|
|
58 |
|
|
59 |
!EventListener methodsFor:'events'!
|
|
60 |
|
123
|
61 |
buttonMotion:state x:x y:y view:aView
|
213
|
62 |
"not handled here - should be redefined in a concrete subclas"
|
|
63 |
|
60
|
64 |
^ false
|
213
|
65 |
|
|
66 |
"Modified: 23.4.1996 / 21:57:54 / cg"
|
60
|
67 |
!
|
|
68 |
|
|
69 |
buttonMultiPress:button x:x y:y view:aView
|
213
|
70 |
"not handled here - should be redefined in a concrete subclas"
|
|
71 |
|
60
|
72 |
^ false
|
|
73 |
|
213
|
74 |
"Modified: 23.4.1996 / 21:57:58 / cg"
|
60
|
75 |
!
|
|
76 |
|
|
77 |
buttonPress:button x:x y:y view:aView
|
213
|
78 |
"not handled here - should be redefined in a concrete subclas"
|
|
79 |
|
60
|
80 |
^ false
|
|
81 |
|
213
|
82 |
"Modified: 23.4.1996 / 21:58:01 / cg"
|
60
|
83 |
!
|
|
84 |
|
123
|
85 |
buttonRelease:button x:x y:y view:aView
|
213
|
86 |
"not handled here - should be redefined in a concrete subclas"
|
|
87 |
|
60
|
88 |
^ false
|
123
|
89 |
|
213
|
90 |
"Modified: 23.4.1996 / 21:58:03 / cg"
|
60
|
91 |
!
|
|
92 |
|
123
|
93 |
buttonShiftPress:button x:x y:y view:aView
|
213
|
94 |
"not handled here - should be redefined in a concrete subclas"
|
|
95 |
|
123
|
96 |
^ false
|
|
97 |
|
213
|
98 |
"Modified: 23.4.1996 / 21:58:06 / cg"
|
123
|
99 |
!
|
|
100 |
|
|
101 |
keyPress:key x:x y:y view:aView
|
213
|
102 |
"not handled here - should be redefined in a concrete subclas"
|
|
103 |
|
123
|
104 |
^ false
|
|
105 |
|
213
|
106 |
"Modified: 23.4.1996 / 21:58:08 / cg"
|
123
|
107 |
!
|
|
108 |
|
|
109 |
keyRelease:key x:x y:y view:aView
|
213
|
110 |
"not handled here - should be redefined in a concrete subclas"
|
|
111 |
|
60
|
112 |
^ false
|
|
113 |
|
213
|
114 |
"Modified: 23.4.1996 / 21:58:11 / cg"
|
60
|
115 |
!
|
|
116 |
|
|
117 |
pointerEnter:state x:x y:y view:view
|
213
|
118 |
"not handled here - should be redefined in a concrete subclas"
|
|
119 |
|
60
|
120 |
^ false
|
|
121 |
|
213
|
122 |
"Modified: 23.4.1996 / 21:58:14 / cg"
|
60
|
123 |
!
|
|
124 |
|
123
|
125 |
pointerLeave:state view:view
|
213
|
126 |
"not handled here - should be redefined in a concrete subclas"
|
|
127 |
|
60
|
128 |
^ false
|
|
129 |
|
213
|
130 |
"Modified: 23.4.1996 / 21:58:17 / cg"
|
60
|
131 |
! !
|
|
132 |
|
|
133 |
!EventListener methodsFor:'listen'!
|
|
134 |
|
|
135 |
listen
|
|
136 |
"install myself as listener"
|
|
137 |
|
|
138 |
WindowSensor eventListener:self
|
|
139 |
|
|
140 |
"
|
|
141 |
|listener|
|
|
142 |
|
|
143 |
listener := EventListener new.
|
|
144 |
listener listen.
|
|
145 |
(Delay forSeconds:20) wait.
|
|
146 |
listener unlisten
|
|
147 |
"
|
|
148 |
!
|
|
149 |
|
|
150 |
unlisten
|
|
151 |
"uninstall myself as listener"
|
|
152 |
|
|
153 |
WindowSensor eventListener:nil
|
|
154 |
! !
|
123
|
155 |
|
127
|
156 |
!EventListener class methodsFor:'documentation'!
|
|
157 |
|
|
158 |
version
|
213
|
159 |
^ '$Header: /cvs/stx/stx/libview2/EventListener.st,v 1.10 1996-04-23 19:58:32 cg Exp $'
|
127
|
160 |
! !
|