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. package org.w3c.dom.events;
  13. import org.w3c.dom.views.AbstractView;
  14. /**
  15. * The <code>MouseEvent</code> interface provides specific contextual
  16. * information associated with Mouse events.
  17. * <p>The <code>detail</code> attribute inherited from <code>UIEvent</code>
  18. * indicates the number of times a mouse button has been pressed and
  19. * released over the same screen location during a user action. The
  20. * attribute value is 1 when the user begins this action and increments by 1
  21. * for each full sequence of pressing and releasing. If the user moves the
  22. * mouse between the mousedown and mouseup the value will be set to 0,
  23. * indicating that no click is occurring.
  24. * <p>In the case of nested elements mouse events are always targeted at the
  25. * most deeply nested element. Ancestors of the targeted element may use
  26. * bubbling to obtain notification of mouse events which occur within its
  27. * descendent elements.
  28. * <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>.
  29. * @since DOM Level 2
  30. */
  31. public interface MouseEvent extends UIEvent {
  32. /**
  33. * The horizontal coordinate at which the event occurred relative to the
  34. * origin of the screen coordinate system.
  35. */
  36. public int getScreenX();
  37. /**
  38. * The vertical coordinate at which the event occurred relative to the
  39. * origin of the screen coordinate system.
  40. */
  41. public int getScreenY();
  42. /**
  43. * The horizontal coordinate at which the event occurred relative to the
  44. * DOM implementation's client area.
  45. */
  46. public int getClientX();
  47. /**
  48. * The vertical coordinate at which the event occurred relative to the DOM
  49. * implementation's client area.
  50. */
  51. public int getClientY();
  52. /**
  53. * Used to indicate whether the 'ctrl' key was depressed during the firing
  54. * of the event.
  55. */
  56. public boolean getCtrlKey();
  57. /**
  58. * Used to indicate whether the 'shift' key was depressed during the
  59. * firing of the event.
  60. */
  61. public boolean getShiftKey();
  62. /**
  63. * Used to indicate whether the 'alt' key was depressed during the firing
  64. * of the event. On some platforms this key may map to an alternative
  65. * key name.
  66. */
  67. public boolean getAltKey();
  68. /**
  69. * Used to indicate whether the 'meta' key was depressed during the firing
  70. * of the event. On some platforms this key may map to an alternative
  71. * key name.
  72. */
  73. public boolean getMetaKey();
  74. /**
  75. * During mouse events caused by the depression or release of a mouse
  76. * button, <code>button</code> is used to indicate which mouse button
  77. * changed state. The values for <code>button</code> range from zero to
  78. * indicate the left button of the mouse, one to indicate the middle
  79. * button if present, and two to indicate the right button. For mice
  80. * configured for left handed use in which the button actions are
  81. * reversed the values are instead read from right to left.
  82. */
  83. public short getButton();
  84. /**
  85. * Used to identify a secondary <code>EventTarget</code> related to a UI
  86. * event. Currently this attribute is used with the mouseover event to
  87. * indicate the <code>EventTarget</code> which the pointing device
  88. * exited and with the mouseout event to indicate the
  89. * <code>EventTarget</code> which the pointing device entered.
  90. */
  91. public EventTarget getRelatedTarget();
  92. /**
  93. * The <code>initMouseEvent</code> method is used to initialize the value
  94. * of a <code>MouseEvent</code> created through the
  95. * <code>DocumentEvent</code> interface. This method may only be called
  96. * before the <code>MouseEvent</code> has been dispatched via the
  97. * <code>dispatchEvent</code> method, though it may be called multiple
  98. * times during that phase if necessary. If called multiple times, the
  99. * final invocation takes precedence.
  100. * @param typeArgSpecifies the event type.
  101. * @param canBubbleArgSpecifies whether or not the event can bubble.
  102. * @param cancelableArgSpecifies whether or not the event's default
  103. * action can be prevented.
  104. * @param viewArgSpecifies the <code>Event</code>'s
  105. * <code>AbstractView</code>.
  106. * @param detailArgSpecifies the <code>Event</code>'s mouse click count.
  107. * @param screenXArgSpecifies the <code>Event</code>'s screen x coordinate
  108. * @param screenYArgSpecifies the <code>Event</code>'s screen y coordinate
  109. * @param clientXArgSpecifies the <code>Event</code>'s client x coordinate
  110. * @param clientYArgSpecifies the <code>Event</code>'s client y coordinate
  111. * @param ctrlKeyArgSpecifies whether or not control key was depressed
  112. * during the <code>Event</code>.
  113. * @param altKeyArgSpecifies whether or not alt key was depressed during
  114. * the <code>Event</code>.
  115. * @param shiftKeyArgSpecifies whether or not shift key was depressed
  116. * during the <code>Event</code>.
  117. * @param metaKeyArgSpecifies whether or not meta key was depressed
  118. * during the <code>Event</code>.
  119. * @param buttonArgSpecifies the <code>Event</code>'s mouse button.
  120. * @param relatedTargetArgSpecifies the <code>Event</code>'s related
  121. * <code>EventTarget</code>.
  122. */
  123. public void initMouseEvent(String typeArg,
  124. boolean canBubbleArg,
  125. boolean cancelableArg,
  126. AbstractView viewArg,
  127. int detailArg,
  128. int screenXArg,
  129. int screenYArg,
  130. int clientXArg,
  131. int clientYArg,
  132. boolean ctrlKeyArg,
  133. boolean altKeyArg,
  134. boolean shiftKeyArg,
  135. boolean metaKeyArg,
  136. short buttonArg,
  137. EventTarget relatedTargetArg);
  138. }