author | Claus Gittinger <cg@exept.de> |
Wed, 05 Mar 1997 14:06:52 +0100 | |
changeset 1422 | 8ccfea4bf36d |
parent 1421 | 0f7c6d4ba280 |
child 1463 | d39e690f218f |
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 |
||
46 | 20 |
!WindowEvent class methodsFor:'documentation'! |
21 |
||
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
72 | 25 |
All Rights Reserved |
46 | 26 |
|
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
36 |
documentation |
|
37 |
" |
|
38 |
Instances of WindowEvent are created for every event coming from |
|
144 | 39 |
the graphics device. |
40 |
Usually, they are enqueued by the event dispatcher process into |
|
41 |
a sensors input queue, and dequeued & processed by a windowGroup process |
|
42 |
in its event loop. |
|
43 |
||
44 |
WindowEvents hold the event type and additional information (such as key, |
|
45 |
x/y coordinates etc). Also, windowEvents know how to send themself to some |
|
46 |
destination. To provide a common (single) place where event dispatching is |
|
1421 | 47 |
implemented, this forwarding is done by a class method here (i.e. not by the |
144 | 48 |
window group itself). |
49 |
||
50 |
The algorithm for event dispatching is: |
|
51 |
||
598 | 52 |
- if the destination view has a keyboard focus set, |
53 |
AND the event is a keyboard event, |
|
54 |
THEN recursively invoke the event dispatching method, |
|
55 |
sending the event to the focus view (or its delegate, as below) |
|
144 | 56 |
|
598 | 57 |
- if the destination view has a delegate, |
58 |
AND its a keyboard, button or pointer event, |
|
59 |
AND the delegate is interested in that event |
|
60 |
(i.e. implements & responds to #handlesXXX with true) |
|
61 |
THEN send the event to the delegate, passing the original view |
|
62 |
as additional argument |
|
144 | 63 |
|
598 | 64 |
- if the view has a nonNil controller, |
65 |
AND its a key, button or pointer event, |
|
66 |
THEN send the event to the controller |
|
144 | 67 |
|
598 | 68 |
- otherwise send the event to the view |
144 | 69 |
|
70 |
||
71 |
If the view has a non-nil transformation, the event is sent as a |
|
72 |
#deviceXXX message, passing device coordinates. Typically, subclasses |
|
73 |
of view do not redefine this method and the inherited default method |
|
74 |
translates these device coordinates into logical coordinates and resends |
|
75 |
an XXX message. |
|
76 |
If the view has no transformation, the XXX message is directly sent here. |
|
77 |
||
78 |
For example, a 'buttonPress:button x:x y:y' event leads to sending of |
|
79 |
'aView deviceButtonPress:button x:x y:y' which resends |
|
80 |
'aView buttonPress:button x:(x-logical) y:(y-logical)' |
|
81 |
||
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
82 |
This allows views which are interested in deviceCoordinates to get them |
144 | 83 |
(by redefining #deviceXXX) and other views to transparently get & use |
84 |
logical coordinates. |
|
85 |
||
86 |
Therefore, for a delegated keyPress messages, the flow is: |
|
87 |
||
598 | 88 |
sendEvent |
89 |
view has delegate |
|
90 |
------> ask delegate via 'handlesKeyPress:key inView:view' |
|
91 |
<------ returns true |
|
92 |
------> 'delegate keyPress:key x:x y:y view:view' |
|
93 |
-----> delegate does whatever it wants to do |
|
94 |
(typically sends the event to some other view) |
|
144 | 95 |
|
96 |
for an undelegated message: |
|
97 |
||
598 | 98 |
sendEvent |
99 |
view has delegate |
|
100 |
------> ask delegate via 'handlesKeyPress:key inView:view' |
|
101 |
<------ returns false |
|
102 |
view has controller |
|
103 |
------> 'controller keyPress:key x:x y:y' |
|
104 |
view has no controller |
|
105 |
view has transformation |
|
106 |
----> 'view deviceKeyPress:key x:x y:y' |
|
107 |
inverse transform x/y |
|
108 |
----> 'self keyPress:key x:xLogical y:yLogical' |
|
109 |
view has no transformation |
|
110 |
----> 'view keyPress:key x:x y:y' |
|
111 |
||
612 | 112 |
[author:] |
113 |
Claus Gittinger |
|
114 |
||
598 | 115 |
[see also:] |
116 |
WindowGroup WindowSensor |
|
117 |
DeviceWorkstation View |
|
118 |
KeyboardMap KeyboardForwarder EventListener |
|
119 |
||
46 | 120 |
" |
121 |
! ! |
|
122 |
||
11 | 123 |
!WindowEvent class methodsFor:'instance creation'! |
124 |
||
244 | 125 |
damageFor:aView rectangle:aRectangle |
126 |
"create and return a new damage Event for aRectangle |
|
127 |
in aView" |
|
11 | 128 |
|
244 | 129 |
^ (self new) for:aView type:#damage arguments:aRectangle |
130 |
||
46 | 131 |
! |
132 |
||
72 | 133 |
for:aView type:aSymbol |
134 |
"create and return a new windowEvent for sending |
|
135 |
aSymbol-message with no arguments to aView" |
|
136 |
||
137 |
^ (self new) for:aView type:aSymbol arguments:#() |
|
138 |
! |
|
139 |
||
244 | 140 |
for:aView type:aSymbol arguments:argArray |
141 |
"create and return a new windowEvent for sending |
|
142 |
aSymbol-message with arguments to aView" |
|
28 | 143 |
|
244 | 144 |
^ (self new) for:aView type:aSymbol arguments:argArray |
28 | 145 |
! ! |
146 |
||
115 | 147 |
!WindowEvent class methodsFor:'forwarding events'! |
148 |
||
149 |
sendEvent:type arguments:arguments view:view |
|
150 |
"forward the event represented by type and arguments to the views delegate, |
|
151 |
the views controller or the view. |
|
11 | 152 |
|
115 | 153 |
If there is a delegate, only messages which are understood by it are |
154 |
forwarded. Also, the delegate is asked if it is willing to handle the event |
|
155 |
before. |
|
156 |
Delegated messages get the original view as an extra argument. |
|
157 |
Delegation has higher priority than controller forwarding." |
|
11 | 158 |
|
135 | 159 |
^ self |
160 |
sendEvent:type |
|
161 |
arguments:arguments |
|
162 |
view:view |
|
163 |
withFocusOn:nil |
|
164 |
delegate:true |
|
89 | 165 |
! |
166 |
||
115 | 167 |
sendEvent:type arguments:argArray view:view withFocusOn:focusView |
168 |
"forward the event represented by type and arguments to the views delegate, |
|
169 |
the views controller or the view. |
|
170 |
If focusView is nonNil, and it is a keyboard event, it is forwarded to this |
|
141 | 171 |
view (even if there is a delegate). |
115 | 172 |
|
89 | 173 |
If there is a delegate, only messages which are understood by it are |
115 | 174 |
forwarded. Also, the delegate is asked if it is willing to handle the event |
175 |
before. |
|
176 |
Delegated messages get the original view as an extra argument. |
|
89 | 177 |
Delegation has higher priority than both controller or focusView |
178 |
forwarding." |
|
179 |
||
135 | 180 |
^ self |
181 |
sendEvent:type |
|
182 |
arguments:argArray |
|
183 |
view:view |
|
184 |
withFocusOn:focusView |
|
185 |
delegate:true |
|
186 |
! |
|
187 |
||
188 |
sendEvent:type arguments:argArray view:view withFocusOn:focusView delegate:doDelegate |
|
189 |
"forward the event represented by type and arguments to the views delegate, |
|
190 |
the views controller or the view. |
|
191 |
If focusView is nonNil, and it is a keyboard event, it is forwarded to this |
|
192 |
view (but not if there was a delegate in the first place). |
|
193 |
||
194 |
If doDelegate is true, keyboard and button events are forwarded to a |
|
195 |
delegate object (if non-nil). DoDelegate may be passed as true, to |
|
196 |
handle events which are already delegated. |
|
197 |
If there is a delegate, only messages which are understood by it are |
|
198 |
forwarded. Also, the delegate is asked if it is willing to handle the event |
|
199 |
before. |
|
200 |
Delegated messages get the original view as an extra argument. |
|
201 |
Delegation has higher priority than both controller or focusView |
|
202 |
forwarding." |
|
203 |
||
115 | 204 |
|delegate selector delegateMessage delegateQuery |
205 |
eventReceiver controller deviceMessage |
|
206 |
isKeyEvent isButtonEvent isPointerEvent trans| |
|
207 |
||
208 |
isKeyEvent := isButtonEvent := isPointerEvent := false. |
|
11 | 209 |
|
115 | 210 |
(type == #'keyPress:x:y:') ifTrue:[ |
1420 | 211 |
isKeyEvent := true. |
212 |
deviceMessage := #'deviceKeyPress:x:y:'. |
|
213 |
delegateMessage := #'keyPress:x:y:view:'. |
|
214 |
delegateQuery := #'handlesKeyPress:inView:'. |
|
115 | 215 |
] ifFalse:[ (type == #'keyRelease:x:y:') ifTrue:[ |
1420 | 216 |
isKeyEvent := true. |
217 |
deviceMessage := #'deviceKeyRelease:x:y:'. |
|
218 |
delegateMessage := #'keyRelease:x:y:view:'. |
|
219 |
delegateQuery := #'handlesKeyRelease:inView:'. |
|
141 | 220 |
] ifFalse:[ (type == #'buttonMotion:x:y:') ifTrue:[ |
1420 | 221 |
isButtonEvent := true. |
222 |
deviceMessage := #'deviceButtonMotion:x:y:'. |
|
223 |
delegateMessage := #'buttonMotion:x:y:view:'. |
|
224 |
delegateQuery := #'handlesButtonMotion:inView:'. |
|
115 | 225 |
] ifFalse:[ (type == #'buttonPress:x:y:') ifTrue:[ |
1420 | 226 |
isButtonEvent := true. |
227 |
deviceMessage := #'deviceButtonPress:x:y:'. |
|
228 |
delegateMessage := #'buttonPress:x:y:view:'. |
|
229 |
delegateQuery := #'handlesButtonPress:inView:'. |
|
115 | 230 |
] ifFalse:[ (type == #'buttonRelease:x:y:') ifTrue:[ |
1420 | 231 |
isButtonEvent := true. |
232 |
deviceMessage := #'deviceButtonRelease:x:y:'. |
|
233 |
delegateMessage := #'buttonRelease:x:y:view:'. |
|
234 |
delegateQuery := #'handlesButtonRelease:inView:'. |
|
115 | 235 |
] ifFalse:[ (type == #'buttonShiftPress:x:y:') ifTrue:[ |
1420 | 236 |
isButtonEvent := true. |
237 |
deviceMessage := #'deviceButtonShiftPress:x:y:'. |
|
238 |
delegateMessage := #'buttonShiftPress:x:y:view:'. |
|
239 |
delegateQuery := #'handlesButtonShiftPress:inView:'. |
|
115 | 240 |
] ifFalse:[ (type == #'buttonMultiPress:x:y:') ifTrue:[ |
1420 | 241 |
isButtonEvent := true. |
242 |
deviceMessage := #'deviceButtonMultiPress:x:y:'. |
|
243 |
delegateMessage := #'buttonMultiPress:x:y:view:'. |
|
244 |
delegateQuery := #'handlesButtonMultiPress:inView:'. |
|
115 | 245 |
] ifFalse:[ (type == #'pointerEnter:x:y:') ifTrue:[ |
1420 | 246 |
isPointerEvent := true. |
247 |
deviceMessage := #'devicePointerEnter:x:y:'. |
|
248 |
delegateMessage := #'pointerEnter:x:y:view:'. |
|
249 |
delegateQuery := #'handlesPointerEnter:inView:'. |
|
115 | 250 |
] ifFalse:[ (type == #'pointerLeave:') ifTrue:[ |
1420 | 251 |
isPointerEvent := true. |
252 |
deviceMessage := type. |
|
253 |
delegateMessage := #'pointerLeave:view:'. |
|
254 |
delegateQuery := #'handlesPointerLeave:inView:'. |
|
115 | 255 |
] ifFalse:[ (type == #'exposeX:y:width:height:') ifTrue:[ |
1420 | 256 |
deviceMessage := #'deviceExposeX:y:width:height:'. |
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1158
diff
changeset
|
257 |
] ifFalse:[ (type == #'graphicsExposeX:y:width:height:final:') ifTrue:[ |
1420 | 258 |
deviceMessage := #'deviceGraphicsExposeX:y:width:height:final:'. |
115 | 259 |
]]]]]]]]]]]. |
89 | 260 |
|
141 | 261 |
" |
262 |
if there is a focusView, and its a keyboard event, pass it |
|
263 |
to that view (or its controller, or its delegate). |
|
264 |
In this case, a coordinate which is outside of |
|
143 | 265 |
the focusView (0 @ 0) is passed as x/y coordinates. |
141 | 266 |
" |
267 |
(focusView notNil |
|
268 |
and:[isKeyEvent]) ifTrue:[ |
|
1420 | 269 |
self sendEvent:type |
270 |
arguments:(Array with:(argArray at:1) with:0 with:0) |
|
271 |
view:focusView |
|
272 |
withFocusOn:nil |
|
273 |
delegate:doDelegate. |
|
274 |
^ self |
|
141 | 275 |
]. |
276 |
||
135 | 277 |
doDelegate ifTrue:[ |
1420 | 278 |
" |
279 |
handle delegated messages |
|
280 |
" |
|
281 |
(isKeyEvent |
|
282 |
or:[isButtonEvent |
|
283 |
or:[isPointerEvent]]) ifTrue:[ |
|
284 |
delegate := view delegate. |
|
135 | 285 |
|
1420 | 286 |
" |
287 |
what a kludge - sending to delegate requires |
|
288 |
another selector and an additional argument ... |
|
289 |
" |
|
290 |
(delegate notNil |
|
291 |
and:[delegate respondsTo:delegateMessage]) ifTrue:[ |
|
292 |
" |
|
293 |
is the delegate interested in that event ? |
|
294 |
(if it does not respond to the handlesXXX message, |
|
295 |
we assume: NO) |
|
296 |
" |
|
297 |
((delegate respondsTo:delegateQuery) |
|
298 |
and:[delegate perform:delegateQuery with:(argArray at:1) with:view]) ifTrue:[ |
|
299 |
" |
|
300 |
mhmh ... have to convert to logical coordinates |
|
301 |
" |
|
302 |
(trans := view transformation) notNil ifTrue:[ |
|
303 |
argArray size > 2 ifTrue:[ |
|
304 |
argArray at:2 put:(trans applyInverseToX:(argArray at:2)). |
|
305 |
argArray at:3 put:(trans applyInverseToY:(argArray at:3)). |
|
306 |
]. |
|
307 |
]. |
|
308 |
argArray isNil ifTrue:[ |
|
309 |
delegate perform:delegateMessage with:view |
|
310 |
] ifFalse:[ |
|
311 |
delegate perform:delegateMessage withArguments:(argArray copyWith:view) |
|
312 |
]. |
|
313 |
^ self |
|
314 |
] |
|
315 |
]. |
|
316 |
]. |
|
89 | 317 |
]. |
318 |
||
319 |
" |
|
320 |
if there is a controller, that one gets all user events |
|
321 |
" |
|
322 |
eventReceiver := view. |
|
323 |
(controller := view controller) notNil ifTrue:[ |
|
1420 | 324 |
(isKeyEvent |
325 |
or:[isButtonEvent |
|
326 |
or:[isPointerEvent |
|
327 |
or:[(type == #focusIn) |
|
328 |
or:[(type == #focusOut)]]]]) ifTrue:[ |
|
329 |
eventReceiver := controller. |
|
330 |
] |
|
89 | 331 |
]. |
332 |
||
333 |
" |
|
115 | 334 |
finally, another one: |
89 | 335 |
if the view has a transformation, edit the selector |
336 |
from #foo to #deviceFoo... |
|
337 |
This allows the view to handle the event either in device or |
|
338 |
logical coordinates. (since the deviceFoo-messages default implementation |
|
727
bf23a306b6f2
renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
339 |
in DisplaySurface translates and resends). |
89 | 340 |
Actually, I could always send deviceXXX without speed penalty |
341 |
(event sending is no high frequency operation), but that just adds |
|
342 |
another context to any debuggers walkback, making things less clear. |
|
343 |
" |
|
115 | 344 |
selector := type. |
345 |
||
89 | 346 |
view transformation notNil ifTrue:[ |
1420 | 347 |
(isKeyEvent |
348 |
or:[isButtonEvent |
|
349 |
or:[isPointerEvent |
|
350 |
or:[(type == #'exposeX:y:width:height:') |
|
351 |
or:[(type == #'graphicsExposeX:y:width:height:final:')]]]]) ifTrue:[ |
|
352 |
selector := deviceMessage |
|
353 |
] |
|
89 | 354 |
]. |
1420 | 355 |
|
115 | 356 |
eventReceiver perform:selector withArguments:argArray |
1420 | 357 |
|
1422 | 358 |
"Modified: 5.3.1997 / 14:06:43 / cg" |
115 | 359 |
! ! |
360 |
||
244 | 361 |
!WindowEvent methodsFor:'accessing'! |
362 |
||
363 |
arguments |
|
364 |
"return the arguments of the event" |
|
365 |
||
366 |
^ arguments |
|
367 |
! |
|
368 |
||
369 |
arguments:anArray |
|
370 |
"set the arguments" |
|
371 |
||
372 |
arguments := anArray |
|
373 |
! |
|
374 |
||
375 |
key |
|
376 |
"return the key of the key-event. For non key-events, nil is returned." |
|
377 |
||
378 |
((type == #keyPress:x:y:) |
|
379 |
or:[type == #keyRelease:x:y:]) ifTrue:[ |
|
380 |
^ arguments at:1 |
|
381 |
]. |
|
382 |
^ nil |
|
383 |
! |
|
384 |
||
385 |
rectangle |
|
386 |
"return the damage rectangle" |
|
387 |
||
388 |
^ arguments "consider this a kludge" |
|
389 |
! |
|
390 |
||
391 |
type |
|
392 |
"return the type of the event" |
|
393 |
||
394 |
^ type |
|
395 |
! |
|
396 |
||
397 |
view |
|
398 |
"return the view, for which the event is for" |
|
399 |
||
400 |
^ view |
|
401 |
! |
|
402 |
||
403 |
view:aView |
|
404 |
"set the view, for which the event is for" |
|
405 |
||
406 |
view := aView |
|
407 |
! ! |
|
408 |
||
511
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
409 |
!WindowEvent methodsFor:'printing & storing'! |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
410 |
|
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
411 |
displayString |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
412 |
^ self className |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
413 |
, '(' , type storeString |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
414 |
, ' view: ' , view className |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
415 |
, ' args: ' , arguments displayString |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
416 |
, ')' |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
417 |
|
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
418 |
"Created: 7.3.1996 / 14:55:50 / cg" |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
419 |
"Modified: 7.3.1996 / 14:58:21 / cg" |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
420 |
! ! |
233dabfcc81c
added #displayString (for eventTracing)
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
421 |
|
244 | 422 |
!WindowEvent methodsFor:'private accessing'! |
423 |
||
424 |
for:aView type:aSymbol arguments:argArray |
|
425 |
"set the instance variables of the event" |
|
426 |
||
427 |
view := aView. |
|
428 |
type := aSymbol. |
|
429 |
arguments := argArray |
|
430 |
! ! |
|
431 |
||
432 |
!WindowEvent methodsFor:'queries'! |
|
433 |
||
434 |
isButtonEvent |
|
435 |
"return true, if this event is a button event" |
|
436 |
||
437 |
^ (type == #buttonPress:x:y:) |
|
438 |
or:[type == #buttonRelease:x:y: |
|
439 |
or:[type == #'buttonShiftPress:x:y:' |
|
440 |
or:[type == #'buttonMultiPress:x:y:' |
|
441 |
or:[type == #'buttonMotion:x:y:']]]] |
|
442 |
! |
|
443 |
||
1420 | 444 |
isButtonPressEvent |
445 |
"return true, if this event is a buttonPress event" |
|
446 |
||
447 |
^ (type == #buttonPress:x:y:) |
|
448 |
||
449 |
"Created: 5.3.1997 / 12:25:43 / cg" |
|
450 |
! |
|
451 |
||
244 | 452 |
isDamage |
453 |
"return true, if this is a damage event" |
|
454 |
||
455 |
^ type == #damage |
|
456 |
! |
|
457 |
||
1420 | 458 |
isFocusEvent |
459 |
"return true, if this event is a focusIn/focusOut event" |
|
460 |
||
461 |
^ (type == #focusIn) or:[type == #focusOut] |
|
462 |
||
463 |
"Created: 5.3.1997 / 12:12:37 / cg" |
|
464 |
! |
|
465 |
||
466 |
isFocusInEvent |
|
467 |
"return true, if this event is a focusIn event" |
|
468 |
||
469 |
^ (type == #focusIn) |
|
470 |
||
471 |
"Created: 5.3.1997 / 12:18:10 / cg" |
|
472 |
! |
|
473 |
||
244 | 474 |
isKeyEvent |
475 |
"return true, if this event is a keyboard event" |
|
476 |
||
477 |
^ (type == #keyPress:x:y:) or:[type == #keyRelease:x:y:] |
|
478 |
! |
|
479 |
||
480 |
isKeyPressEvent |
|
481 |
"return true, if this event is a keyboard event" |
|
482 |
||
483 |
^ (type == #keyPress:x:y:) |
|
356 | 484 |
! |
485 |
||
486 |
isPointerEnterEvent |
|
487 |
"return true, if this event is a pointer-enter event" |
|
488 |
||
489 |
^ (type == #pointerEnter:x:y:) |
|
490 |
||
491 |
"Created: 9.1.1996 / 15:51:24 / cg" |
|
492 |
"Modified: 9.1.1996 / 15:51:40 / cg" |
|
493 |
! |
|
494 |
||
495 |
isPointerEnterLeaveEvent |
|
496 |
"return true, if this event is a pointer-enter/leave event" |
|
497 |
||
498 |
^ (type == #pointerEnter:x:y:) or:[type == #pointerLeave:view:] |
|
499 |
||
500 |
"Created: 9.1.1996 / 15:51:18 / cg" |
|
501 |
! |
|
502 |
||
503 |
isPointerLeaveEvent |
|
504 |
"return true, if this event is a pointer-leave event" |
|
505 |
||
506 |
^ type == #pointerLeave:view: |
|
507 |
||
508 |
"Created: 9.1.1996 / 15:51:36 / cg" |
|
1158 | 509 |
! |
510 |
||
511 |
isUserEvent |
|
512 |
"return true, if this event is a user event (i.e. mouse, keyboard or button)" |
|
513 |
||
514 |
(type == #buttonPress:x:y:) ifTrue:[^ true]. |
|
515 |
(type == #buttonRelease:x:y:) ifTrue:[^ true]. |
|
516 |
(type == #buttonShiftPress:x:y:) ifTrue:[^ true]. |
|
517 |
(type == #buttonMultiPress:x:y:) ifTrue:[^ true]. |
|
518 |
(type == #buttonMotion:x:y:) ifTrue:[^ true]. |
|
519 |
||
520 |
(type == #keyPress:x:y:) ifTrue:[^ true]. |
|
521 |
(type == #keyRelease:x:y:) ifTrue:[^ true]. |
|
522 |
||
1420 | 523 |
(type == #pointerEnter:x:y:) ifTrue:[^ true]. |
524 |
"/ (type == #pointerLeave:) ifTrue:[^ true]. |
|
525 |
||
1158 | 526 |
^ false |
527 |
||
1420 | 528 |
"Modified: 5.3.1997 / 11:27:40 / cg" |
244 | 529 |
! ! |
530 |
||
115 | 531 |
!WindowEvent methodsFor:'sending'! |
532 |
||
533 |
sendEvent |
|
144 | 534 |
"forward the event represented by the receiver to the views delegate, |
535 |
the views controller or the view. Ignore any focusView." |
|
115 | 536 |
|
537 |
self sendEventWithFocusOn:nil |
|
538 |
! |
|
539 |
||
540 |
sendEventWithFocusOn:focusView |
|
144 | 541 |
"forward the event represented by the receiver to the views delegate, |
542 |
the views controller or the view. |
|
543 |
If focusView is nonNil, and the receiver is a keyboard event, |
|
544 |
the event will be forwarded to the focusView instead |
|
545 |
(or its delegate, or its controller)." |
|
115 | 546 |
|
135 | 547 |
self class |
548 |
sendEvent:type |
|
549 |
arguments:arguments |
|
550 |
view:view |
|
551 |
withFocusOn:focusView |
|
552 |
delegate:true |
|
11 | 553 |
! ! |
554 |
||
251 | 555 |
!WindowEvent class methodsFor:'documentation'! |
556 |
||
557 |
version |
|
1422 | 558 |
^ '$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.34 1997-03-05 13:06:52 cg Exp $' |
251 | 559 |
! ! |