001: /*
002: * Copyright (c) 2006 World Wide Web Consortium,
003: *
004: * (Massachusetts Institute of Technology, European Research Consortium for
005: * Informatics and Mathematics, Keio University). All Rights Reserved. This
006: * work is distributed under the W3C(r) Software License [1] in the hope that
007: * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
008: * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
009: *
010: * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
011: */
012:
013: package org.w3c.dom.events;
014:
015: import org.w3c.dom.views.AbstractView;
016:
017: /**
018: * The <code>MouseEvent</code> interface provides specific contextual
019: * information associated with Mouse events.
020: * <p> In the case of nested elements mouse events are always targeted at the
021: * most deeply nested element. Ancestors of the targeted element may use
022: * bubbling to obtain notification of mouse events which occur within theirs
023: * descendent elements.
024: * <p> To create an instance of the <code>MouseEvent</code> interface, use the
025: * <code>DocumentEvent.createEvent("MouseEvent")</code> method call.
026: * <p ><b>Note:</b> When initializing <code>MouseEvent</code> objects using
027: * <code>initMouseEvent</code> or <code>initMouseEventNS</code>,
028: * implementations should use the client coordinates <code>clientX</code>
029: * and <code>clientY</code> for calculation of other coordinates (such as
030: * target coordinates exposed by DOM Level 0 implementations).
031: * <p>See also the <a href='http://www.w3.org/TR/2006/WD-DOM-Level-3-Events-20060413'>
032: Document Object Model (DOM) Level 3 Events Specification
033: </a>.
034: * @since DOM Level 2
035: */
036: public interface MouseEvent extends UIEvent {
037: /**
038: * The horizontal coordinate at which the event occurred relative to the
039: * origin of the screen coordinate system.
040: */
041: public int getScreenX();
042:
043: /**
044: * The vertical coordinate at which the event occurred relative to the
045: * origin of the screen coordinate system.
046: */
047: public int getScreenY();
048:
049: /**
050: * The horizontal coordinate at which the event occurred relative to the
051: * DOM implementation's client area.
052: */
053: public int getClientX();
054:
055: /**
056: * The vertical coordinate at which the event occurred relative to the
057: * DOM implementation's client area.
058: */
059: public int getClientY();
060:
061: /**
062: * <code>true</code> if the control (Ctrl) key modifier is activated.
063: */
064: public boolean getCtrlKey();
065:
066: /**
067: * <code>true</code> if the shift (Shift) key modifier is activated.
068: */
069: public boolean getShiftKey();
070:
071: /**
072: * <code>true</code> if the alt (alternative) key modifier is activated.
073: * <p ><b>Note:</b> The Option key modifier on Macintosh systems must be
074: * represented using this key modifier.
075: */
076: public boolean getAltKey();
077:
078: /**
079: * <code>true</code> if the meta (Meta) key modifier is activated.
080: * <p ><b>Note:</b> The Command key modifier on Macintosh system must be
081: * represented using this meta key.
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. <code>0</code> indicates the normal button of the
089: * mouse (in general on the left or the one button on Macintosh mice,
090: * used to activate a button or select text). <code>2</code> indicates
091: * the contextual property (in general on the right, used to display a
092: * context menu) button of the mouse if present. <code>1</code>
093: * indicates the extra (in general in the middle and often combined with
094: * the mouse wheel) button. Some mice may provide or simulate more
095: * buttons, and values higher than <code>2</code> can be used to
096: * represent such buttons.
097: */
098: public short getButton();
099:
100: /**
101: * Used to identify a secondary <code>EventTarget</code> related to a UI
102: * event, depending on the type of event.
103: */
104: public EventTarget getRelatedTarget();
105:
106: /**
107: * The <code>initMouseEvent</code> method is used to initialize the value
108: * of a <code>MouseEvent</code> object and has the same behavior as
109: * <code>UIEvent.initUIEvent()</code>.
110: * @param typeArg Refer to the <code>UIEvent.initUIEvent()</code> method
111: * for a description of this parameter.
112: * @param canBubbleArg Refer to the <code>UIEvent.initUIEvent()</code>
113: * method for a description of this parameter.
114: * @param cancelableArg Refer to the <code>UIEvent.initUIEvent()</code>
115: * method for a description of this parameter.
116: * @param viewArg Refer to the <code>UIEvent.initUIEvent()</code> method
117: * for a description of this parameter.
118: * @param detailArg Refer to the <code>UIEvent.initUIEvent()</code>
119: * method for a description of this parameter.
120: * @param screenXArg Specifies <code>MouseEvent.screenX</code>.
121: * @param screenYArg Specifies <code>MouseEvent.screenY</code>.
122: * @param clientXArg Specifies <code>MouseEvent.clientX</code>.
123: * @param clientYArg Specifies <code>MouseEvent.clientY</code>.
124: * @param ctrlKeyArg Specifies <code>MouseEvent.ctrlKey</code>.
125: * @param altKeyArg Specifies <code>MouseEvent.altKey</code>.
126: * @param shiftKeyArg Specifies <code>MouseEvent.shiftKey</code>.
127: * @param metaKeyArg Specifies <code>MouseEvent.metaKey</code>.
128: * @param buttonArg Specifies <code>MouseEvent.button</code>.
129: * @param relatedTargetArg Specifies
130: * <code>MouseEvent.relatedTarget</code>. This value may be
131: * <code>null</code>.
132: */
133: public void initMouseEvent(String typeArg, boolean canBubbleArg,
134: boolean cancelableArg, AbstractView viewArg, int detailArg,
135: int screenXArg, int screenYArg, int clientXArg,
136: int clientYArg, boolean ctrlKeyArg, boolean altKeyArg,
137: boolean shiftKeyArg, boolean metaKeyArg, short buttonArg,
138: EventTarget relatedTargetArg);
139:
140: /**
141: * This methods queries the state of a modifier using a key identifier.
142: * See also .
143: * @param keyIdentifierArg A modifier key identifier, as defined by the
144: * <code>KeyboardEvent.keyIdentifier</code> attribute. Common modifier
145: * keys are <code>"Alt"</code>, <code>"AltGraph"</code>,
146: * <code>"CapsLock"</code>, <code>"Control"</code>, <code>"Meta"</code>
147: * , <code>"NumLock"</code>, <code>"Scroll"</code>, or
148: * <code>"Shift"</code>.
149: * <p ><b>Note:</b> If an application wishes to distinguish between
150: * right and left modifiers, this information could be deduced using
151: * keyboard events and <code>KeyboardEvent.keyLocation</code>.
152: * @return <code>true</code> if it is modifier key and the modifier is
153: * activated, <code>false</code> otherwise.
154: * @since DOM Level 3
155: */
156: public boolean getModifierState(String keyIdentifierArg);
157:
158: /**
159: * The <code>initMouseEventNS</code> method is used to initialize the
160: * value of a <code>MouseEvent</code> object and has the same behavior
161: * as <code>UIEvent.initUIEventNS()</code>.
162: * @param namespaceURI Refer to the <code>UIEvent.initUIEventNS()</code>
163: * method for a description of this parameter.
164: * @param typeArg Refer to the <code>UIEvent.initUIEventNS()</code>
165: * method for a description of this parameter.
166: * @param canBubbleArg Refer to the <code>UIEvent.initUIEventNS()</code>
167: * method for a description of this parameter.
168: * @param cancelableArg Refer to the <code>UIEvent.initUIEventNS()</code>
169: * method for a description of this parameter.
170: * @param viewArg Refer to the <code>UIEvent.initUIEventNS()</code>
171: * method for a description of this parameter.
172: * @param detailArg Refer to the <code>UIEvent.initUIEventNS()</code>
173: * method for a description of this parameter.
174: * @param screenXArg Refer to the
175: * <code>MouseEvent.initMouseEvent()</code> method for a description
176: * of this parameter.
177: * @param screenYArg Refer to the
178: * <code>MouseEvent.initMouseEvent()</code> method for a description
179: * of this parameter.
180: * @param clientXArg Refer to the
181: * <code>MouseEvent.initMouseEvent()</code> method for a description
182: * of this parameter.
183: * @param clientYArg Refer to the
184: * <code>MouseEvent.initMouseEvent()</code> method for a description
185: * of this parameter.
186: * @param buttonArg Refer to the <code>MouseEvent.initMouseEvent()</code>
187: * method for a description of this parameter.
188: * @param relatedTargetArg Refer to the
189: * <code>MouseEvent.initMouseEvent()</code> method for a description
190: * of this parameter.
191: * @param modifiersList A <a href='http://www.w3.org/TR/2004/REC-xml-20040204/#NT-S'>white space</a> separated list of modifier key identifiers to be activated on this
192: * object. As an example, <code>"Control Alt"</code> will activated
193: * the control and alt modifiers.
194: * @since DOM Level 3
195: */
196: public void initMouseEventNS(String namespaceURI, String typeArg,
197: boolean canBubbleArg, boolean cancelableArg,
198: AbstractView viewArg, int detailArg, int screenXArg,
199: int screenYArg, int clientXArg, int clientYArg,
200: short buttonArg, EventTarget relatedTargetArg,
201: String modifiersList);
202:
203: }
|