author | Claus Gittinger <cg@exept.de> |
Wed, 07 May 1997 15:09:22 +0200 | |
changeset 574 | a4fe01515dc1 |
parent 327 | 08f7c1c026b6 |
child 1173 | 8c6ccf98efd9 |
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 |
||
327
08f7c1c026b6
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
222
diff
changeset
|
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 |
||
115 |
pointerEnter:state x:x y:y view:view |
|
574 | 116 |
"not handled here - should be redefined in a concrete subclass" |
213 | 117 |
|
60 | 118 |
^ false |
119 |
||
213 | 120 |
"Modified: 23.4.1996 / 21:58:14 / cg" |
60 | 121 |
! |
122 |
||
123 | 123 |
pointerLeave:state view:view |
574 | 124 |
"not handled here - should be redefined in a concrete subclass" |
213 | 125 |
|
60 | 126 |
^ false |
127 |
||
213 | 128 |
"Modified: 23.4.1996 / 21:58:17 / cg" |
60 | 129 |
! ! |
130 |
||
574 | 131 |
!EventListener methodsFor:'events - window creation'! |
132 |
||
133 |
preCreateView:aView origin:org |
|
134 |
"invoked right before a view is about to be physically created. |
|
135 |
May return a new origin." |
|
136 |
||
137 |
^ org |
|
138 |
! |
|
139 |
||
140 |
postCreateView:aView |
|
141 |
"invoked right after a view was physically created." |
|
142 |
||
143 |
^ self |
|
144 |
! ! |
|
145 |
||
60 | 146 |
!EventListener methodsFor:'listen'! |
147 |
||
148 |
listen |
|
149 |
"install myself as listener" |
|
150 |
||
151 |
WindowSensor eventListener:self |
|
152 |
||
153 |
" |
|
154 |
|listener| |
|
155 |
||
156 |
listener := EventListener new. |
|
157 |
listener listen. |
|
158 |
(Delay forSeconds:20) wait. |
|
159 |
listener unlisten |
|
160 |
" |
|
161 |
! |
|
162 |
||
163 |
unlisten |
|
164 |
"uninstall myself as listener" |
|
165 |
||
166 |
WindowSensor eventListener:nil |
|
167 |
! ! |
|
123 | 168 |
|
327
08f7c1c026b6
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
222
diff
changeset
|
169 |
!EventListener class methodsFor:'documentation'! |
127 | 170 |
|
171 |
version |
|
574 | 172 |
^ '$Header: /cvs/stx/stx/libview2/EventListener.st,v 1.13 1997-05-07 13:09:22 cg Exp $' |
127 | 173 |
! ! |