23 August 2001

Appendix B: IDL Definitions

This appendix contains the complete OMG IDL [OMGIDL] for the Level 3 Document Object Model Events definitions.

The IDL files are also available as: http://www.w3.org/TR/2001/WD-DOM-Level-3-Events-20010823/idl.zip

events.idl:

// File: events.idl

#ifndef _EVENTS_IDL_
#define _EVENTS_IDL_

#include "dom.idl"
#include "views.idl"

#pragma prefix "dom.w3c.org"
module events
{

  typedef dom::DOMString DOMString;
  typedef dom::DOMTimeStamp DOMTimeStamp;
  typedef dom::Node Node;

  interface EventListenerList;
  interface EventListener;
  interface Event;

  // Introduced in DOM Level 2:
  exception EventException {
    unsigned short   code;
  };
  // EventExceptionCode
  const unsigned short      UNSPECIFIED_EVENT_TYPE_ERR     = 0;


  // Introduced in DOM Level 2:
  interface EventTarget {
    void               addEventListener(in DOMString type, 
                                        in EventListener listener, 
                                        in boolean useCapture);
    void               removeEventListener(in DOMString type, 
                                           in EventListener listener, 
                                           in boolean useCapture);
    boolean            dispatchEvent(in Event evt)
                                        raises(EventException);
    // Introduced in DOM Level 3:
    readonly attribute EventListenerList  eventListeners;
  };

  // Introduced in DOM Level 2:
  interface EventListener {
    void               handleEvent(in Event evt);
  };

  // Introduced in DOM Level 3:
  interface EventListenerList {
    EventListener      item(in unsigned long index);
    readonly attribute unsigned long    length;
  };

  // Introduced in DOM Level 3:
  interface EventGroup {
    boolean            isSameEventGroup(in EventGroup other);
  };

  // Introduced in DOM Level 3:
  interface EventTargetGroup {
    void               addEventListener(in DOMString type, 
                                        in EventListener listener, 
                                        in boolean useCapture, 
                                        in EventGroup evtGroup);
    void               removeEventListener(in DOMString type, 
                                           in EventListener listener, 
                                           in boolean useCapture, 
                                           in EventGroup evtGroup);
  };

  // Introduced in DOM Level 3:
  interface DocumentEventGroup {
    EventGroup         createEventGroup();
  };

  // Introduced in DOM Level 2:
  interface Event {

    // PhaseType
    const unsigned short      CAPTURING_PHASE                = 1;
    const unsigned short      AT_TARGET                      = 2;
    const unsigned short      BUBBLING_PHASE                 = 3;

    readonly attribute DOMString        type;
    readonly attribute EventTarget      target;
    readonly attribute EventTarget      currentTarget;
    readonly attribute unsigned short   eventPhase;
    readonly attribute boolean          bubbles;
    readonly attribute boolean          cancelable;
    readonly attribute DOMTimeStamp     timeStamp;
    void               stopPropagation();
    void               preventDefault();
    void               initEvent(in DOMString eventTypeArg, 
                                 in boolean canBubbleArg, 
                                 in boolean cancelableArg);
  };

  // Introduced in DOM Level 2:
  interface DocumentEvent {
    Event              createEvent(in DOMString eventType)
                                        raises(dom::DOMException);
  };

  // Introduced in DOM Level 2:
  interface UIEvent : Event {
    readonly attribute views::AbstractView  view;
    readonly attribute long             detail;
    void               initUIEvent(in DOMString typeArg, 
                                   in boolean canBubbleArg, 
                                   in boolean cancelableArg, 
                                   in views::AbstractView viewArg, 
                                   in long detailArg);
  };

  // Introduced in DOM Level 2:
  interface MouseEvent : UIEvent {
    readonly attribute long             screenX;
    readonly attribute long             screenY;
    readonly attribute long             clientX;
    readonly attribute long             clientY;
    readonly attribute boolean          ctrlKey;
    readonly attribute boolean          shiftKey;
    readonly attribute boolean          altKey;
    readonly attribute boolean          metaKey;
    readonly attribute unsigned short   button;
    readonly attribute EventTarget      relatedTarget;
    void               initMouseEvent(in DOMString typeArg, 
                                      in boolean canBubbleArg, 
                                      in boolean cancelableArg, 
                                      in views::AbstractView viewArg, 
                                      in long detailArg, 
                                      in long screenXArg, 
                                      in long screenYArg, 
                                      in long clientXArg, 
                                      in long clientYArg, 
                                      in boolean ctrlKeyArg, 
                                      in boolean altKeyArg, 
                                      in boolean shiftKeyArg, 
                                      in boolean metaKeyArg, 
                                      in unsigned short buttonArg, 
                                      in EventTarget relatedTargetArg);
  };

  // Introduced in DOM Level 3:
  interface TextEvent : UIEvent {

