nsIDOMEventTarget.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /*
  2. * DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/events/nsIDOMEventTarget.idl
  3. */
  4. #ifndef __gen_nsIDOMEventTarget_h__
  5. #define __gen_nsIDOMEventTarget_h__
  6. #ifndef __gen_domstubs_h__
  7. #include "domstubs.h"
  8. #endif
  9. /* For IDL files that don't want to include root IDL files. */
  10. #ifndef NS_NO_VTABLE
  11. #define NS_NO_VTABLE
  12. #endif
  13. /* starting interface: nsIDOMEventTarget */
  14. #define NS_IDOMEVENTTARGET_IID_STR "1c773b30-d1cf-11d2-bd95-00805f8ae3f4"
  15. #define NS_IDOMEVENTTARGET_IID \
  16. {0x1c773b30, 0xd1cf, 0x11d2, \
  17. { 0xbd, 0x95, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4 }}
  18. class NS_NO_VTABLE nsIDOMEventTarget : public nsISupports {
  19. public:
  20. NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMEVENTTARGET_IID)
  21. /**
  22. * The nsIDOMEventTarget interface is the interface implemented by all
  23. * event targets in the Document Object Model.
  24. *
  25. * For more information on this interface please see
  26. * http://www.w3.org/TR/DOM-Level-2-Events/
  27. *
  28. * @status FROZEN
  29. */
  30. /**
  31. * This method allows the registration of event listeners on the event target.
  32. * If an EventListener is added to an EventTarget while it is processing an
  33. * event, it will not be triggered by the current actions but may be
  34. * triggered during a later stage of event flow, such as the bubbling phase.
  35. *
  36. * If multiple identical EventListeners are registered on the same
  37. * EventTarget with the same parameters the duplicate instances are
  38. * discarded. They do not cause the EventListener to be called twice
  39. * and since they are discarded they do not need to be removed with the
  40. * removeEventListener method.
  41. *
  42. * @param type The event type for which the user is registering
  43. * @param listener The listener parameter takes an interface
  44. * implemented by the user which contains the methods
  45. * to be called when the event occurs.
  46. * @param useCapture If true, useCapture indicates that the user
  47. * wishes to initiate capture. After initiating
  48. * capture, all events of the specified type will be
  49. * dispatched to the registered EventListener before
  50. * being dispatched to any EventTargets beneath them
  51. * in the tree. Events which are bubbling upward
  52. * through the tree will not trigger an
  53. * EventListener designated to use capture.
  54. */
  55. /* void addEventListener (in DOMString type, in nsIDOMEventListener listener, in boolean useCapture); */
  56. NS_IMETHOD AddEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture) = 0;
  57. /**
  58. * This method allows the removal of event listeners from the event
  59. * target. If an EventListener is removed from an EventTarget while it
  60. * is processing an event, it will not be triggered by the current actions.
  61. * EventListeners can never be invoked after being removed.
  62. * Calling removeEventListener with arguments which do not identify any
  63. * currently registered EventListener on the EventTarget has no effect.
  64. *
  65. * @param type Specifies the event type of the EventListener being
  66. * removed.
  67. * @param listener The EventListener parameter indicates the
  68. * EventListener to be removed.
  69. * @param useCapture Specifies whether the EventListener being
  70. * removed was registered as a capturing listener or
  71. * not. If a listener was registered twice, one with
  72. * capture and one without, each must be removed
  73. * separately. Removal of a capturing listener does
  74. * not affect a non-capturing version of the same
  75. * listener, and vice versa.
  76. */
  77. /* void removeEventListener (in DOMString type, in nsIDOMEventListener listener, in boolean useCapture); */
  78. NS_IMETHOD RemoveEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture) = 0;
  79. /**
  80. * This method allows the dispatch of events into the implementations
  81. * event model. Events dispatched in this manner will have the same
  82. * capturing and bubbling behavior as events dispatched directly by the
  83. * implementation. The target of the event is the EventTarget on which
  84. * dispatchEvent is called.
  85. *
  86. * @param evt Specifies the event type, behavior, and contextual
  87. * information to be used in processing the event.
  88. * @return Indicates whether any of the listeners which handled the
  89. * event called preventDefault. If preventDefault was called
  90. * the value is false, else the value is true.
  91. * @throws UNSPECIFIED_EVENT_TYPE_ERR: Raised if the Event's type was
  92. * not specified by initializing the event before
  93. * dispatchEvent was called. Specification of the Event's
  94. * type as null or an empty string will also trigger this
  95. * exception.
  96. */
  97. /* boolean dispatchEvent (in nsIDOMEvent evt) raises (DOMException); */
  98. NS_IMETHOD DispatchEvent(nsIDOMEvent *evt, PRBool *_retval) = 0;
  99. };
  100. /* Use this macro when declaring classes that implement this interface. */
  101. #define NS_DECL_NSIDOMEVENTTARGET \
  102. NS_IMETHOD AddEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture); \
  103. NS_IMETHOD RemoveEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture); \
  104. NS_IMETHOD DispatchEvent(nsIDOMEvent *evt, PRBool *_retval);
  105. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  106. #define NS_FORWARD_NSIDOMEVENTTARGET(_to) \
  107. NS_IMETHOD AddEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture) { return _to AddEventListener(type, listener, useCapture); } \
  108. NS_IMETHOD RemoveEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture) { return _to RemoveEventListener(type, listener, useCapture); } \
  109. NS_IMETHOD DispatchEvent(nsIDOMEvent *evt, PRBool *_retval) { return _to DispatchEvent(evt, _retval); }
  110. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  111. #define NS_FORWARD_SAFE_NSIDOMEVENTTARGET(_to) \
  112. NS_IMETHOD AddEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture) { return !_to ? NS_ERROR_NULL_POINTER : _to->AddEventListener(type, listener, useCapture); } \
  113. NS_IMETHOD RemoveEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveEventListener(type, listener, useCapture); } \
  114. NS_IMETHOD DispatchEvent(nsIDOMEvent *evt, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->DispatchEvent(evt, _retval); }
  115. #if 0
  116. /* Use the code below as a template for the implementation class for this interface. */
  117. /* Header file */
  118. class nsDOMEventTarget : public nsIDOMEventTarget
  119. {
  120. public:
  121. NS_DECL_ISUPPORTS
  122. NS_DECL_NSIDOMEVENTTARGET
  123. nsDOMEventTarget();
  124. private:
  125. ~nsDOMEventTarget();
  126. protected:
  127. /* additional members */
  128. };
  129. /* Implementation file */
  130. NS_IMPL_ISUPPORTS1(nsDOMEventTarget, nsIDOMEventTarget)
  131. nsDOMEventTarget::nsDOMEventTarget()
  132. {
  133. /* member initializers and constructor code */
  134. }
  135. nsDOMEventTarget::~nsDOMEventTarget()
  136. {
  137. /* destructor code */
  138. }
  139. /* void addEventListener (in DOMString type, in nsIDOMEventListener listener, in boolean useCapture); */
  140. NS_IMETHODIMP nsDOMEventTarget::AddEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture)
  141. {
  142. return NS_ERROR_NOT_IMPLEMENTED;
  143. }
  144. /* void removeEventListener (in DOMString type, in nsIDOMEventListener listener, in boolean useCapture); */
  145. NS_IMETHODIMP nsDOMEventTarget::RemoveEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture)
  146. {
  147. return NS_ERROR_NOT_IMPLEMENTED;
  148. }
  149. /* boolean dispatchEvent (in nsIDOMEvent evt) raises (DOMException); */
  150. NS_IMETHODIMP nsDOMEventTarget::DispatchEvent(nsIDOMEvent *evt, PRBool *_retval)
  151. {
  152. return NS_ERROR_NOT_IMPLEMENTED;
  153. }
  154. /* End of implementation class template. */
  155. #endif
  156. #endif /* __gen_nsIDOMEventTarget_h__ */