1/*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef DO_NO_IMPORTS
27import "oaidl.idl";
28import "ocidl.idl";
29import "DOMCore.idl";
30import "DOMWindow.idl";
31#endif
32
33interface IDOMEvent;
34interface IDOMEventException;
35interface IDOMEventTarget;
36interface IDOMKeyboardEvent;
37interface IDOMMouseEvent;
38interface IDOMMutationEvent;
39interface IDOMNode;
40interface IDOMOverflowEvent;
41interface IDOMUIEvent;
42interface IDOMWheelEvent;
43interface IDOMWindow;
44
45typedef long long DOMTimeStamp;
46
47[
48    object,
49    oleautomation,
50    uuid(7f8a0a96-f864-44fb-87fb-c5f03666e8e6),
51    pointer_default(unique)
52]
53interface IDOMEventListener : IDOMObject
54{
55    //void               handleEvent(Event evt);
56    HRESULT handleEvent([in] IDOMEvent* evt);
57}
58
59[
60    object,
61    oleautomation,
62    uuid(62343a9e-a779-4e91-818a-14fc178cf4c2),
63    pointer_default(unique)
64]
65interface IDOMEvent : IDOMObject
66{
67    // DOM PhaseType
68    const unsigned short DOMEVENT_CAPTURING_PHASE     = 1;
69    const unsigned short DOMEVENT_AT_TARGET           = 2;
70    const unsigned short DOMEVENT_BUBBLING_PHASE      = 3;
71
72    // Reverse-engineered from Netscape
73    const unsigned short DOMEVENT_MOUSEDOWN           = 1;
74    const unsigned short DOMEVENT_MOUSEUP             = 2;
75    const unsigned short DOMEVENT_MOUSEOVER           = 4;
76    const unsigned short DOMEVENT_MOUSEOUT            = 8;
77    const unsigned short DOMEVENT_MOUSEMOVE           = 16;
78    const unsigned short DOMEVENT_MOUSEDRAG           = 32;
79    const unsigned short DOMEVENT_CLICK               = 64;
80    const unsigned short DOMEVENT_DBLCLICK            = 128;
81    const unsigned short DOMEVENT_KEYDOWN             = 256;
82    const unsigned short DOMEVENT_KEYUP               = 512;
83    const unsigned short DOMEVENT_KEYPRESS            = 1024;
84    const unsigned short DOMEVENT_DRAGDROP            = 2048;
85    const unsigned short DOMEVENT_FOCUS               = 4096;
86    const unsigned short DOMEVENT_BLUR                = 8192;
87    const unsigned short DOMEVENT_SELECT              = 16384;
88    const unsigned short DOMEVENT_CHANGE              = 32768;
89
90    //readonly attribute DOMString        type;
91    HRESULT type([out, retval] BSTR* result);
92
93    //readonly attribute EventTarget      target;
94    HRESULT target([out, retval] IDOMEventTarget** result);
95
96    //readonly attribute EventTarget      currentTarget;
97    HRESULT currentTarget([out, retval] IDOMEventTarget** result);
98
99    //readonly attribute unsigned short   eventPhase;
100    HRESULT eventPhase([out, retval] unsigned short* result);
101
102    //readonly attribute boolean          bubbles;
103    HRESULT bubbles([out, retval] BOOL* result);
104
105    //readonly attribute boolean          cancelable;
106    HRESULT cancelable([out, retval] BOOL* result);
107
108    //readonly attribute DOMTimeStamp     timeStamp;
109    HRESULT timeStamp([out, retval] DOMTimeStamp* result);
110
111    //void               stopPropagation();
112    HRESULT stopPropagation();
113
114    //void               preventDefault();
115    HRESULT preventDefault();
116
117    //[OldStyleObjC] void initEvent(DOMString eventTypeArg,
118    //                              boolean canBubbleArg,
119    //                              boolean cancelableArg);
120    HRESULT initEvent([in] BSTR eventTypeArg, [in] BOOL canBubbleArg, [in] BOOL cancelableArg);
121}
122
123[
124    object,
125    oleautomation,
126    uuid(c7cf7d84-d755-40bc-b664-84bc79eff709),
127    pointer_default(unique)
128]
129interface IDOMEventTarget : IUnknown
130{
131    //void               addEventListener(DOMString type,
132    //                                    EventListener listener,
133    //                                    boolean useCapture);
134    HRESULT addEventListener([in] BSTR type, [in] IDOMEventListener* listener, [in] BOOL useCapture);
135
136    //void               removeEventListener(DOMString type,
137    //                                       EventListener listener,
138    //                                       boolean useCapture);
139    HRESULT removeEventListener([in] BSTR type, [in] IDOMEventListener* listener, [in] BOOL useCapture);
140
141    //boolean            dispatchEvent(Event event)
142    HRESULT dispatchEvent([in] IDOMEvent* event, [out, retval] BOOL* result);
143}
144
145[
146    object,
147    oleautomation,
148    uuid(55AAF192-68CD-409f-A551-89710DC7240A),
149    pointer_default(unique)
150]
151interface IDOMDocumentEvent : IUnknown
152{
153    //[RaisesException] Event              createEvent(DOMString eventType);
154    HRESULT createEvent([in] BSTR eventType, [out, retval] IDOMEvent** result);
155}
156
157[
158    object,
159    oleautomation,
160    uuid(76bc4e46-67df-40d3-89b0-a94dcc2ed507),
161    pointer_default(unique)
162]
163interface IDOMKeyboardEvent : IDOMUIEvent
164{
165    // KeyLocationCode
166    const unsigned long       DOMKEYBOARDEVENT_KEY_LOCATION_STANDARD      = 0x00;
167    const unsigned long       DOMKEYBOARDEVENT_KEY_LOCATION_LEFT          = 0x01;
168    const unsigned long       DOMKEYBOARDEVENT_KEY_LOCATION_RIGHT         = 0x02;
169    const unsigned long       DOMKEYBOARDEVENT_KEY_LOCATION_NUMPAD        = 0x03;
170
171    //readonly attribute DOMString        keyIdentifier;
172    HRESULT keyIdentifier([out, retval] BSTR* result);
173
174    //readonly attribute unsigned long    keyLocation;
175    HRESULT keyLocation([out, retval] unsigned long* result);
176
177    //readonly attribute boolean          ctrlKey;
178    HRESULT ctrlKey([out, retval] BOOL* result);
179
180    //readonly attribute boolean          shiftKey;
181    HRESULT shiftKey([out, retval] BOOL* result);
182
183    //readonly attribute boolean          altKey;
184    HRESULT altKey([out, retval] BOOL* result);
185
186    //readonly attribute boolean          metaKey;
187    HRESULT metaKey([out, retval] BOOL* result);
188
189    //readonly attribute boolean          altGraphKey;
190    HRESULT altGraphKey([out, retval] BOOL* result);
191
192    //boolean getModifierState(DOMString keyIdentifierArg);
193    HRESULT getModifierState([in] BSTR keyIdentifierArg, [out, retval] BOOL* result);
194
195    // FIXME: this does not match the version in the DOM spec.
196    //void initKeyboardEvent(AtomicString type,
197    //                       boolean canBubble,
198    //                       boolean cancelable,
199    //                       DOMWindow view,
200    //                       DOMString keyIdentifier,
201    //                       unsigned long keyLocation,
202    //                       boolean ctrlKey,
203    //                       boolean altKey,
204    //                       boolean shiftKey,
205    //                       boolean metaKey,
206    //                       boolean altGraphKey);
207    HRESULT initKeyboardEvent([in] BSTR type, [in] BOOL canBubble, [in] BOOL cancelable, [in] IDOMWindow* view, [in] BSTR keyIdentifier, [in] unsigned long keyLocation, [in] BOOL ctrlKey, [in] BOOL altKey, [in] BOOL shiftKey, [in] BOOL metaKey, [in] BOOL graphKey);
208
209    // WebKit Extensions
210    //readonly attribute long             keyCode;
211    //HRESULT keyCode([out, retval] long* result);
212
213    //readonly attribute long             charCode;
214    //HRESULT charCode([out, retval] long* result);
215
216    //void initKeyboardEvent(AtomicString type,
217    //                       boolean canBubble,
218    //                       boolean cancelable,
219    //                       DOMWindow view,
220    //                       DOMString keyIdentifier,
221    //                       unsigned long keyLocation,
222    //                       boolean ctrlKey,
223    //                       boolean altKey,
224    //                       boolean shiftKey,
225    //                       boolean metaKey);
226}
227
228[
229    object,
230    oleautomation,
231    uuid(bdd97151-5f6a-4ba4-a902-9b008392eb54),
232    pointer_default(unique)
233]
234interface IDOMMouseEvent : IDOMUIEvent
235{
236    //readonly attribute long             screenX;
237    HRESULT screenX([out, retval] long* result);
238
239    //readonly attribute long             screenY;
240    HRESULT screenY([out, retval] long* result);
241
242    //readonly attribute long             clientX;
243    HRESULT clientX([out, retval] long* result);
244
245    //readonly attribute long             clientY;
246    HRESULT clientY([out, retval] long* result);
247
248    //readonly attribute boolean          ctrlKey;
249    HRESULT ctrlKey([out, retval] BOOL* result);
250
251    //readonly attribute boolean          shiftKey;
252    HRESULT shiftKey([out, retval] BOOL* result);
253
254    //readonly attribute boolean          altKey;
255    HRESULT altKey([out, retval] BOOL* result);
256
257    //readonly attribute boolean          metaKey;
258    HRESULT metaKey([out, retval] BOOL* result);
259
260    //readonly attribute unsigned short   button;
261    HRESULT button([out, retval] unsigned short* result);
262
263    //readonly attribute EventTarget      relatedTarget;
264    HRESULT relatedTarget([out, retval] IDOMEventTarget** result);
265
266    //[OldStyleObjC] void initMouseEvent(AtomicString type,
267    //                                   boolean canBubble,
268    //                                   boolean cancelable,
269    //                                   DOMWindow view,
270    //                                   long detail,
271    //                                   long screenX,
272    //                                   long screenY,
273    //                                   long clientX,
274    //                                   long clientY,
275    //                                   boolean ctrlKey,
276    //                                   boolean altKey,
277    //                                   boolean shiftKey,
278    //                                   boolean metaKey,
279    //                                   unsigned short button,
280    //                                   EventTarget relatedTarget);
281    HRESULT initMouseEvent([in] BSTR type, [in] BOOL canBubble, [in] BOOL cancelable, [in] IDOMWindow* view, [in] long detail, [in] long screenX, [in] long screenY, [in] long clientX, [in] long clientY, [in] BOOL ctrlKey, [in] BOOL altKey, [in] BOOL shiftKey, [in] BOOL metaKey, [in] unsigned short button, [in] IDOMEventTarget* relatedTarget);
282
283    // extensions
284    //readonly attribute long             offsetX;
285    HRESULT offsetX([out, retval] long* result);
286
287    //readonly attribute long             offsetY;
288    HRESULT offsetY([out, retval] long* result);
289
290    //readonly attribute long             x;
291    HRESULT x([out, retval] long* result);
292
293    //readonly attribute long             y;
294    HRESULT y([out, retval] long* result);
295
296    //readonly attribute Node             fromElement;
297    HRESULT fromElement([out, retval] IDOMNode** result);
298
299    //readonly attribute Node             toElement;
300    HRESULT toElement([out, retval] IDOMNode** result);
301}
302
303[
304    object,
305    oleautomation,
306    uuid(6345d228-ea67-48ee-93c8-ff6e9c6356e9),
307    pointer_default(unique)
308]
309interface IDOMMutationEvent : IDOMEvent
310{
311    // attrChangeType
312    const unsigned short DOMMUTATIONEVENT_MODIFICATION = 1;
313    const unsigned short DOMMUTATIONEVENT_ADDITION     = 2;
314    const unsigned short DOMMUTATIONEVENT_REMOVAL      = 3;
315
316    //readonly attribute Node           relatedNode;
317    HRESULT relatedNode([out, retval] IDOMNode** result);
318
319    //readonly attribute DOMString      prevValue;
320    HRESULT prevValue([out, retval] BSTR* result);
321
322    //readonly attribute DOMString      newValue;
323    HRESULT newValue([out, retval] BSTR* result);
324
325    //readonly attribute DOMString      attrName;
326    HRESULT attrName([out, retval] BSTR* result);
327
328    //readonly attribute unsigned short attrChange;
329    HRESULT attrChange([out, retval] unsigned short* result);
330
331    //[OldStyleObjC] void initMutationEvent(AtomicString type,
332    //                                      boolean canBubble,
333    //                                      boolean cancelable,
334    //                                      Node relatedNode,
335    //                                      DOMString prevValue,
336    //                                      DOMString newValue,
337    //                                      DOMString attrName,
338    //                                      unsigned short attrChange);
339    HRESULT initMutationEvent([in] BSTR type, [in] BOOL canBubble, [in] BOOL cancelable, [in] IDOMNode* relatedNode, [in] BSTR prevValue, [in] BSTR newValue, [in] BSTR attrName, [in] unsigned short attrChange);
340}
341
342[
343    object,
344    oleautomation,
345    uuid(6048369e-e444-401b-950d-c9daef9384d2),
346    pointer_default(unique)
347]
348interface IDOMOverflowEvent : IDOMEvent
349{
350    const unsigned short DOMOVERFLOWEVENT_HORIZONTAL = 0;
351    const unsigned short DOMOVERFLOWEVENT_VERTICAL   = 1;
352    const unsigned short DOMOVERFLOWEVENT_BOTH       = 2;
353
354    //readonly attribute unsigned short orient;
355    HRESULT orient([out, retval] unsigned short* result);
356
357    //readonly attribute boolean horizontalOverflow;
358    HRESULT horizontalOverflow([out, retval] BOOL* result);
359
360    //readonly attribute boolean verticalOverflow;
361    HRESULT verticalOverflow([out, retval] BOOL* result);
362}
363
364[
365    object,
366    oleautomation,
367    uuid(b928261d-7c9e-4156-af71-6f698bd97788),
368    pointer_default(unique)
369]
370interface IDOMUIEvent : IDOMEvent
371{
372    //readonly attribute DOMWindow            view;
373    HRESULT view([out, retval] IDOMWindow** result);
374
375    //readonly attribute long                 detail;
376    HRESULT detail([out, retval] long* result);
377
378    //[OldStyleObjC] void initUIEvent(AtomicString type,
379    //                                boolean canBubble,
380    //                                boolean cancelable,
381    //                                DOMWindow view,
382    //                                long detail);
383    HRESULT initUIEvent([in] BSTR type, [in] BOOL canBubble, [in] BOOL cancelable, [in] IDOMWindow* view, [in] long detail);
384
385    // extentsions
386    //readonly attribute long                 keyCode;
387    HRESULT keyCode([out, retval] long* result);
388
389    //readonly attribute long                 charCode;
390    HRESULT charCode([out, retval] long* result);
391
392    HRESULT unused1([out, retval] long* result);
393
394    HRESULT unused2([out, retval] long* result);
395
396    //readonly attribute long                 pageX;
397    HRESULT pageX([out, retval] long* result);
398
399    //readonly attribute long                 pageY;
400    HRESULT pageY([out, retval] long* result);
401
402    //readonly attribute long                 which;
403    HRESULT which([out, retval] long* result);
404}
405
406[
407    object,
408    oleautomation,
409    uuid(5404e6d9-a2bb-4c74-8070-ce9d2599bd00),
410    pointer_default(unique)
411]
412interface IDOMWheelEvent : IDOMUIEvent
413{
414    //readonly attribute long    screenX;
415    HRESULT screenX([out, retval] long* result);
416
417    //readonly attribute long    screenY;
418    HRESULT screenY([out, retval] long* result);
419
420    //readonly attribute long    clientX;
421    HRESULT clientX([out, retval] long* result);
422
423    //readonly attribute long    clientY;
424    HRESULT clientY([out, retval] long* result);
425
426    //readonly attribute boolean ctrlKey;
427    HRESULT ctrlKey([out, retval] BOOL* result);
428
429    //readonly attribute boolean shiftKey;
430    HRESULT shiftKey([out, retval] BOOL* result);
431
432    //readonly attribute boolean altKey;
433    HRESULT altKey([out, retval] BOOL* result);
434
435    //readonly attribute boolean metaKey;
436    HRESULT metaKey([out, retval] BOOL* result);
437
438    //readonly attribute long    wheelDelta;
439    HRESULT wheelDelta([out, retval] long* result);
440
441    //readonly attribute long    wheelDeltaX;
442    HRESULT wheelDeltaX([out, retval] long* result);
443
444    //readonly attribute long    wheelDeltaY;
445    HRESULT wheelDeltaY([out, retval] long* result);
446
447    // WebKit Extensions
448    //readonly attribute long    offsetX;
449    HRESULT offsetX([out, retval] long* result);
450
451    //readonly attribute long    offsetY;
452    HRESULT offsetY([out, retval] long* result);
453
454    //readonly attribute long    x;
455    HRESULT x([out, retval] long* result);
456
457    //readonly attribute long    y;
458    HRESULT y([out, retval] long* result);
459
460    //readonly attribute boolean isHorizontal;
461    HRESULT isHorizontal([out, retval] BOOL* result);
462
463    //void initWheelEvent(long wheelDeltaX,
464    //                    long wheelDeltaY,
465    //                    DOMWindow view,
466    //                    long screenX,
467    //                    long screenY,
468    //                    long clientX,
469    //                    long clientY,
470    //                    boolean ctrlKey,
471    //                    boolean altKey,
472    //                    boolean shiftKey,
473    //                    boolean metaKey);
474    HRESULT initWheelEvent([in] long wheelDeltaX, [in] long wheelDeltaY, [in] IDOMWindow* view, [in] long screenX, [in] long screenY, [in] long clientX, [in] long clientY, [in] BOOL ctrlKey, [in] BOOL altKey, [in] BOOL shiftKey, [in] BOOL metaKey);
475}
476