with GNATCOM.Errors;

package body MSHTML.IEventTarget2_Interface is

   procedure Initialize (This : in out IEventTarget2_Type) is
   begin
      Set_IID (This, IID_IEventTarget2);
   end Initialize;

   function Pointer (This : IEventTarget2_Type)
     return Pointer_To_IEventTarget2
   is
   begin
      return To_Pointer_To_IEventTarget2 (Address (This));
   end Pointer;

   procedure Attach (This    : in out IEventTarget2_Type;
                     Pointer : in     Pointer_To_IEventTarget2)
   is
   begin
      Attach (This, GNATCOM.IInterface.To_Pointer_To_IUnknown
              (Pointer.all'Address));
   end Attach;

   function GetRegisteredEventTypes
     (This             : IEventTarget2_Type)
     return Pointer_To_tagSAFEARRAY
   is
       RetVal : aliased Pointer_To_tagSAFEARRAY;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.GetRegisteredEventTypes
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end GetRegisteredEventTypes;

   function GetListenersForType
     (This                : IEventTarget2_Type;
      pszEventType        : GNATCOM.Types.LPWSTR)
     return Pointer_To_tagSAFEARRAY
   is
       RetVal : aliased Pointer_To_tagSAFEARRAY;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.GetListenersForType
         (Pointer (This),
          pszEventType,
          RetVal'Unchecked_Access));

      return RetVal;
   end GetListenersForType;

   procedure RegisterForDOMEventListeners
     (This      : IEventTarget2_Type;
      pCallback : Pointer_To_IDOMEventRegistrationCallback)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.RegisterForDOMEventListeners
         (Pointer (This),
          pCallback));

   end RegisterForDOMEventListeners;

   procedure UnregisterForDOMEventListeners
     (This      : IEventTarget2_Type;
      pCallback : Pointer_To_IDOMEventRegistrationCallback)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.UnregisterForDOMEventListeners
         (Pointer (This),
          pCallback));

   end UnregisterForDOMEventListeners;

end MSHTML.IEventTarget2_Interface;

