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(in 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(in DOMString eventTypeArg,
118    //                              in boolean canBubbleArg,
119    //                              in 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(in DOMString type,
132    //                                    in EventListener listener,
133    //                                    in boolean useCapture);
134    HRESULT addEventListener([in] BSTR type, [in] IDOMEventListener* listener, [in] BOOL useCapture);
135
136    //void               removeEventListener(in DOMString type,
137    //                                       in EventListener listener,
138    //                                       in boolean useCapture);
139    HRESULT removeEventListener([in] BSTR type, [in] IDOMEventListener* listener, [in] BOOL useCapture);
140
141    //boolean            dispatchEvent(in 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    //Event              createEvent(in DOMString eventType)
154    //    raises(DOMException);
155    HRESULT createEvent([in] BSTR eventType, [out, retval] IDOMEvent** result);
156}
157
158[
159    object,
160    oleautomation,
161    uuid(76bc4e46-67df-40d3-89b0-a94dcc2ed507),
162    pointer_default(unique)
163]
164interface IDOMKeyboardEvent : IDOMUIEvent
165{
166    // KeyLocationCode
167    const unsigned long       DOMKEYBOARDEVENT_KEY_LOCATION_STANDARD      = 0x00;
168    const unsigned long       DOMKEYBOARDEVENT_KEY_LOCATION_LEFT          = 0x01;
169    const unsigned long       DOMKEYBOARDEVENT_KEY_LOCATION_RIGHT         = 0x02;
170    const unsigned long       DOMKEYBOARDEVENT_KEY_LOCATION_NUMPAD        = 0x03;
171
172    //readonly attribute DOMString        keyIdentifier;
173    HRESULT keyIdentifier([out, retval] BSTR* result);
174
175    //readonly attribute unsigned long    keyLocation;
176    HRESULT keyLocation([out, retval] unsigned long* result);
177
178    //readonly attribute boolean          ctrlKey;
179    HRESULT ctrlKey([out, retval] BOOL* result);
180
181    //readonly attribute boolean          shiftKey;
182    HRESULT shiftKey([out, retval] BOOL* result);
183
184    //readonly attribute boolean          altKey;
185    HRESULT altKey([out, retval] BOOL* result);
186
187    //readonly attribute boolean          metaKey;
188    HRESULT metaKey([out, retval] BOOL* result);
189
190    //readonly attribute boolean          altGraphKey;
191    HRESULT altGraphKey([out, retval] BOOL* result);
192
193    //boolean getModifierState(in DOMString keyIdentifierArg);
194    HRESULT getModifierState([in] BSTR keyIdentifierArg, [out, retval] BOOL* result);
195
196    // FIXME: this does not match the version in the DOM spec.
197    //void initKeyboardEvent(in AtomicString type,
198    //                       in boolean canBubble,
199    //                       in boolean cancelable,
200    //                       in DOMWindow view,
201    //                       in DOMString keyIdentifier,
202    //                       in unsigned long keyLocation,
203    //                       in boolean ctrlKey,
204    //                       in boolean altKey,
205    //                       in boolean shiftKey,
206    //                       in boolean metaKey,
207    //                       in boolean altGraphKey);
208    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);
209
210    // WebKit Extensions
211    //readonly attribute long             keyCode;
212    //HRESULT keyCode([out, retval] long* result);
213
214    //readonly attribute long             charCode;
215    //HRESULT charCode([out, retval] long* result);
216
217    //void initKeyboardEvent(in AtomicString type,
218    //                       in boolean canBubble,
219    //                       in boolean cancelable,
220    //                       in DOMWindow view,
221    //                       in DOMString keyIdentifier,
222    //                       in unsigned long keyLocation,
223    //                       in boolean ctrlKey,
224    //                       in boolean altKey,
225    //                       in boolean shiftKey,
226    //                       in boolean metaKey);
227}
228
229[
230    object,
231    oleautomation,
232    uuid(bdd97151-5f6a-4ba4-a902-9b008392eb54),
233    pointer_default(unique)
234]
235interface IDOMMouseEvent : IDOMUIEvent
236{
237    //readonly attribute long             screenX;
238    HRESULT screenX([out, retval] long* result);
239
240    //readonly attribute long             screenY;
241    HRESULT screenY([out, retval] long* result);
242
243    //readonly attribute long             clientX;
244    HRESULT clientX([out, retval] long* result);
245
246    //readonly attribute long             clientY;
247    HRESULT clientY([out, retval] long* result);
248
249    //readonly attribute boolean          ctrlKey;
250    HRESULT ctrlKey([out, retval] BOOL* result);
251
252    //readonly attribute boolean          shiftKey;
253    HRESULT shiftKey([out, retval] BOOL* result);
254
255    //readonly attribute boolean          altKey;
256    HRESULT altKey([out, retval] BOOL* result);
257
258    //readonly attribute boolean          metaKey;
259    HRESULT metaKey([out, retval] BOOL* result);
260
261    //readonly attribute unsigned short   button;
262    HRESULT button([out, retval] unsigned short* result);
263
264    //readonly attribute EventTarget      relatedTarget;
265    HRESULT relatedTarget([out, retval] IDOMEventTarget** result);
266
267    //[OldStyleObjC] void initMouseEvent(in AtomicString type,
268    //                                   in boolean canBubble,
269    //                                   in boolean cancelable,
270    //                                   in DOMWindow view,
271    //                                   in long detail,
272    //                                   in long screenX,
273    //                                   in long screenY,
274    //                                   in long clientX,
275    //                                   in long clientY,
276    //                                   in boolean ctrlKey,
277    //                                   in boolean altKey,
278    //                                   in boolean shiftKey,
279    //                                   in boolean metaKey,
280    //                                   in unsigned short button,
281    //                                   in EventTarget relatedTarget);
282    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);
283
284    // extensions
285    //readonly attribute long             offsetX;
286    HRESULT offsetX([out, retval] long* result);
287
288    //readonly attribute long             offsetY;
289    HRESULT offsetY([out, retval] long* result);
290
291    //readonly attribute long             x;
292    HRESULT x([out, retval] long* result);
293
294    //readonly attribute long             y;
295    HRESULT y([out, retval] long* result);
296
297    //readonly attribute Node             fromElement;
298    HRESULT fromElement([out, retval] IDOMNode** result);
299
300    //readonly attribute Node             toElement;
301    HRESULT toElement([out, retval] IDOMNode** result);
302}
303
304[
305    object,
306    oleautomation,
307    uuid(6345d228-ea67-48ee-93c8-ff6e9c6356e9),
308    pointer_default(unique)
309]
310interface IDOMMutationEvent : IDOMEvent
311{
312    // attrChangeType
313    const unsigned short DOMMUTATIONEVENT_MODIFICATION = 1;
314    const unsigned short DOMMUTATIONEVENT_ADDITION     = 2;
315    const unsigned short DOMMUTATIONEVENT_REMOVAL      = 3;
316
317    //readonly attribute Node           relatedNode;
318    HRESULT relatedNode([out, retval] IDOMNode** result);
319
320    //readonly attribute DOMString      prevValue;
321    HRESULT prevValue([out, retval] BSTR* result);
322
323    //readonly attribute DOMString      newValue;
324    HRESULT newValue([out, retval] BSTR* result);
325
326    //readonly attribute DOMString      attrName;
327    HRESULT attrName([out, retval] BSTR* result);
328
329    //readonly attribute unsigned short attrChange;
330    HRESULT attrChange([out, retval] unsigned short* result);
331
332    //[OldStyleObjC] void initMutationEvent(in AtomicString type,
333    //                                      in boolean canBubble,
334    //                                      in boolean cancelable,
335    //                                      in Node relatedNode,
336    //                                      in DOMString prevValue,
337    //                                      in DOMString newValue,
338    //                                      in DOMString attrName,
339    //                                      in unsigned short attrChange);
340    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);
341}
342
343[
344    object,
345    oleautomation,
346    uuid(6048369e-e444-401b-950d-c9daef9384d2),
347    pointer_default(unique)
348]
349interface IDOMOverflowEvent : IDOMEvent
350{
351    const unsigned short DOMOVERFLOWEVENT_HORIZONTAL = 0;
352    const unsigned short DOMOVERFLOWEVENT_VERTICAL   = 1;
353    const unsigned short DOMOVERFLOWEVENT_BOTH       = 2;
354
355    //readonly attribute unsigned short orient;
356    HRESULT orient([out, retval] unsigned short* result);
357
358    //readonly attribute boolean horizontalOverflow;
359    HRESULT horizontalOverflow([out, retval] BOOL* result);
360
361    //readonly attribute boolean verticalOverflow;
362    HRESULT verticalOverflow([out, retval] BOOL* result);
363}
364
365[
366    object,
367    oleautomation,
368    uuid(b928261d-7c9e-4156-af71-6f698bd97788),
369    pointer_default(unique)
370]
371interface IDOMUIEvent : IDOMEvent
372{
373    //readonly attribute DOMWindow            view;
374    HRESULT view([out, retval] IDOMWindow** result);
375
376    //readonly attribute long                 detail;
377    HRESULT detail([out, retval] long* result);
378
379    //[OldStyleObjC] void initUIEvent(in AtomicString type,
380    //                                in boolean canBubble,
381    //                                in boolean cancelable,
382    //                                in DOMWindow view,
383    //                                in long detail);
384    HRESULT initUIEvent([in] BSTR type, [in] BOOL canBubble, [in] BOOL cancelable, [in] IDOMWindow* view, [in] long detail);
385
386    // extentsions
387    //readonly attribute long                 keyCode;
388    HRESULT keyCode([out, retval] long* result);
389
390    //readonly attribute long                 charCode;
391    HRESULT charCode([out, retval] long* result);
392
393    //readonly attribute long                 layerX;
394    HRESULT layerX([out, retval] long* result);
395
396    //readonly attribute long                 layerY;
397    HRESULT layerY([out, retval] long* result);
398
399    //readonly attribute long                 pageX;
400    HRESULT pageX([out, retval] long* result);
401
402    //readonly attribute long                 pageY;
403    HRESULT pageY([out, retval] long* result);
404
405    //readonly attribute long                 which;
406    HRESULT which([out, retval] long* result);
407}
408
409[
410    object,
411    oleautomation,
412    uuid(5404e6d9-a2bb-4c74-8070-ce9d2599bd00),
413    pointer_default(unique)
414]
415interface IDOMWheelEvent : IDOMUIEvent
416{
417    //readonly attribute long    screenX;
418    HRESULT screenX([out, retval] long* result);
419
420    //readonly attribute long    screenY;
421    HRESULT screenY([out, retval] long* result);
422
423    //readonly attribute long    clientX;
424    HRESULT clientX([out, retval] long* result);
425
426    //readonly attribute long    clientY;
427    HRESULT clientY([out, retval] long* result);
428
429    //readonly attribute boolean ctrlKey;
430    HRESULT ctrlKey([out, retval] BOOL* result);
431
432    //readonly attribute boolean shiftKey;
433    HRESULT shiftKey([out, retval] BOOL* result);
434
435    //readonly attribute boolean altKey;
436    HRESULT altKey([out, retval] BOOL* result);
437
438    //readonly attribute boolean metaKey;
439    HRESULT metaKey([out, retval] BOOL* result);
440
441    //readonly attribute long    wheelDelta;
442    HRESULT wheelDelta([out, retval] long* result);
443
444    //readonly attribute long    wheelDeltaX;
445    HRESULT wheelDeltaX([out, retval] long* result);
446
447    //readonly attribute long    wheelDeltaY;
448    HRESULT wheelDeltaY([out, retval] long* result);
449
450    // WebKit Extensions
451    //readonly attribute long    offsetX;
452    HRESULT offsetX([out, retval] long* result);
453
454    //readonly attribute long    offsetY;
455    HRESULT offsetY([out, retval] long* result);
456
457    //readonly attribute long    x;
458    HRESULT x([out, retval] long* result);
459
460    //readonly attribute long    y;
461    HRESULT y([out, retval] long* result);
462
463    //readonly attribute boolean isHorizontal;
464    HRESULT isHorizontal([out, retval] BOOL* result);
465
466    //void initWheelEvent(in long wheelDeltaX,
467    //                    in long wheelDeltaY,
468    //                    in DOMWindow view,
469    //                    in long screenX,
470    //                    in long screenY,
471    //                    in long clientX,
472    //                    in long clientY,
473    //                    in boolean ctrlKey,
474    //                    in boolean altKey,
475    //                    in boolean shiftKey,
476    //                    in boolean metaKey);
477    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);
478}
479