|
Sydney | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Object | +--Event
Defined in events.js
| Constructor Summary | |
Event
()
|
|
| Method Summary | |
void
|
addEventListener(<DOMNode> element, <string> eventName, <Function> listener)
Adds an event listener to element.
|
DOMEvent
|
getEvent(<DOMEvent> e)
Returns the event currently being raised. |
int
|
getKeyCode(<DOMEvent> event)
Returns the key code of the key that was pressed when event
happened.
|
Mouse
|
getMouseButton(<DOMEvent> event)
Returns a code indicating which mouse button was depressed during event.
|
Point
|
getMousePoint(<DOMEvent> event)
Returns the co-ordinates of the mouse at the time of event
in a Point of Pixels.
|
Point
|
getRelativeMousePoint(<DOMNode> element, <DOMEvent> event)
Returns the co-ordinates of the mouse at the time of event
relative to element.
|
boolean
|
isAltPressed(<DOMEvent> event)
Returns true if the user was holding down the
Alt key while event took place, and
false otherwise.
|
boolean
|
isCtrlPressed(<DOMEvent> event)
Returns true if the user was holding down the
Ctrl key while event took place, and
false otherwise.
|
boolean
|
isShiftPressed(<DOMEvent> event)
Returns true if the user was holding down the
Shift key while event took place, and
false otherwise.
|
boolean
|
preventDefault(<DOMEvent> event)
Prevents the default action associated with event from
happening.
|
void
|
preventSelection(<DOMNode> html)
Prevents text-selection on html and its descendants.
|
void
|
removeEventListener(<DOMNode> element, <string> eventName, <Function> listener)
Removes an event listener from element.
|
void
|
stopPropagation(<DOMEvent> event)
Blocks event from bubbling any further up the document in a
browser-independent way.
|
| Constructor Detail |
function Event()
| Method Detail |
void addEventListener(<DOMNode> element, <string> eventName, <Function> listener)
element. Does nothing if
listener has already been registered for
eventName events on element (ie. it is safe to
register a listener twice for the same event—the listener will
be called only once, not twice).
Note: element must have a unique
.id attribute. The html
member in Widget is guaranteed to have a unique id,
but other DOM nodes may need to be given one.
element - the element of the DOM to which listener should be attached
eventName - the name of the event to which listener should listen
listener - the function to be called when events named eventName are raised on element
DOMEvent getEvent(<DOMEvent> e)
Event.getEvent. The return value will be the proper event
object. For example:
var html = ...; // some DOM node
// note that the listener is declared with one formal parameter
Event.addEventListener(html, 'someevent', function(e) {
// at this point, e might refer to the event object, or it might be
// undefined--it depends on the user's browser.
var event = Event.getEvent(e);
// event now refers to the event object, regardless of which browser the
// user is running
});
e - the first parameter to an event listener
int getKeyCode(<DOMEvent> event)
event
happened. See KeyCode for some common key codes.
event - the event to query
Mouse getMouseButton(<DOMEvent> event)
event.
event - the event to query
Point getMousePoint(<DOMEvent> event)
event
in a Point of Pixels. The
co-ordinates are relative to the browser's viewport (0, 0).
event - the event to query
event happened
Point getRelativeMousePoint(<DOMNode> element, <DOMEvent> event)
event
relative to element. The co-ordinates are returned as a
Point of Pixels.
element - the element to which the returned co-ordinates should be relative
event - the event that should be queried for co-ordinates
event happened, relative to element
boolean isAltPressed(<DOMEvent> event)
true if the user was holding down the
Alt key while event took place, and
false otherwise.
event - the event to be queried
event
boolean isCtrlPressed(<DOMEvent> event)
true if the user was holding down the
Ctrl key while event took place, and
false otherwise.
event - the event to be queried
event
boolean isShiftPressed(<DOMEvent> event)
true if the user was holding down the
Shift key while event took place, and
false otherwise.
event - the event to be queried
event
boolean preventDefault(<DOMEvent> event)
event from
happening. To be effective in all browsers, the return value from
preventDefault must be the return value of the event
listener that is trying to prevent the default action.
event - the event whose default action should be blocked
false
void preventSelection(<DOMNode> html)
html and its descendants.
html - the element for which text-selection should be prohibited
void removeEventListener(<DOMNode> element, <string> eventName, <Function> listener)
element. Does nothing if
listener has not already been registered for
eventName events on element (ie. it is safe to
unregister the same listener twice).
element - the element of the DOM from which listener should be detached
eventName - the name of the event to which listener may be listening
listener - the function to unregister
void stopPropagation(<DOMEvent> event)
event from bubbling any further up the document in a
browser-independent way.
event - the event to "swallow"
|
Sydney | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||