author | ca |
Tue, 20 May 1997 09:01:12 +0200 | |
changeset 1730 | 484d0d28f4c7 |
parent 1590 | 18ca787fd066 |
child 1841 | 3773debcc078 |
permissions | -rw-r--r-- |
26 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
72 | 3 |
All Rights Reserved |
26 | 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 |
" |
|
11 | 12 |
|
13 |
Object subclass:#WindowEvent |
|
356 | 14 |
instanceVariableNames:'view type arguments' |
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
17 |
category:'Interface-Support' |
|
11 | 18 |
! |
19 |
||
1527
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
20 |
WindowEvent subclass:#KeyboardEvent |
1588
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
21 |
instanceVariableNames:'rawKey modifierFlags' |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
22 |
classVariableNames:'F_CTRL F_ALT F_META F_SHIFT' |
1527
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
23 |
poolDictionaries:'' |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
24 |
privateIn:WindowEvent |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
25 |
! |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
26 |
|
1530 | 27 |
WindowEvent subclass:#ClientEvent |
1541 | 28 |
instanceVariableNames:'eventData' |
29 |
classVariableNames:'' |
|
30 |
poolDictionaries:'' |
|
31 |
privateIn:WindowEvent |
|
32 |
! |
|
33 |
||
34 |
WindowEvent subclass:#ButtonEvent |
|
35 |
instanceVariableNames:'' |
|
1530 | 36 |
classVariableNames:'' |
37 |
poolDictionaries:'' |
|
38 |
privateIn:WindowEvent |
|
39 |
! |
|
40 |
||
46 | 41 |
!WindowEvent class methodsFor:'documentation'! |
42 |
||
43 |
copyright |
|
44 |
" |
|
45 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
72 | 46 |
All Rights Reserved |
46 | 47 |
|
48 |
This software is furnished under a license and may be used |
|
49 |
only in accordance with the terms of that license and with the |
|
50 |
inclusion of the above copyright notice. This software may not |
|
51 |
be provided or otherwise made available to, or used by, any |
|
52 |
other person. No title to or ownership of the software is |
|
53 |
hereby transferred. |
|
54 |
" |
|
55 |
! |
|
56 |
||
57 |
documentation |
|
58 |
" |
|
59 |
Instances of WindowEvent are created for every event coming from |
|
144 | 60 |
the graphics device. |
61 |
Usually, they are enqueued by the event dispatcher process into |
|
62 |
a sensors input queue, and dequeued & processed by a windowGroup process |
|
63 |
in its event loop. |
|
64 |
||
65 |
WindowEvents hold the event type and additional information (such as key, |
|
66 |
x/y coordinates etc). Also, windowEvents know how to send themself to some |
|
67 |
destination. To provide a common (single) place where event dispatching is |
|
1421 | 68 |
implemented, this forwarding is done by a class method here (i.e. not by the |
144 | 69 |
window group itself). |
70 |
||
71 |
The algorithm for event dispatching is: |
|
72 |
||
598 | 73 |
- if the destination view has a keyboard focus set, |
74 |
AND the event is a keyboard event, |
|
75 |
THEN recursively invoke the event dispatching method, |
|
76 |
sending the event to the focus view (or its delegate, as below) |
|
144 | 77 |
|
598 | 78 |
- if the destination view has a delegate, |
79 |
AND its a keyboard, button or pointer event, |
|
80 |
AND the delegate is interested in that event |
|
81 |
(i.e. implements & responds to #handlesXXX with true) |
|
82 |
THEN send the event to the delegate, passing the original view |
|
83 |
as additional argument |
|
144 | 84 |
|
598 | 85 |
- if the view has a nonNil controller, |
86 |
AND its a key, button or pointer event, |
|
87 |
THEN send the event to the controller |
|
144 | 88 |
|
598 | 89 |
- otherwise send the event to the view |
144 | 90 |
|
91 |
||
92 |
If the view has a non-nil transformation, the event is sent as a |
|
93 |
#deviceXXX message, passing device coordinates. Typically, subclasses |
|
94 |
of view do not redefine this method and the inherited default method |
|
95 |
translates these device coordinates into logical coordinates and resends |
|
96 |
an XXX message. |
|
97 |
If the view has no transformation, the XXX message is directly sent here. |
|
98 |
||
99 |
For example, a 'buttonPress:button x:x y:y' event leads to sending of |
|
100 |
'aView deviceButtonPress:button x:x y:y' which resends |
|
101 |
'aView buttonPress:button x:(x-logical) y:(y-logical)' |
|
102 |
||
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
103 |
This allows views which are interested in deviceCoordinates to get them |
144 | 104 |
(by redefining #deviceXXX) and other views to transparently get & use |
105 |
logical coordinates. |
|
106 |
||
107 |
Therefore, for a delegated keyPress messages, the flow is: |
|
108 |
||
598 | 109 |
sendEvent |
110 |
view has delegate |
|
111 |
------> ask delegate via 'handlesKeyPress:key inView:view' |
|
112 |
<------ returns true |
|
113 |
------> 'delegate keyPress:key x:x y:y view:view' |
|
114 |
-----> delegate does whatever it wants to do |
|
115 |
(typically sends the event to some other view) |
|
144 | 116 |
|
117 |
for an undelegated message: |
|
118 |
||
598 | 119 |
sendEvent |
120 |
view has delegate |
|
121 |
------> ask delegate via 'handlesKeyPress:key inView:view' |
|
122 |
<------ returns false |
|
123 |
view has controller |
|
124 |
------> 'controller keyPress:key x:x y:y' |
|
125 |
view has no controller |
|
126 |
view has transformation |
|
127 |
----> 'view deviceKeyPress:key x:x y:y' |
|
128 |
inverse transform x/y |
|
129 |
----> 'self keyPress:key x:xLogical y:yLogical' |
|
130 |
view has no transformation |
|
131 |
----> 'view keyPress:key x:x y:y' |
|
132 |
||
612 | 133 |
[author:] |
134 |
Claus Gittinger |
|
135 |
||
598 | 136 |
[see also:] |
137 |
WindowGroup WindowSensor |
|
138 |
DeviceWorkstation View |
|
139 |
KeyboardMap KeyboardForwarder EventListener |
|
140 |
||
46 | 141 |
" |
142 |
! ! |
|
143 |
||
11 | 144 |
!WindowEvent class methodsFor:'instance creation'! |
145 |
||
244 | 146 |
damageFor:aView rectangle:aRectangle |
147 |
"create and return a new damage Event for aRectangle |
|
148 |
in aView" |
|
11 | 149 |
|
244 | 150 |
^ (self new) for:aView type:#damage arguments:aRectangle |
151 |
||
46 | 152 |
! |
153 |
||
72 | 154 |
for:aView type:aSymbol |
155 |
"create and return a new windowEvent for sending |
|
156 |
aSymbol-message with no arguments to aView" |
|
157 |
||
158 |
^ (self new) for:aView type:aSymbol arguments:#() |
|
159 |
! |
|
160 |
||
244 | 161 |
for:aView type:aSymbol arguments:argArray |
162 |
"create and return a new windowEvent for sending |
|
163 |
aSymbol-message with arguments to aView" |
|
28 | 164 |
|
244 | 165 |
^ (self new) for:aView type:aSymbol arguments:argArray |
28 | 166 |
! ! |
167 |
||
1527
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
168 |
!WindowEvent class methodsFor:'event class access'! |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
169 |
|
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
170 |
buttonEvent |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
171 |
^ ButtonEvent |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
172 |
|
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
173 |
"Created: 4.4.1997 / 13:45:04 / cg" |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
174 |
! |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
175 |
|
1531 | 176 |
clientEvent |
177 |
^ ClientEvent |
|
178 |
||
179 |
"Created: 4.4.1997 / 13:58:25 / cg" |
|
180 |
! |
|
181 |
||
1527
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
182 |
keyboardEvent |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
183 |
^ KeyboardEvent |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
184 |
|
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
185 |
"Created: 4.4.1997 / 13:41:44 / cg" |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
186 |
! ! |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
187 |
|
115 | 188 |
!WindowEvent class methodsFor:'forwarding events'! |
189 |
||
190 |
sendEvent:type arguments:arguments view:view |
|
191 |
"forward the event represented by type and arguments to the views delegate, |
|
192 |
the views controller or the view. |
|
11 | 193 |
|
115 | 194 |
If there is a delegate, only messages which are understood by it are |
195 |
forwarded. Also, the delegate is asked if it is willing to handle the event |
|
196 |
before. |
|
197 |
Delegated messages get the original view as an extra argument. |
|
198 |
Delegation has higher priority than controller forwarding." |
|
11 | 199 |
|
135 | 200 |
^ self |
201 |
sendEvent:type |
|
202 |
arguments:arguments |
|
203 |
view:view |
|
204 |
withFocusOn:nil |
|
205 |
delegate:true |
|
89 | 206 |
! |
207 |
||
115 | 208 |
sendEvent:type arguments:argArray view:view withFocusOn:focusView |
209 |
"forward the event represented by type and arguments to the views delegate, |
|
210 |
the views controller or the view. |
|
211 |
If focusView is nonNil, and it is a keyboard event, it is forwarded to this |
|
141 | 212 |
view (even if there is a delegate). |
115 | 213 |
|
89 | 214 |
If there is a delegate, only messages which are understood by it are |
115 | 215 |
forwarded. Also, the delegate is asked if it is willing to handle the event |
216 |
before. |
|
217 |
Delegated messages get the original view as an extra argument. |
|
89 | 218 |
Delegation has higher priority than both controller or focusView |
219 |
forwarding." |
|
220 |
||
135 | 221 |
^ self |
222 |
sendEvent:type |
|
223 |
arguments:argArray |
|
224 |
view:view |
|
225 |
withFocusOn:focusView |
|
226 |
delegate:true |
|
227 |
! |
|
228 |
||
229 |
sendEvent:type arguments:argArray view:view withFocusOn:focusView delegate:doDelegate |
|
230 |
"forward the event represented by type and arguments to the views delegate, |
|
231 |
the views controller or the view. |
|
232 |
If focusView is nonNil, and it is a keyboard event, it is forwarded to this |
|
233 |
view (but not if there was a delegate in the first place). |
|
234 |
||
235 |
If doDelegate is true, keyboard and button events are forwarded to a |
|
236 |
delegate object (if non-nil). DoDelegate may be passed as true, to |
|
237 |
handle events which are already delegated. |
|
238 |
If there is a delegate, only messages which are understood by it are |
|
239 |
forwarded. Also, the delegate is asked if it is willing to handle the event |
|
240 |
before. |
|
241 |
Delegated messages get the original view as an extra argument. |
|
242 |
Delegation has higher priority than both controller or focusView |
|
243 |
forwarding." |
|
244 |
||
115 | 245 |
|delegate selector delegateMessage delegateQuery |
246 |
eventReceiver controller deviceMessage |
|
1470
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
247 |
isKeyEvent isButtonEvent isPointerEvent trans |
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
248 |
rect x y w h| |
115 | 249 |
|
250 |
isKeyEvent := isButtonEvent := isPointerEvent := false. |
|
11 | 251 |
|
1470
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
252 |
type == #damage ifTrue:[ |
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
253 |
view shown ifTrue:[ |
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
254 |
rect := argArray. |
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
255 |
x := rect left. |
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
256 |
y := rect top. |
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
257 |
w := rect width. |
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
258 |
h := rect height. |
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
259 |
view transformation notNil ifTrue:[ |
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
260 |
view deviceExposeX:x y:y width:w height:h |
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
261 |
] ifFalse:[ |
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
262 |
view exposeX:x y:y width:w height:h |
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
263 |
] |
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
264 |
]. |
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
265 |
^ self |
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
266 |
]. |
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
267 |
|
115 | 268 |
(type == #'keyPress:x:y:') ifTrue:[ |
1420 | 269 |
isKeyEvent := true. |
270 |
deviceMessage := #'deviceKeyPress:x:y:'. |
|
271 |
delegateMessage := #'keyPress:x:y:view:'. |
|
272 |
delegateQuery := #'handlesKeyPress:inView:'. |
|
115 | 273 |
] ifFalse:[ (type == #'keyRelease:x:y:') ifTrue:[ |
1420 | 274 |
isKeyEvent := true. |
275 |
deviceMessage := #'deviceKeyRelease:x:y:'. |
|
276 |
delegateMessage := #'keyRelease:x:y:view:'. |
|
277 |
delegateQuery := #'handlesKeyRelease:inView:'. |
|
141 | 278 |
] ifFalse:[ (type == #'buttonMotion:x:y:') ifTrue:[ |
1420 | 279 |
isButtonEvent := true. |
280 |
deviceMessage := #'deviceButtonMotion:x:y:'. |
|
281 |
delegateMessage := #'buttonMotion:x:y:view:'. |
|
282 |
delegateQuery := #'handlesButtonMotion:inView:'. |
|
115 | 283 |
] ifFalse:[ (type == #'buttonPress:x:y:') ifTrue:[ |
1420 | 284 |
isButtonEvent := true. |
285 |
deviceMessage := #'deviceButtonPress:x:y:'. |
|
286 |
delegateMessage := #'buttonPress:x:y:view:'. |
|
287 |
delegateQuery := #'handlesButtonPress:inView:'. |
|
115 | 288 |
] ifFalse:[ (type == #'buttonRelease:x:y:') ifTrue:[ |
1420 | 289 |
isButtonEvent := true. |
290 |
deviceMessage := #'deviceButtonRelease:x:y:'. |
|
291 |
delegateMessage := #'buttonRelease:x:y:view:'. |
|
292 |
delegateQuery := #'handlesButtonRelease:inView:'. |
|
115 | 293 |
] ifFalse:[ (type == #'buttonShiftPress:x:y:') ifTrue:[ |
1420 | 294 |
isButtonEvent := true. |
295 |
deviceMessage := #'deviceButtonShiftPress:x:y:'. |
|
296 |
delegateMessage := #'buttonShiftPress:x:y:view:'. |
|
297 |
delegateQuery := #'handlesButtonShiftPress:inView:'. |
|
115 | 298 |
] ifFalse:[ (type == #'buttonMultiPress:x:y:') ifTrue:[ |
1420 | 299 |
isButtonEvent := true. |
300 |
deviceMessage := #'deviceButtonMultiPress:x:y:'. |
|
301 |
delegateMessage := #'buttonMultiPress:x:y:view:'. |
|
302 |
delegateQuery := #'handlesButtonMultiPress:inView:'. |
|
115 | 303 |
] ifFalse:[ (type == #'pointerEnter:x:y:') ifTrue:[ |
1420 | 304 |
isPointerEvent := true. |
305 |
deviceMessage := #'devicePointerEnter:x:y:'. |
|
306 |
delegateMessage := #'pointerEnter:x:y:view:'. |
|
307 |
delegateQuery := #'handlesPointerEnter:inView:'. |
|
115 | 308 |
] ifFalse:[ (type == #'pointerLeave:') ifTrue:[ |
1420 | 309 |
isPointerEvent := true. |
310 |
deviceMessage := type. |
|
311 |
delegateMessage := #'pointerLeave:view:'. |
|
312 |
delegateQuery := #'handlesPointerLeave:inView:'. |
|
115 | 313 |
] ifFalse:[ (type == #'exposeX:y:width:height:') ifTrue:[ |
1420 | 314 |
deviceMessage := #'deviceExposeX:y:width:height:'. |
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1158
diff
changeset
|
315 |
] ifFalse:[ (type == #'graphicsExposeX:y:width:height:final:') ifTrue:[ |
1420 | 316 |
deviceMessage := #'deviceGraphicsExposeX:y:width:height:final:'. |
115 | 317 |
]]]]]]]]]]]. |
89 | 318 |
|
141 | 319 |
" |
320 |
if there is a focusView, and its a keyboard event, pass it |
|
321 |
to that view (or its controller, or its delegate). |
|
322 |
In this case, a coordinate which is outside of |
|
143 | 323 |
the focusView (0 @ 0) is passed as x/y coordinates. |
141 | 324 |
" |
325 |
(focusView notNil |
|
326 |
and:[isKeyEvent]) ifTrue:[ |
|
1420 | 327 |
self sendEvent:type |
328 |
arguments:(Array with:(argArray at:1) with:0 with:0) |
|
329 |
view:focusView |
|
330 |
withFocusOn:nil |
|
331 |
delegate:doDelegate. |
|
332 |
^ self |
|
141 | 333 |
]. |
334 |
||
135 | 335 |
doDelegate ifTrue:[ |
1420 | 336 |
" |
337 |
handle delegated messages |
|
338 |
" |
|
339 |
(isKeyEvent |
|
340 |
or:[isButtonEvent |
|
341 |
or:[isPointerEvent]]) ifTrue:[ |
|
342 |
delegate := view delegate. |
|
135 | 343 |
|
1420 | 344 |
" |
345 |
what a kludge - sending to delegate requires |
|
346 |
another selector and an additional argument ... |
|
347 |
" |
|
348 |
(delegate notNil |
|
349 |
and:[delegate respondsTo:delegateMessage]) ifTrue:[ |
|
350 |
" |
|
351 |
is the delegate interested in that event ? |
|
352 |
(if it does not respond to the handlesXXX message, |
|
353 |
we assume: NO) |
|
354 |
" |
|
355 |
((delegate respondsTo:delegateQuery) |
|
356 |
and:[delegate perform:delegateQuery with:(argArray at:1) with:view]) ifTrue:[ |
|
357 |
" |
|
358 |
mhmh ... have to convert to logical coordinates |
|
359 |
" |
|
360 |
(trans := view transformation) notNil ifTrue:[ |
|
361 |
argArray size > 2 ifTrue:[ |
|
362 |
argArray at:2 put:(trans applyInverseToX:(argArray at:2)). |
|
363 |
argArray at:3 put:(trans applyInverseToY:(argArray at:3)). |
|
364 |
]. |
|
365 |
]. |
|
366 |
argArray isNil ifTrue:[ |
|
367 |
delegate perform:delegateMessage with:view |
|
368 |
] ifFalse:[ |
|
369 |
delegate perform:delegateMessage withArguments:(argArray copyWith:view) |
|
370 |
]. |
|
371 |
^ self |
|
372 |
] |
|
373 |
]. |
|
374 |
]. |
|
89 | 375 |
]. |
376 |
||
1463
d39e690f218f
dont send events for a view which is already destroyed
Claus Gittinger <cg@exept.de>
parents:
1422
diff
changeset
|
377 |
(isKeyEvent |
d39e690f218f
dont send events for a view which is already destroyed
Claus Gittinger <cg@exept.de>
parents:
1422
diff
changeset
|
378 |
or:[isButtonEvent |
d39e690f218f
dont send events for a view which is already destroyed
Claus Gittinger <cg@exept.de>
parents:
1422
diff
changeset
|
379 |
or:[isPointerEvent]]) ifTrue:[ |
d39e690f218f
dont send events for a view which is already destroyed
Claus Gittinger <cg@exept.de>
parents:
1422
diff
changeset
|
380 |
view realized ifFalse:[ |
d39e690f218f
dont send events for a view which is already destroyed
Claus Gittinger <cg@exept.de>
parents:
1422
diff
changeset
|
381 |
^ self |
d39e690f218f
dont send events for a view which is already destroyed
Claus Gittinger <cg@exept.de>
parents:
1422
diff
changeset
|
382 |
] |
d39e690f218f
dont send events for a view which is already destroyed
Claus Gittinger <cg@exept.de>
parents:
1422
diff
changeset
|
383 |
]. |
d39e690f218f
dont send events for a view which is already destroyed
Claus Gittinger <cg@exept.de>
parents:
1422
diff
changeset
|
384 |
|
89 | 385 |
" |
386 |
if there is a controller, that one gets all user events |
|
387 |
" |
|
388 |
eventReceiver := view. |
|
389 |
(controller := view controller) notNil ifTrue:[ |
|
1420 | 390 |
(isKeyEvent |
391 |
or:[isButtonEvent |
|
392 |
or:[isPointerEvent |
|
393 |
or:[(type == #focusIn) |
|
394 |
or:[(type == #focusOut)]]]]) ifTrue:[ |
|
395 |
eventReceiver := controller. |
|
396 |
] |
|
89 | 397 |
]. |
398 |
||
399 |
" |
|
115 | 400 |
finally, another one: |
89 | 401 |
if the view has a transformation, edit the selector |
402 |
from #foo to #deviceFoo... |
|
403 |
This allows the view to handle the event either in device or |
|
404 |
logical coordinates. (since the deviceFoo-messages default implementation |
|
727
bf23a306b6f2
renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
405 |
in DisplaySurface translates and resends). |
89 | 406 |
Actually, I could always send deviceXXX without speed penalty |
407 |
(event sending is no high frequency operation), but that just adds |
|
408 |
another context to any debuggers walkback, making things less clear. |
|
409 |
" |
|
115 | 410 |
selector := type. |
411 |
||
89 | 412 |
view transformation notNil ifTrue:[ |
1420 | 413 |
(isKeyEvent |
414 |
or:[isButtonEvent |
|
415 |
or:[isPointerEvent |
|
416 |
or:[(type == #'exposeX:y:width:height:') |
|
417 |
or:[(type == #'graphicsExposeX:y:width:height:final:')]]]]) ifTrue:[ |
|
418 |
selector := deviceMessage |
|
419 |
] |
|
89 | 420 |
]. |
1420 | 421 |
|
115 | 422 |
eventReceiver perform:selector withArguments:argArray |
1420 | 423 |
|
1470
00b614f75bc7
also handle damage event sending
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
424 |
"Modified: 20.3.1997 / 14:25:31 / cg" |
115 | 425 |
! ! |
426 |
||
244 | 427 |
!WindowEvent methodsFor:'accessing'! |
428 |
||
429 |
arguments |
|
430 |
"return the arguments of the event" |
|
431 |
||
432 |
^ arguments |
|
433 |
! |
|
434 |
||
435 |
arguments:anArray |
|
436 |
"set the arguments" |
|
437 |
||
438 |
arguments := anArray |
|
439 |
! |
|
440 |
||
441 |
key |
|
442 |
"return the key of the key-event. For non key-events, nil is returned." |
|
443 |
||
444 |
((type == #keyPress:x:y:) |
|
445 |
or:[type == #keyRelease:x:y:]) ifTrue:[ |
|
446 |
^ arguments at:1 |
|
447 |
]. |
|
448 |
^ nil |
|
449 |
! |
|
450 |
||
451 |
rectangle |
|
452 |
"return the damage rectangle" |
|
453 |
||
454 |
^ arguments "consider this a kludge" |
|
455 |
! |
|
456 |
||
457 |
type |
|
458 |
"return the type of the event" |
|
459 |
||
460 |
^ type |
|
461 |
! |
|
462 |
||
463 |
view |
|
464 |
"return the view, for which the event is for" |
|
465 |
||
466 |
^ view |
|
467 |
! |
|
468 |
||
469 |
view:aView |
|
470 |
"set the view, for which the event is for" |
|
471 |
||
472 |
view := aView |
|
473 |
! ! |
|
474 |
||
511
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
475 |
!WindowEvent methodsFor:'printing & storing'! |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
476 |
|
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
477 |
displayString |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
478 |
^ self className |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
479 |
, '(' , type storeString |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
480 |
, ' view: ' , view className |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
481 |
, ' args: ' , arguments displayString |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
482 |
, ')' |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
483 |
|
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
484 |
"Created: 7.3.1996 / 14:55:50 / cg" |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
485 |
"Modified: 7.3.1996 / 14:58:21 / cg" |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
486 |
! ! |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
487 |
|
244 | 488 |
!WindowEvent methodsFor:'private accessing'! |
489 |
||
490 |
for:aView type:aSymbol arguments:argArray |
|
491 |
"set the instance variables of the event" |
|
492 |
||
493 |
view := aView. |
|
494 |
type := aSymbol. |
|
495 |
arguments := argArray |
|
496 |
! ! |
|
497 |
||
498 |
!WindowEvent methodsFor:'queries'! |
|
499 |
||
1588
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
500 |
hasAlt |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
501 |
"return true, if this is a keyboard event, with ALT pressed" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
502 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
503 |
^ false |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
504 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
505 |
"Created: 12.4.1997 / 11:04:10 / cg" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
506 |
! |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
507 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
508 |
hasCtrl |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
509 |
"return true, if this is a keyboard event, with CTRL pressed" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
510 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
511 |
^ false |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
512 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
513 |
"Created: 12.4.1997 / 11:04:03 / cg" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
514 |
! |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
515 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
516 |
hasMeta |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
517 |
"return true, if this is a keyboard event, with META pressed" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
518 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
519 |
^ false |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
520 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
521 |
"Created: 12.4.1997 / 11:04:16 / cg" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
522 |
! |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
523 |
|
1590 | 524 |
hasShift |
525 |
"return true, if this is a keyboard event, with SHIFT pressed" |
|
526 |
||
527 |
^ false |
|
528 |
||
529 |
"Created: 12.4.1997 / 11:30:59 / cg" |
|
530 |
! |
|
531 |
||
244 | 532 |
isButtonEvent |
533 |
"return true, if this event is a button event" |
|
534 |
||
535 |
^ (type == #buttonPress:x:y:) |
|
536 |
or:[type == #buttonRelease:x:y: |
|
537 |
or:[type == #'buttonShiftPress:x:y:' |
|
538 |
or:[type == #'buttonMultiPress:x:y:' |
|
539 |
or:[type == #'buttonMotion:x:y:']]]] |
|
540 |
! |
|
541 |
||
1730 | 542 |
isButtonMotionEvent |
543 |
"return true, if this event is a buttonMotion event" |
|
544 |
||
545 |
^ (type == #buttonMotion:x:y:) |
|
546 |
||
547 |
"Created: 5.3.1997 / 12:25:43 / cg" |
|
548 |
! |
|
549 |
||
1420 | 550 |
isButtonPressEvent |
551 |
"return true, if this event is a buttonPress event" |
|
552 |
||
553 |
^ (type == #buttonPress:x:y:) |
|
554 |
||
555 |
"Created: 5.3.1997 / 12:25:43 / cg" |
|
556 |
! |
|
557 |
||
244 | 558 |
isDamage |
559 |
"return true, if this is a damage event" |
|
560 |
||
561 |
^ type == #damage |
|
562 |
! |
|
563 |
||
1420 | 564 |
isFocusEvent |
565 |
"return true, if this event is a focusIn/focusOut event" |
|
566 |
||
567 |
^ (type == #focusIn) or:[type == #focusOut] |
|
568 |
||
569 |
"Created: 5.3.1997 / 12:12:37 / cg" |
|
570 |
! |
|
571 |
||
572 |
isFocusInEvent |
|
573 |
"return true, if this event is a focusIn event" |
|
574 |
||
575 |
^ (type == #focusIn) |
|
576 |
||
577 |
"Created: 5.3.1997 / 12:18:10 / cg" |
|
578 |
! |
|
579 |
||
244 | 580 |
isKeyEvent |
581 |
"return true, if this event is a keyboard event" |
|
582 |
||
583 |
^ (type == #keyPress:x:y:) or:[type == #keyRelease:x:y:] |
|
584 |
! |
|
585 |
||
586 |
isKeyPressEvent |
|
587 |
"return true, if this event is a keyboard event" |
|
588 |
||
589 |
^ (type == #keyPress:x:y:) |
|
356 | 590 |
! |
591 |
||
592 |
isPointerEnterEvent |
|
593 |
"return true, if this event is a pointer-enter event" |
|
594 |
||
595 |
^ (type == #pointerEnter:x:y:) |
|
596 |
||
597 |
"Created: 9.1.1996 / 15:51:24 / cg" |
|
598 |
"Modified: 9.1.1996 / 15:51:40 / cg" |
|
599 |
! |
|
600 |
||
601 |
isPointerEnterLeaveEvent |
|
602 |
"return true, if this event is a pointer-enter/leave event" |
|
603 |
||
604 |
^ (type == #pointerEnter:x:y:) or:[type == #pointerLeave:view:] |
|
605 |
||
606 |
"Created: 9.1.1996 / 15:51:18 / cg" |
|
607 |
! |
|
608 |
||
609 |
isPointerLeaveEvent |
|
610 |
"return true, if this event is a pointer-leave event" |
|
611 |
||
612 |
^ type == #pointerLeave:view: |
|
613 |
||
614 |
"Created: 9.1.1996 / 15:51:36 / cg" |
|
1158 | 615 |
! |
616 |
||
617 |
isUserEvent |
|
618 |
"return true, if this event is a user event (i.e. mouse, keyboard or button)" |
|
619 |
||
620 |
(type == #buttonPress:x:y:) ifTrue:[^ true]. |
|
621 |
(type == #buttonRelease:x:y:) ifTrue:[^ true]. |
|
622 |
(type == #buttonShiftPress:x:y:) ifTrue:[^ true]. |
|
623 |
(type == #buttonMultiPress:x:y:) ifTrue:[^ true]. |
|
624 |
(type == #buttonMotion:x:y:) ifTrue:[^ true]. |
|
625 |
||
626 |
(type == #keyPress:x:y:) ifTrue:[^ true]. |
|
627 |
(type == #keyRelease:x:y:) ifTrue:[^ true]. |
|
628 |
||
1420 | 629 |
(type == #pointerEnter:x:y:) ifTrue:[^ true]. |
630 |
"/ (type == #pointerLeave:) ifTrue:[^ true]. |
|
631 |
||
1158 | 632 |
^ false |
633 |
||
1420 | 634 |
"Modified: 5.3.1997 / 11:27:40 / cg" |
244 | 635 |
! ! |
636 |
||
115 | 637 |
!WindowEvent methodsFor:'sending'! |
638 |
||
639 |
sendEvent |
|
144 | 640 |
"forward the event represented by the receiver to the views delegate, |
641 |
the views controller or the view. Ignore any focusView." |
|
115 | 642 |
|
643 |
self sendEventWithFocusOn:nil |
|
644 |
! |
|
645 |
||
646 |
sendEventWithFocusOn:focusView |
|
144 | 647 |
"forward the event represented by the receiver to the views delegate, |
648 |
the views controller or the view. |
|
649 |
If focusView is nonNil, and the receiver is a keyboard event, |
|
650 |
the event will be forwarded to the focusView instead |
|
651 |
(or its delegate, or its controller)." |
|
115 | 652 |
|
135 | 653 |
self class |
654 |
sendEvent:type |
|
655 |
arguments:arguments |
|
656 |
view:view |
|
657 |
withFocusOn:focusView |
|
658 |
delegate:true |
|
11 | 659 |
! ! |
660 |
||
1588
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
661 |
!WindowEvent::KeyboardEvent class methodsFor:'class initialization'! |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
662 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
663 |
initialize |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
664 |
F_SHIFT := 1. |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
665 |
F_CTRL := 2. |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
666 |
F_ALT := 4. |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
667 |
F_META := 8. |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
668 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
669 |
"Created: 12.4.1997 / 11:08:28 / cg" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
670 |
! ! |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
671 |
|
1527
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
672 |
!WindowEvent::KeyboardEvent methodsFor:'accessing'! |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
673 |
|
1588
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
674 |
hasShift:shift hasCtrl:ctrl hasAlt:alt hasMeta:meta |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
675 |
|f "{ Class: SmallInteger }"| |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
676 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
677 |
f := 0. |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
678 |
shift ifTrue:[f := f bitOr:F_SHIFT]. |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
679 |
ctrl ifTrue:[f := f bitOr:F_CTRL]. |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
680 |
alt ifTrue:[f := f bitOr:F_ALT]. |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
681 |
meta ifTrue:[f := f bitOr:F_META]. |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
682 |
modifierFlags := f. |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
683 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
684 |
"Modified: 12.4.1997 / 11:10:38 / cg" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
685 |
! |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
686 |
|
1527
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
687 |
rawKey |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
688 |
^ rawKey |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
689 |
|
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
690 |
"Created: 4.4.1997 / 13:47:15 / cg" |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
691 |
! |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
692 |
|
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
693 |
rawKey:aKey |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
694 |
rawKey := aKey |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
695 |
|
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
696 |
"Created: 4.4.1997 / 13:47:10 / cg" |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
697 |
! ! |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
698 |
|
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
699 |
!WindowEvent::KeyboardEvent methodsFor:'queries'! |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
700 |
|
1588
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
701 |
hasAlt |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
702 |
"return true, if this is a keyboard event, with ALT pressed" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
703 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
704 |
^ (modifierFlags bitAnd:F_ALT) ~~ 0 |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
705 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
706 |
"Created: 12.4.1997 / 11:05:09 / cg" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
707 |
"Modified: 12.4.1997 / 11:10:57 / cg" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
708 |
! |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
709 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
710 |
hasCtrl |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
711 |
"return true, if this is a keyboard event, with CTRL pressed" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
712 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
713 |
^ (modifierFlags bitAnd:F_CTRL) ~~ 0 |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
714 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
715 |
"Created: 12.4.1997 / 11:05:04 / cg" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
716 |
"Modified: 12.4.1997 / 11:11:03 / cg" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
717 |
! |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
718 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
719 |
hasMeta |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
720 |
"return true, if this is a keyboard event, with META pressed" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
721 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
722 |
^ (modifierFlags bitAnd:F_META) ~~ 0 |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
723 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
724 |
"Created: 12.4.1997 / 11:04:45 / cg" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
725 |
"Modified: 12.4.1997 / 11:11:10 / cg" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
726 |
! |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
727 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
728 |
hasShift |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
729 |
"return true, if this is a keyboard event, with SHIFT pressed" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
730 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
731 |
^ (modifierFlags bitAnd:F_SHIFT) ~~ 0 |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
732 |
|
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
733 |
"Created: 12.4.1997 / 11:11:21 / cg" |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
734 |
! |
8f9468059ef7
keep modifierKey information in keyboardEvents
Claus Gittinger <cg@exept.de>
parents:
1541
diff
changeset
|
735 |
|
1527
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
736 |
isKeyEvent |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
737 |
"return true, if this event is a keyboard event" |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
738 |
|
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
739 |
^ true |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
740 |
|
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
741 |
"Created: 4.4.1997 / 13:39:59 / cg" |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
742 |
! ! |
661de0f76595
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1470
diff
changeset
|
743 |
|
1530 | 744 |
!WindowEvent::ClientEvent methodsFor:'accessing'! |
745 |
||
1541 | 746 |
eventData |
747 |
"return the value of the instance variable 'eventData' (automatically generated)" |
|
1530 | 748 |
|
1541 | 749 |
^ eventData |
1530 | 750 |
|
1541 | 751 |
"Created: 4.4.1997 / 17:41:50 / cg" |
1530 | 752 |
! |
753 |
||
1541 | 754 |
eventData:something |
755 |
"set the value of the instance variable 'eventData' (automatically generated)" |
|
756 |
||
757 |
eventData := something. |
|
758 |
||
759 |
"Created: 4.4.1997 / 17:41:57 / cg" |
|
760 |
! ! |
|
761 |
||
762 |
!WindowEvent::ButtonEvent methodsFor:'queries'! |
|
1530 | 763 |
|
1541 | 764 |
isButtonEvent |
765 |
"return true, if this event is a button event" |
|
766 |
||
767 |
^ true |
|
1530 | 768 |
|
1541 | 769 |
"Created: 4.4.1997 / 13:44:11 / cg" |
770 |
! |
|
771 |
||
1730 | 772 |
isButtonMotionEvent |
773 |
"return true, if this event is a buttonMotion event" |
|
774 |
||
775 |
^ (type == #buttonMotion:x:y:) |
|
776 |
||
777 |
"Created: 4.4.1997 / 13:44:22 / cg" |
|
778 |
! |
|
779 |
||
1541 | 780 |
isButtonPressEvent |
781 |
"return true, if this event is a buttonPress event" |
|
782 |
||
783 |
^ (type == #buttonPress:x:y:) |
|
784 |
||
785 |
"Created: 4.4.1997 / 13:44:22 / cg" |
|
1530 | 786 |
! ! |
787 |
||
251 | 788 |
!WindowEvent class methodsFor:'documentation'! |
789 |
||
790 |
version |
|
1730 | 791 |
^ '$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.43 1997-05-20 07:01:12 ca Exp $' |
251 | 792 |
! ! |