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
|
77
|
16 |
instanceVariableNames:''
|
60
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
77
|
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.
|
60
|
53 |
"
|
|
54 |
! !
|
|
55 |
|
|
56 |
!EventListener methodsFor:'events'!
|
|
57 |
|
123
|
58 |
buttonMotion:state x:x y:y view:aView
|
60
|
59 |
^ false
|
|
60 |
!
|
|
61 |
|
|
62 |
buttonMultiPress:button x:x y:y view:aView
|
|
63 |
^ false
|
|
64 |
|
|
65 |
!
|
|
66 |
|
|
67 |
buttonPress:button x:x y:y view:aView
|
|
68 |
^ false
|
|
69 |
|
|
70 |
!
|
|
71 |
|
123
|
72 |
buttonRelease:button x:x y:y view:aView
|
60
|
73 |
^ false
|
123
|
74 |
|
60
|
75 |
!
|
|
76 |
|
123
|
77 |
buttonShiftPress:button x:x y:y view:aView
|
|
78 |
^ false
|
|
79 |
|
|
80 |
!
|
|
81 |
|
|
82 |
keyPress:key x:x y:y view:aView
|
|
83 |
^ false
|
|
84 |
|
|
85 |
!
|
|
86 |
|
|
87 |
keyRelease:key x:x y:y view:aView
|
60
|
88 |
^ false
|
|
89 |
|
|
90 |
!
|
|
91 |
|
|
92 |
pointerEnter:state x:x y:y view:view
|
|
93 |
^ false
|
|
94 |
|
|
95 |
!
|
|
96 |
|
123
|
97 |
pointerLeave:state view:view
|
60
|
98 |
^ false
|
|
99 |
|
|
100 |
! !
|
|
101 |
|
|
102 |
!EventListener methodsFor:'listen'!
|
|
103 |
|
|
104 |
listen
|
|
105 |
"install myself as listener"
|
|
106 |
|
|
107 |
WindowSensor eventListener:self
|
|
108 |
|
|
109 |
"
|
|
110 |
|listener|
|
|
111 |
|
|
112 |
listener := EventListener new.
|
|
113 |
listener listen.
|
|
114 |
(Delay forSeconds:20) wait.
|
|
115 |
listener unlisten
|
|
116 |
"
|
|
117 |
!
|
|
118 |
|
|
119 |
unlisten
|
|
120 |
"uninstall myself as listener"
|
|
121 |
|
|
122 |
WindowSensor eventListener:nil
|
|
123 |
! !
|
123
|
124 |
|
127
|
125 |
!EventListener class methodsFor:'documentation'!
|
|
126 |
|
|
127 |
version
|
|
128 |
^ '$Header: /cvs/stx/stx/libview2/EventListener.st,v 1.8 1995-11-23 17:45:14 cg Exp $'
|
|
129 |
! !
|