1 /* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. Oracle designates this 7 * particular file as subject to the "Classpath" exception as provided 8 * by Oracle in the LICENSE file that accompanied this code. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 */ 24 25 /* 26 * This file is available under and governed by the GNU General Public 27 * License version 2 only, as published by the Free Software Foundation. 28 * However, the following notice accompanied the original version of this 29 * file and, per its terms, should not be removed: 30 * 31 * Copyright (c) 2000 World Wide Web Consortium, 32 * (Massachusetts Institute of Technology, Institut National de 33 * Recherche en Informatique et en Automatique, Keio University). All 34 * Rights Reserved. This program is distributed under the W3C's Software 35 * Intellectual Property License. This program is distributed in the 36 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even 37 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 38 * PURPOSE. 39 * See W3C License http://www.w3.org/Consortium/Legal/ for more details. 40 */ 41 42 package org.w3c.dom.events; 43 44 import org.w3c.dom.views.AbstractView; 45 46 /** 47 * The <code>MouseEvent</code> interface provides specific contextual 48 * information associated with Mouse events. 49 * <p>The <code>detail</code> attribute inherited from <code>UIEvent</code> 50 * indicates the number of times a mouse button has been pressed and 51 * released over the same screen location during a user action. The 52 * attribute value is 1 when the user begins this action and increments by 1 53 * for each full sequence of pressing and releasing. If the user moves the 54 * mouse between the mousedown and mouseup the value will be set to 0, 55 * indicating that no click is occurring. 56 * <p>In the case of nested elements mouse events are always targeted at the 57 * most deeply nested element. Ancestors of the targeted element may use 58 * bubbling to obtain notification of mouse events which occur within its 59 * descendent elements. 60 * <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>. 61 * @since 1.5, DOM Level 2 62 */ 63 public interface MouseEvent extends UIEvent { 64 /** 65 * The horizontal coordinate at which the event occurred relative to the 66 * origin of the screen coordinate system. 67 */ 68 public int getScreenX(); 69 70 /** 71 * The vertical coordinate at which the event occurred relative to the 72 * origin of the screen coordinate system. 73 */ 74 public int getScreenY(); 75 76 /** 77 * The horizontal coordinate at which the event occurred relative to the 78 * DOM implementation's client area. 79 */ 80 public int getClientX(); 81 82 /** 83 * The vertical coordinate at which the event occurred relative to the DOM 84 * implementation's client area. 85 */ 86 public int getClientY(); 87 88 /** 89 * Used to indicate whether the 'ctrl' key was depressed during the firing 90 * of the event. 91 */ 92 public boolean getCtrlKey(); 93 94 /** 95 * Used to indicate whether the 'shift' key was depressed during the 96 * firing of the event. 97 */ 98 public boolean getShiftKey(); 99 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, 170 boolean canBubbleArg, 171 boolean cancelableArg, 172 AbstractView viewArg, 173 int detailArg, 174 int screenXArg, 175 int screenYArg, 176 int clientXArg, 177 int clientYArg, 178 boolean ctrlKeyArg, 179 boolean altKeyArg, 180 boolean shiftKeyArg, 181 boolean metaKeyArg, 182 short buttonArg, 183 EventTarget relatedTargetArg); 184 185 }