author | Claus Gittinger <cg@exept.de> |
Tue, 25 May 1999 18:02:25 +0200 | |
changeset 1178 | 44f1fee1b444 |
parent 1176 | c3235dffc880 |
child 1262 | 9b691fdaae56 |
permissions | -rw-r--r-- |
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 |
||
1173 | 22 |
!EventListener class methodsFor:'documentation'! |
60 | 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. |
|
574 | 45 |
A concrete application is the bubble help, which tracks entering/leaving |
46 |
views, and pops up some help message. |
|
47 |
See concrete code in ActiveHelp. |
|
48 |
||
98 | 49 |
For each intercepted event, a corresponding method is called for in instances |
574 | 50 |
of myself - these MUST return true, if the event is to be ignored (i.e. |
51 |
assumed to be processed and consumed by the reader, |
|
52 |
and MUST return false, if the normal event procedure should be performed. |
|
53 |
Since this is an abstract class, |
|
54 |
all of my intercept methods return false. |
|
55 |
They are meant to be redefined in concrete subclasses. |
|
212 | 56 |
|
57 |
[see also:] |
|
574 | 58 |
WindowSensor WindowEvent WindowGroup |
222 | 59 |
|
60 |
[author:] |
|
574 | 61 |
Claus Gittinger |
60 | 62 |
" |
63 |
! ! |
|
64 |
||
65 |
!EventListener methodsFor:'events'! |
|
66 |
||
123 | 67 |
buttonMotion:state x:x y:y view:aView |
574 | 68 |
"not handled here - should be redefined in a concrete subclass" |
213 | 69 |
|
60 | 70 |
^ false |
213 | 71 |
|
72 |
"Modified: 23.4.1996 / 21:57:54 / cg" |
|
60 | 73 |
! |
74 |
||
75 |
buttonMultiPress:button x:x y:y view:aView |
|
574 | 76 |
"not handled here - should be redefined in a concrete subclass" |
213 | 77 |
|
60 | 78 |
^ false |
79 |
||
213 | 80 |
"Modified: 23.4.1996 / 21:57:58 / cg" |
60 | 81 |
! |
82 |
||
83 |
buttonPress:button x:x y:y view:aView |
|
574 | 84 |
"not handled here - should be redefined in a concrete subclass" |
213 | 85 |
|
60 | 86 |
^ false |
87 |
||
213 | 88 |
"Modified: 23.4.1996 / 21:58:01 / cg" |
60 | 89 |
! |
90 |
||
123 | 91 |
buttonRelease:button x:x y:y view:aView |
574 | 92 |
"not handled here - should be redefined in a concrete subclass" |
213 | 93 |
|
60 | 94 |
^ false |
123 | 95 |
|
213 | 96 |
"Modified: 23.4.1996 / 21:58:03 / cg" |
60 | 97 |
! |
98 |
||
123 | 99 |
keyPress:key x:x y:y view:aView |
574 | 100 |
"not handled here - should be redefined in a concrete subclass" |
213 | 101 |
|
123 | 102 |
^ false |
103 |
||
213 | 104 |
"Modified: 23.4.1996 / 21:58:08 / cg" |
123 | 105 |
! |
106 |
||
107 |
keyRelease:key x:x y:y view:aView |
|
574 | 108 |
"not handled here - should be redefined in a concrete subclass" |
213 | 109 |
|
60 | 110 |
^ false |
111 |
||
213 | 112 |
"Modified: 23.4.1996 / 21:58:11 / cg" |
60 | 113 |
! |
114 |
||
1178
44f1fee1b444
pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents:
1176
diff
changeset
|
115 |
mouseWheelMotion:state x:x y:y amount:amount deltaTime:dTime view:aView |
1173 | 116 |
"not handled here - can be redefined in a concrete subclass" |
117 |
||
118 |
^ false |
|
119 |
||
120 |
"Modified: / 23.4.1996 / 21:57:54 / cg" |
|
121 |
"Created: / 21.5.1999 / 13:07:13 / cg" |
|
122 |
! |
|
123 |
||
60 | 124 |
pointerEnter:state x:x y:y view:view |
574 | 125 |
"not handled here - should be redefined in a concrete subclass" |
213 | 126 |
|
60 | 127 |
^ false |
128 |
||
213 | 129 |
"Modified: 23.4.1996 / 21:58:14 / cg" |
60 | 130 |
! |
131 |
||
123 | 132 |
pointerLeave:state view:view |
574 | 133 |
"not handled here - should be redefined in a concrete subclass" |
213 | 134 |
|
60 | 135 |
^ false |
136 |
||
213 | 137 |
"Modified: 23.4.1996 / 21:58:17 / cg" |
60 | 138 |
! ! |
139 |
||
574 | 140 |
!EventListener methodsFor:'events - window creation'! |
141 |
||
1173 | 142 |
postCreateView:aView |
143 |
"invoked right after a view was physically created." |
|
144 |
||
145 |
^ self |
|
146 |
! |
|
147 |
||
574 | 148 |
preCreateView:aView origin:org |
149 |
"invoked right before a view is about to be physically created. |
|
150 |
May return a new origin." |
|
151 |
||
152 |
^ org |
|
153 |
! ! |
|
154 |
||
60 | 155 |
!EventListener methodsFor:'listen'! |
156 |
||
157 |
listen |
|
158 |
"install myself as listener" |
|
159 |
||
160 |
WindowSensor eventListener:self |
|
161 |
||
162 |
" |
|
163 |
|listener| |
|
164 |
||
165 |
listener := EventListener new. |
|
166 |
listener listen. |
|
167 |
(Delay forSeconds:20) wait. |
|
168 |
listener unlisten |
|
169 |
" |
|
170 |
! |
|
171 |
||
172 |
unlisten |
|
173 |
"uninstall myself as listener" |
|
174 |
||
175 |
WindowSensor eventListener:nil |
|
176 |
! ! |
|
123 | 177 |
|
1173 | 178 |
!EventListener class methodsFor:'documentation'! |
127 | 179 |
|
180 |
version |
|
1178
44f1fee1b444
pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents:
1176
diff
changeset
|
181 |
^ '$Header: /cvs/stx/stx/libview2/EventListener.st,v 1.16 1999-05-25 16:02:25 cg Exp $' |
127 | 182 |
! ! |