2 * Copyright (c) 2000 World Wide Web Consortium,
3 * (Massachusetts Institute of Technology, Institut National de
4 * Recherche en Informatique et en Automatique, Keio University). All
5 * Rights Reserved. This program is distributed under the W3C's Software
6 * Intellectual Property License. This program is distributed in the
7 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
8 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
13 package org.w3c.dom.events;
15 import org.w3c.dom.views.AbstractView;
18 * The <code>MouseEvent</code> interface provides specific contextual
19 * information associated with Mouse events.
20 * <p>The <code>detail</code> attribute inherited from <code>UIEvent</code>
21 * indicates the number of times a mouse button has been pressed and
22 * released over the same screen location during a user action. The
23 * attribute value is 1 when the user begins this action and increments by 1
24 * for each full sequence of pressing and releasing. If the user moves the
25 * mouse between the mousedown and mouseup the value will be set to 0,
26 * indicating that no click is occurring.
27 * <p>In the case of nested elements mouse events are always targeted at the
28 * most deeply nested element. Ancestors of the targeted element may use
29 * bubbling to obtain notification of mouse events which occur within its
30 * descendent elements.
31 * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113'>Document Object Model (DOM) Level 2 Events Specification</a>.
34 public interface MouseEvent extends UIEvent {
36 * The horizontal coordinate at which the event occurred relative to the
37 * origin of the screen coordinate system.
39 public int getScreenX();
42 * The vertical coordinate at which the event occurred relative to the
43 * origin of the screen coordinate system.
45 public int getScreenY();
48 * The horizontal coordinate at which the event occurred relative to the
49 * DOM implementation's client area.
51 public int getClientX();
54 * The vertical coordinate at which the event occurred relative to the DOM
55 * implementation's client area.
57 public int getClientY();
60 * Used to indicate whether the 'ctrl' key was depressed during the firing
63 public boolean getCtrlKey();
66 * Used to indicate whether the 'shift' key was depressed during the
67 * firing of the event.
69 public boolean getShiftKey();
72 * Used to indicate whether the 'alt' key was depressed during the firing
73 * of the event. On some platforms this key may map to an alternative
76 public boolean getAltKey();
79 * Used to indicate whether the 'meta' key was depressed during the firing
80 * of the event. On some platforms this key may map to an alternative
83 public boolean getMetaKey();
86 * During mouse events caused by the depression or release of a mouse
87 * button, <code>button</code> is used to indicate which mouse button
88 * changed state. The values for <code>button</code> range from zero to
89 * indicate the left button of the mouse, one to indicate the middle
90 * button if present, and two to indicate the right button. For mice
91 * configured for left handed use in which the button actions are
92 * reversed the values are instead read from right to left.
94 public short getButton();
97 * Used to identify a secondary <code>EventTarget</code> related to a UI
98 * event. Currently this attribute is used with the mouseover event to
99 * indicate the <code>EventTarget</code> which the pointing device
100 * exited and with the mouseout event to indicate the
101 * <code>EventTarget</code> which the pointing device entered.
103 public EventTarget getRelatedTarget();
106 * The <code>initMouseEvent</code> method is used to initialize the value
107 * of a <code>MouseEvent</code> created through the
108 * <code>DocumentEvent</code> interface. This method may only be called
109 * before the <code>MouseEvent</code> has been dispatched via the
110 * <code>dispatchEvent</code> method, though it may be called multiple
111 * times during that phase if necessary. If called multiple times, the
112 * final invocation takes precedence.
113 * @param typeArg Specifies the event type.
114 * @param canBubbleArg Specifies whether or not the event can bubble.
115 * @param cancelableArg Specifies whether or not the event's default
116 * action can be prevented.
117 * @param viewArg Specifies the <code>Event</code>'s
118 * <code>AbstractView</code>.
119 * @param detailArg Specifies the <code>Event</code>'s mouse click count.
120 * @param screenXArg Specifies the <code>Event</code>'s screen x
122 * @param screenYArg Specifies the <code>Event</code>'s screen y
124 * @param clientXArg Specifies the <code>Event</code>'s client x
126 * @param clientYArg Specifies the <code>Event</code>'s client y
128 * @param ctrlKeyArg Specifies whether or not control key was depressed
129 * during the <code>Event</code>.
130 * @param altKeyArg Specifies whether or not alt key was depressed during
131 * the <code>Event</code>.
132 * @param shiftKeyArg Specifies whether or not shift key was depressed
133 * during the <code>Event</code>.
134 * @param metaKeyArg Specifies whether or not meta key was depressed
135 * during the <code>Event</code>.
136 * @param buttonArg Specifies the <code>Event</code>'s mouse button.
137 * @param relatedTargetArg Specifies the <code>Event</code>'s related
138 * <code>EventTarget</code>.
140 public void initMouseEvent(String typeArg,
141 boolean canBubbleArg,
142 boolean cancelableArg,
143 AbstractView viewArg,
154 EventTarget relatedTargetArg);