    // VirtualKeyCode
    const unsigned long       DOM_VK_UNDEFINED               = 0x0;
    const unsigned long       DOM_VK_RIGHT_ALT               = 0x01;
    const unsigned long       DOM_VK_LEFT_ALT                = 0x02;
    const unsigned long       DOM_VK_LEFT_CONTROL            = 0x03;
    const unsigned long       DOM_VK_RIGHT_CONTROL           = 0x04;
    const unsigned long       DOM_VK_LEFT_SHIFT              = 0x05;
    const unsigned long       DOM_VK_RIGHT_SHIFT             = 0x06;
    const unsigned long       DOM_VK_LEFT_META               = 0x07;
    const unsigned long       DOM_VK_RIGHT_META              = 0x08;
    const unsigned long       DOM_VK_CAPS_LOCK               = 0x09;
    const unsigned long       DOM_VK_DELETE                  = 0x0A;
    const unsigned long       DOM_VK_END                     = 0x0B;
    const unsigned long       DOM_VK_ENTER                   = 0x0C;
    const unsigned long       DOM_VK_ESCAPE                  = 0x0D;
    const unsigned long       DOM_VK_HOME                    = 0x0E;
    const unsigned long       DOM_VK_INSERT                  = 0x0F;
    const unsigned long       DOM_VK_NUM_LOCK                = 0x10;
    const unsigned long       DOM_VK_PAUSE                   = 0x11;
    const unsigned long       DOM_VK_PRINTSCREEN             = 0x12;
    const unsigned long       DOM_VK_SCROLL_LOCK             = 0x13;
    const unsigned long       DOM_VK_LEFT                    = 0x14;
    const unsigned long       DOM_VK_RIGHT                   = 0x15;
    const unsigned long       DOM_VK_UP                      = 0x16;
    const unsigned long       DOM_VK_DOWN                    = 0x17;
    const unsigned long       DOM_VK_PAGE_DOWN               = 0x18;
    const unsigned long       DOM_VK_PAGE_UP                 = 0x19;
    const unsigned long       DOM_VK_F1                      = 0x1A;
    const unsigned long       DOM_VK_F2                      = 0x1B;
    const unsigned long       DOM_VK_F3                      = 0x1C;
    const unsigned long       DOM_VK_F4                      = 0x1D;
    const unsigned long       DOM_VK_F5                      = 0x1E;
    const unsigned long       DOM_VK_F6                      = 0x1F;
    const unsigned long       DOM_VK_F7                      = 0x20;
    const unsigned long       DOM_VK_F8                      = 0x21;
    const unsigned long       DOM_VK_F9                      = 0x22;
    const unsigned long       DOM_VK_F10                     = 0x23;
    const unsigned long       DOM_VK_F11                     = 0x24;
    const unsigned long       DOM_VK_F12                     = 0x25;
    const unsigned long       DOM_VK_F13                     = 0x26;
    const unsigned long       DOM_VK_F14                     = 0x27;
    const unsigned long       DOM_VK_F15                     = 0x28;
    const unsigned long       DOM_VK_F16                     = 0x29;
    const unsigned long       DOM_VK_F17                     = 0x2A;
    const unsigned long       DOM_VK_F18                     = 0x2B;
    const unsigned long       DOM_VK_F19                     = 0x2C;
    const unsigned long       DOM_VK_F20                     = 0x2D;
    const unsigned long       DOM_VK_F21                     = 0x2E;
    const unsigned long       DOM_VK_F22                     = 0x2F;
    const unsigned long       DOM_VK_F23                     = 0x30;
    const unsigned long       DOM_VK_F24                     = 0x31;

             attribute DOMString        outputString;
             attribute unsigned long    keyVal;
             attribute unsigned long    virtKeyVal;
             attribute boolean          visibleOutputGenerated;
             attribute boolean          numPad;
    boolean            checkModifier(in unsigned long modifer);
    void               initTextEvent(in DOMString typeArg, 
                                     in boolean canBubbleArg, 
                                     in boolean cancelableArg, 
                                     in views::AbstractView viewArg, 
                                     in unsigned short detailArg, 
                                     in DOMString outputStringArg, 
                                     in unsigned long keyValArg, 
                                     in unsigned long virtKeyValArg, 
                                     in boolean visibleOutputGeneratedArg, 
                                     in boolean numPadArg);
    void               initModifier(in unsigned long modifier, 
                                    in boolean value);
  };

  // Introduced in DOM Level 2:
  interface MutationEvent : Event {

    // attrChangeType
    const unsigned short      MODIFICATION                   = 1;
    const unsigned short      ADDITION                       = 2;
    const unsigned short      REMOVAL                        = 3;

    readonly attribute Node             relatedNode;
    readonly attribute DOMString        prevValue;
    readonly attribute DOMString        newValue;
    readonly attribute DOMString        attrName;
    readonly attribute unsigned short   attrChange;
    void               initMutationEvent(in DOMString typeArg, 
                                         in boolean canBubbleArg, 
                                         in boolean cancelableArg, 
                                         in Node relatedNodeArg, 
                                         in DOMString prevValueArg, 
                                         in DOMString newValueArg, 
                                         in DOMString attrNameArg, 
                                         in unsigned short attrChangeArg);
  };
};

#endif // _EVENTS_IDL_