|
Class: EventListener
Object
|
+--EventListener
|
+--ActiveHelp
|
+--PluggableEventListener
|
+--ScreenLock
- Package:
- stx:libview2
- Category:
- Interface-Support-UI
- Version:
- rev:
1.31
date: 2022/10/11 16:24:59
- user: cg
- file: EventListener.st directory: libview2
- module: stx stc-classLibrary: libview2
abstract class for event listeners. EventListeners can be used to intercept
incoming events (keyboard & mouse) directly from a sensor, or even
for a complete display device.
A concrete application is the bubble help, which tracks entering/leaving
views, and pops up some help message.
See concrete code in ActiveHelp.
For each intercepted event, a corresponding method is called for in instances
of myself - these MUST return true, if the event is to be ignored (i.e.
assumed to be processed and consumed by the reader,
and MUST return false, if the normal event procedure should be performed.
Since this is an abstract class,
all of my intercept methods return false.
They are meant to be redefined in concrete subclasses.
copyrightCOPYRIGHT (c) 1995 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
event handling
-
buttonMotion: buttonAndModifierState x: x y: y view: aView
-
not handled here - should be redefined in a concrete subclass
-
buttonMultiPress: button x: x y: y view: aView
-
not handled here - should be redefined in a concrete subclass
-
buttonPress: button x: x y: y view: aView
-
not handled here - should be redefined in a concrete subclass
-
buttonRelease: button x: x y: y view: aView
-
not handled here - should be redefined in a concrete subclass
-
focusInView: aView
-
not handled here - should be redefined in a concrete subclass
-
focusOutView: aView
-
not handled here - should be redefined in a concrete subclass
-
hasKeyboardFocus: aBoolean view: aView
-
not handled here - should be redefined in a concrete subclass
-
hotkeyWithId: aHotKeyId rawKey: theRawKey view: aView
-
not handled here - should be redefined in a concrete subclass
-
keyPress: key x: x y: y view: aView
-
not handled here - should be redefined in a concrete subclass
-
keyRelease: key x: x y: y view: aView
-
not handled here - should be redefined in a concrete subclass
-
mouseWheelMotion: state x: x y: y amount: amount deltaTime: dTime view: aView
-
not handled here - can be redefined in a concrete subclass
-
pointerEnter: state x: x y: y view: view
-
not handled here - should be redefined in a concrete subclass
-
pointerLeave: state view: view
-
not handled here - should be redefined in a concrete subclass
event handling-basic
-
processEvent: ev
-
process an event; if true is returned, the event is considered to be
'eaten' by the listener, and not passed to the view.
If false is returned, the event is processed as usual.
Here, the event is dispatched into one of the button*/key* etc. methods
events-window creation
-
postCreateView: aView
-
a synthetic event:
some view was created
-
preCreateView: aView
-
a synthetic event:
some view is about to be created;
gives me a chance to intercept and change size, origin, color, etc.
-
preCreateView: aView origin: org
-
Obsolete now - the system will now send a preCreateView: event (without origin arg).
not really an event:
invoked right before a view is about to be physically created.
May return a new origin.
listen
-
listen
-
install myself as listener
Usage example(s):
|listener|
listener := EventListener new.
listener listen.
(Delay forSeconds:20) wait.
listener unlisten
|
-
unlisten
-
uninstall myself as listener
|