michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "domstubs.idl" michael@0: michael@0: interface nsIDOMEventTarget; michael@0: michael@0: [ptr] native WidgetEventPtr(mozilla::WidgetEvent); michael@0: [ptr] native DOMEventPtr(mozilla::dom::Event); michael@0: [ptr] native IPCMessagePtr(IPC::Message); michael@0: [ptr] native ConstIPCMessagePtr(const IPC::Message); michael@0: [ptr] native EventTargetPtr(mozilla::dom::EventTarget); michael@0: %{C++ michael@0: #ifdef ERROR michael@0: #undef ERROR michael@0: #endif michael@0: michael@0: #include "mozilla/EventForwards.h" michael@0: class nsPresContext; michael@0: class nsInvalidateRequestList; michael@0: namespace IPC { michael@0: class Message; michael@0: } michael@0: namespace mozilla { michael@0: namespace dom { michael@0: class Event; michael@0: class EventTarget; michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: %} michael@0: michael@0: /** michael@0: * The nsIDOMEvent interface is the primary datatype for all events in michael@0: * the Document Object Model. michael@0: * michael@0: * For more information on this interface please see michael@0: * http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html and michael@0: * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html michael@0: */ michael@0: michael@0: [scriptable, builtinclass, uuid(02d54f52-a1f5-4ad2-b560-36f14012935e)] michael@0: interface nsIDOMEvent : nsISupports michael@0: { michael@0: // PhaseType michael@0: /** michael@0: * The event isn't being dispatched. michael@0: */ michael@0: const unsigned short NONE = 0; michael@0: /** michael@0: * The current event phase is the capturing phase. michael@0: */ michael@0: const unsigned short CAPTURING_PHASE = 1; michael@0: michael@0: /** michael@0: * The event is currently being evaluated at the target EventTarget. michael@0: */ michael@0: const unsigned short AT_TARGET = 2; michael@0: michael@0: /** michael@0: * The current event phase is the bubbling phase. michael@0: */ michael@0: const unsigned short BUBBLING_PHASE = 3; michael@0: michael@0: /** michael@0: * The name of the event (case-insensitive). The name must be an XML michael@0: * name. michael@0: */ michael@0: readonly attribute DOMString type; michael@0: michael@0: /** michael@0: * Used to indicate the EventTarget to which the event was originally michael@0: * dispatched. michael@0: */ michael@0: readonly attribute nsIDOMEventTarget target; michael@0: michael@0: /** michael@0: * Used to indicate the EventTarget whose EventListeners are currently michael@0: * being processed. This is particularly useful during capturing and michael@0: * bubbling. michael@0: */ michael@0: readonly attribute nsIDOMEventTarget currentTarget; michael@0: michael@0: /** michael@0: * Used to indicate which phase of event flow is currently being michael@0: * evaluated. michael@0: */ michael@0: readonly attribute unsigned short eventPhase; michael@0: michael@0: /** michael@0: * Used to indicate whether or not an event is a bubbling event. If the michael@0: * event can bubble the value is true, else the value is false. michael@0: */ michael@0: readonly attribute boolean bubbles; michael@0: michael@0: /** michael@0: * Used to indicate whether or not an event can have its default action michael@0: * prevented. If the default action can be prevented the value is true, michael@0: * else the value is false. michael@0: */ michael@0: readonly attribute boolean cancelable; michael@0: michael@0: /** michael@0: * Used to specify the time (in milliseconds relative to the epoch) at michael@0: * which the event was created. Due to the fact that some systems may michael@0: * not provide this information the value of timeStamp may be not michael@0: * available for all events. When not available, a value of 0 will be michael@0: * returned. Examples of epoch time are the time of the system start or michael@0: * 0:0:0 UTC 1st January 1970. michael@0: */ michael@0: readonly attribute DOMTimeStamp timeStamp; michael@0: michael@0: /** michael@0: * The stopPropagation method is used prevent further propagation of an michael@0: * event during event flow. If this method is called by any michael@0: * EventListener the event will cease propagating through the tree. The michael@0: * event will complete dispatch to all listeners on the current michael@0: * EventTarget before event flow stops. This method may be used during michael@0: * any stage of event flow. michael@0: */ michael@0: void stopPropagation(); michael@0: michael@0: /** michael@0: * If an event is cancelable, the preventDefault method is used to michael@0: * signify that the event is to be canceled, meaning any default action michael@0: * normally taken by the implementation as a result of the event will michael@0: * not occur. If, during any stage of event flow, the preventDefault michael@0: * method is called the event is canceled. Any default action associated michael@0: * with the event will not occur. Calling this method for a michael@0: * non-cancelable event has no effect. Once preventDefault has been michael@0: * called it will remain in effect throughout the remainder of the michael@0: * event's propagation. This method may be used during any stage of michael@0: * event flow. michael@0: */ michael@0: void preventDefault(); michael@0: michael@0: /** michael@0: * The initEvent method is used to initialize the value of an Event michael@0: * created through the DocumentEvent interface. This method may only be michael@0: * called before the Event has been dispatched via the dispatchEvent michael@0: * method, though it may be called multiple times during that phase if michael@0: * necessary. If called multiple times the final invocation takes michael@0: * precedence. If called from a subclass of Event interface only the michael@0: * values specified in the initEvent method are modified, all other michael@0: * attributes are left unchanged. michael@0: * michael@0: * @param eventTypeArg Specifies the event type. This type may be michael@0: * any event type currently defined in this michael@0: * specification or a new event type.. The string michael@0: * must be an XML name. michael@0: * Any new event type must not begin with any michael@0: * upper, lower, or mixed case version of the michael@0: * string "DOM". This prefix is reserved for michael@0: * future DOM event sets. It is also strongly michael@0: * recommended that third parties adding their michael@0: * own events use their own prefix to avoid michael@0: * confusion and lessen the probability of michael@0: * conflicts with other new events. michael@0: * @param canBubbleArg Specifies whether or not the event can bubble. michael@0: * @param cancelableArg Specifies whether or not the event's default michael@0: * action can be prevented. michael@0: */ michael@0: void initEvent(in DOMString eventTypeArg, michael@0: in boolean canBubbleArg, michael@0: in boolean cancelableArg); michael@0: michael@0: /** michael@0: * Used to indicate whether preventDefault() has been called for this event. michael@0: */ michael@0: readonly attribute boolean defaultPrevented; michael@0: michael@0: /** michael@0: * Prevents other event listeners from being triggered and, michael@0: * unlike Event.stopPropagation() its effect is immediate. michael@0: */ michael@0: void stopImmediatePropagation(); michael@0: michael@0: const long ALT_MASK = 0x00000001; michael@0: const long CONTROL_MASK = 0x00000002; michael@0: const long SHIFT_MASK = 0x00000004; michael@0: const long META_MASK = 0x00000008; michael@0: michael@0: /** The original target of the event, before any retargetings. */ michael@0: readonly attribute nsIDOMEventTarget originalTarget; michael@0: /** michael@0: * The explicit original target of the event. If the event was retargeted michael@0: * for some reason other than an anonymous boundary crossing, this will be set michael@0: * to the target before the retargeting occurs. For example, mouse events michael@0: * are retargeted to their parent node when they happen over text nodes (bug michael@0: * 185889), and in that case .target will show the parent and michael@0: * .explicitOriginalTarget will show the text node. michael@0: * .explicitOriginalTarget differs from .originalTarget in that it will never michael@0: * contain anonymous content. michael@0: */ michael@0: readonly attribute nsIDOMEventTarget explicitOriginalTarget; michael@0: michael@0: /** michael@0: * @deprecated Use nsIDOMEvent::defaultPrevented. michael@0: * To be removed in bug 691151. michael@0: */ michael@0: boolean getPreventDefault(); michael@0: michael@0: readonly attribute boolean isTrusted; michael@0: michael@0: [noscript] void duplicatePrivateData(); michael@0: [noscript] void setTarget(in nsIDOMEventTarget aTarget); michael@0: [notxpcom] boolean IsDispatchStopped(); michael@0: [notxpcom] WidgetEventPtr GetInternalNSEvent(); michael@0: [noscript,notxpcom] void SetTrusted(in boolean aTrusted); michael@0: [notxpcom] void Serialize(in IPCMessagePtr aMsg, michael@0: in boolean aSerializeInterfaceType); michael@0: [notxpcom] boolean Deserialize(in ConstIPCMessagePtr aMsg, out voidPtr aIter); michael@0: [noscript,notxpcom] void SetOwner(in EventTargetPtr aOwner); michael@0: [notxpcom] DOMEventPtr InternalDOMEvent(); michael@0: }; michael@0: michael@0: %{C++ michael@0: michael@0: nsresult michael@0: NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMDataContainerEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetGUIEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetMouseEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMFocusEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::InternalFocusEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMMouseScrollEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetMouseScrollEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMWheelEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetWheelEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetDragEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMClipboardEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::InternalClipboardEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMInputEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::InternalEditorInputEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMKeyboardEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetKeyboardEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMCompositionEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetCompositionEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMMutationEvent(nsIDOMEvent** aResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::InternalMutationEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMDeviceMotionEvent(nsIDOMEvent** aResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMTextEvent(nsIDOMEvent** aResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetTextEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMBeforeUnloadEvent(nsIDOMEvent** aResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMSVGEvent(nsIDOMEvent** aResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMSVGZoomEvent(nsIDOMEvent** aResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetGUIEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMTimeEvent(nsIDOMEvent** aResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMXULCommandEvent(nsIDOMEvent** aResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetInputEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMCommandEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetCommandEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMMessageEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMProgressEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetEvent* aEvent); michael@0: // This empties aInvalidateRequests. michael@0: nsresult michael@0: NS_NewDOMNotifyPaintEvent(nsIDOMEvent** aResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetEvent* aEvent, michael@0: uint32_t aEventType = 0, michael@0: nsInvalidateRequestList* aInvalidateRequests = nullptr); michael@0: nsresult michael@0: NS_NewDOMSimpleGestureEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetSimpleGestureEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMScrollAreaEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::InternalScrollAreaEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMTransitionEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::InternalTransitionEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMAnimationEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::InternalAnimationEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMPointerEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetPointerEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetTouchEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMMozSettingsEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetEvent* aEvent); michael@0: nsresult michael@0: NS_NewDOMMozApplicationEvent(nsIDOMEvent** aInstancePtrResult, michael@0: mozilla::dom::EventTarget* aOwner, michael@0: nsPresContext* aPresContext, michael@0: mozilla::WidgetEvent* aEvent); michael@0: %}