001/* 002 * Copyright (c) 2000 World Wide Web Consortium, 003 * (Massachusetts Institute of Technology, Institut National de 004 * Recherche en Informatique et en Automatique, Keio University). All 005 * Rights Reserved. This program is distributed under the W3C's Software 006 * Intellectual Property License. This program is distributed in the 007 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even 008 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 009 * PURPOSE. 010 * See W3C License http://www.w3.org/Consortium/Legal/ for more details. 011 */ 012 013package org.w3c.dom.events; 014 015import org.w3c.dom.views.AbstractView; 016 017/** 018 * The <code>MouseEvent</code> interface provides specific contextual 019 * information associated with Mouse events. 020 * <p>The <code>detail</code> attribute inherited from <code>UIEvent</code> 021 * indicates the number of times a mouse button has been pressed and 022 * released over the same screen location during a user action. The 023 * attribute value is 1 when the user begins this action and increments by 1 024 * for each full sequence of pressing and releasing. If the user moves the 025 * mouse between the mousedown and mouseup the value will be set to 0, 026 * indicating that no click is occurring. 027 * <p>In the case of nested elements mouse events are always targeted at the 028 * most deeply nested element. Ancestors of the targeted element may use 029 * bubbling to obtain notification of mouse events which occur within its 030 * descendent elements. 031 * <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>. 032 * @since DOM Level 2 033 */ 034public interface MouseEvent extends UIEvent { 035 /** 036 * The horizontal coordinate at which the event occurred relative to the 037 * origin of the screen coordinate system. 038 */ 039 public int getScreenX(); 040 041 /** 042 * The vertical coordinate at which the event occurred relative to the 043 * origin of the screen coordinate system. 044 */ 045 public int getScreenY(); 046 047 /** 048 * The horizontal coordinate at which the event occurred relative to the 049 * DOM implementation's client area. 050 */ 051 public int getClientX(); 052 053 /** 054 * The vertical coordinate at which the event occurred relative to the DOM 055 * implementation's client area. 056 */ 057 public int getClientY(); 058 059 /** 060 * Used to indicate whether the 'ctrl' key was depressed during the firing 061 * of the event. 062 */ 063 public boolean getCtrlKey(); 064 065 /** 066 * Used to indicate whether the 'shift' key was depressed during the 067 * firing of the event. 068 */ 069 public boolean getShiftKey(); 070 071 /** 072 * Used to indicate whether the 'alt' key was depressed during the firing 073 * of the event. On some platforms this key may map to an alternative 074 * key name. 075 */ 076 public boolean getAltKey(); 077 078 /** 079 * Used to indicate whether the 'meta' key was depressed during the firing 080 * of the event. On some platforms this key may map to an alternative 081 * key name. 082 */ 083 public boolean getMetaKey(); 084 085 /** 086 * During mouse events caused by the depression or release of a mouse 087 * button, <code>button</code> is used to indicate which mouse button 088 * changed state. The values for <code>button</code> range from zero to 089 * indicate the left button of the mouse, one to indicate the middle 090 * button if present, and two to indicate the right button. For mice 091 * configured for left handed use in which the button actions are 092 * reversed the values are instead read from right to left. 093 */ 094 public short getButton(); 095 096 /** 097 * Used to identify a secondary <code>EventTarget</code> related to a UI 098 * event. Currently this attribute is used with the mouseover event to 099 * 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. 102 */ 103 public EventTarget getRelatedTarget(); 104 105 /** 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 121 * coordinate 122 * @param screenYArg Specifies the <code>Event</code>'s screen y 123 * coordinate 124 * @param clientXArg Specifies the <code>Event</code>'s client x 125 * coordinate 126 * @param clientYArg Specifies the <code>Event</code>'s client y 127 * coordinate 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>. 139 */ 140 public void initMouseEvent(String typeArg, 141 boolean canBubbleArg, 142 boolean cancelableArg, 143 AbstractView viewArg, 144 int detailArg, 145 int screenXArg, 146 int screenYArg, 147 int clientXArg, 148 int clientYArg, 149 boolean ctrlKeyArg, 150 boolean altKeyArg, 151 boolean shiftKeyArg, 152 boolean metaKeyArg, 153 short buttonArg, 154 EventTarget relatedTargetArg); 155 156}