Frames | No Frames |
1: /* 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 9: * PURPOSE. 10: * See W3C License http://www.w3.org/Consortium/Legal/ for more details. 11: */ 12: 13: package org.w3c.dom.events; 14: 15: import org.w3c.dom.views.AbstractView; 16: 17: /** 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>. 32: * @since DOM Level 2 33: */ 34: public interface MouseEvent extends UIEvent { 35: /** 36: * The horizontal coordinate at which the event occurred relative to the 37: * origin of the screen coordinate system. 38: */ 39: public int getScreenX(); 40: 41: /** 42: * The vertical coordinate at which the event occurred relative to the 43: * origin of the screen coordinate system. 44: */ 45: public int getScreenY(); 46: 47: /** 48: * The horizontal coordinate at which the event occurred relative to the 49: * DOM implementation's client area. 50: */ 51: public int getClientX(); 52: 53: /** 54: * The vertical coordinate at which the event occurred relative to the DOM 55: * implementation's client area. 56: */ 57: public int getClientY(); 58: 59: /** 60: * Used to indicate whether the 'ctrl' key was depressed during the firing 61: * of the event. 62: */ 63: public boolean getCtrlKey(); 64: 65: /** 66: * Used to indicate whether the 'shift' key was depressed during the 67: * firing of the event. 68: */ 69: public boolean getShiftKey(); 70: 71: /** 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 74: * key name. 75: */ 76: public boolean getAltKey(); 77: 78: /** 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 81: * key name. 82: */ 83: public boolean getMetaKey(); 84: 85: /** 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. 93: */ 94: public short getButton(); 95: 96: /** 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. 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: }