001 /*
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
003 *
004 * This code is free software; you can redistribute it and/or modify it
005 * under the terms of the GNU General Public License version 2 only, as
006 * published by the Free Software Foundation. Sun designates this
007 * particular file as subject to the "Classpath" exception as provided
008 * by Sun in the LICENSE file that accompanied this code.
009 *
010 * This code is distributed in the hope that it will be useful, but WITHOUT
011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
013 * version 2 for more details (a copy is included in the LICENSE file that
014 * accompanied this code).
015 *
016 * You should have received a copy of the GNU General Public License version
017 * 2 along with this work; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
019 *
020 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
021 * CA 95054 USA or visit www.sun.com if you need additional information or
022 * have any questions.
023 */
024
025 /*
026 * This file is available under and governed by the GNU General Public
027 * License version 2 only, as published by the Free Software Foundation.
028 * However, the following notice accompanied the original version of this
029 * file and, per its terms, should not be removed:
030 *
031 * Copyright (c) 2000 World Wide Web Consortium,
032 * (Massachusetts Institute of Technology, Institut National de
033 * Recherche en Informatique et en Automatique, Keio University). All
034 * Rights Reserved. This program is distributed under the W3C's Software
035 * Intellectual Property License. This program is distributed in the
036 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
037 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
038 * PURPOSE.
039 * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
040 */
041
042 package org.w3c.dom.events;
043
044 import org.w3c.dom.views.AbstractView;
045
046 /**
047 * The <code>MouseEvent</code> interface provides specific contextual
048 * information associated with Mouse events.
049 * <p>The <code>detail</code> attribute inherited from <code>UIEvent</code>
050 * indicates the number of times a mouse button has been pressed and
051 * released over the same screen location during a user action. The
052 * attribute value is 1 when the user begins this action and increments by 1
053 * for each full sequence of pressing and releasing. If the user moves the
054 * mouse between the mousedown and mouseup the value will be set to 0,
055 * indicating that no click is occurring.
056 * <p>In the case of nested elements mouse events are always targeted at the
057 * most deeply nested element. Ancestors of the targeted element may use
058 * bubbling to obtain notification of mouse events which occur within its
059 * descendent elements.
060 * <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>.
061 * @since DOM Level 2
062 */
063 public interface MouseEvent extends UIEvent {
064 /**
065 * The horizontal coordinate at which the event occurred relative to the
066 * origin of the screen coordinate system.
067 */
068 public int getScreenX();
069
070 /**
071 * The vertical coordinate at which the event occurred relative to the
072 * origin of the screen coordinate system.
073 */
074 public int getScreenY();
075
076 /**
077 * The horizontal coordinate at which the event occurred relative to the
078 * DOM implementation's client area.
079 */
080 public int getClientX();
081
082 /**
083 * The vertical coordinate at which the event occurred relative to the DOM
084 * implementation's client area.
085 */
086 public int getClientY();
087
088 /**
089 * Used to indicate whether the 'ctrl' key was depressed during the firing
090 * of the event.
091 */
092 public boolean getCtrlKey();
093
094 /**
095 * Used to indicate whether the 'shift' key was depressed during the
096 * firing of the event.
097 */
098 public boolean getShiftKey();
099
100 /**
101 * Used to indicate whether the 'alt' key was depressed during the firing
102 * of the event. On some platforms this key may map to an alternative
103 * key name.
104 */
105 public boolean getAltKey();
106
107 /**
108 * Used to indicate whether the 'meta' key was depressed during the firing
109 * of the event. On some platforms this key may map to an alternative
110 * key name.
111 */
112 public boolean getMetaKey();
113
114 /**
115 * During mouse events caused by the depression or release of a mouse
116 * button, <code>button</code> is used to indicate which mouse button
117 * changed state. The values for <code>button</code> range from zero to
118 * indicate the left button of the mouse, one to indicate the middle
119 * button if present, and two to indicate the right button. For mice
120 * configured for left handed use in which the button actions are
121 * reversed the values are instead read from right to left.
122 */
123 public short getButton();
124
125 /**
126 * Used to identify a secondary <code>EventTarget</code> related to a UI
127 * event. Currently this attribute is used with the mouseover event to
128 * indicate the <code>EventTarget</code> which the pointing device
129 * exited and with the mouseout event to indicate the
130 * <code>EventTarget</code> which the pointing device entered.
131 */
132 public EventTarget getRelatedTarget();
133
134 /**
135 * The <code>initMouseEvent</code> method is used to initialize the value
136 * of a <code>MouseEvent</code> created through the
137 * <code>DocumentEvent</code> interface. This method may only be called
138 * before the <code>MouseEvent</code> has been dispatched via the
139 * <code>dispatchEvent</code> method, though it may be called multiple
140 * times during that phase if necessary. If called multiple times, the
141 * final invocation takes precedence.
142 * @param typeArg Specifies the event type.
143 * @param canBubbleArg Specifies whether or not the event can bubble.
144 * @param cancelableArg Specifies whether or not the event's default
145 * action can be prevented.
146 * @param viewArg Specifies the <code>Event</code>'s
147 * <code>AbstractView</code>.
148 * @param detailArg Specifies the <code>Event</code>'s mouse click count.
149 * @param screenXArg Specifies the <code>Event</code>'s screen x
150 * coordinate
151 * @param screenYArg Specifies the <code>Event</code>'s screen y
152 * coordinate
153 * @param clientXArg Specifies the <code>Event</code>'s client x
154 * coordinate
155 * @param clientYArg Specifies the <code>Event</code>'s client y
156 * coordinate
157 * @param ctrlKeyArg Specifies whether or not control key was depressed
158 * during the <code>Event</code>.
159 * @param altKeyArg Specifies whether or not alt key was depressed during
160 * the <code>Event</code>.
161 * @param shiftKeyArg Specifies whether or not shift key was depressed
162 * during the <code>Event</code>.
163 * @param metaKeyArg Specifies whether or not meta key was depressed
164 * during the <code>Event</code>.
165 * @param buttonArg Specifies the <code>Event</code>'s mouse button.
166 * @param relatedTargetArg Specifies the <code>Event</code>'s related
167 * <code>EventTarget</code>.
168 */
169 public void initMouseEvent(String typeArg, boolean canBubbleArg,
170 boolean cancelableArg, AbstractView viewArg, int detailArg,
171 int screenXArg, int screenYArg, int clientXArg,
172 int clientYArg, boolean ctrlKeyArg, boolean altKeyArg,
173 boolean shiftKeyArg, boolean metaKeyArg, short buttonArg,
174 EventTarget relatedTargetArg);
175
176 }
|