with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IDOMCloseEvent_Interface is

   procedure Initialize (This : in out IDOMCloseEvent_Type) is
   begin
      Set_IID (This, IID_IDOMCloseEvent);
   end Initialize;

   function Pointer (This : IDOMCloseEvent_Type)
     return Pointer_To_IDOMCloseEvent
   is
   begin
      return To_Pointer_To_IDOMCloseEvent (Address (This));
   end Pointer;

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

   function Get_wasClean
     (This : IDOMCloseEvent_Type)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_wasClean
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_wasClean;

   procedure initCloseEvent
     (This       : IDOMCloseEvent_Type;
      eventType  : GNATCOM.Types.BSTR;
      canBubble  : GNATCOM.Types.VARIANT_BOOL;
      cancelable : GNATCOM.Types.VARIANT_BOOL;
      wasClean   : GNATCOM.Types.VARIANT_BOOL;
      code       : Interfaces.C.long;
      reason     : GNATCOM.Types.BSTR;
      Free       : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.initCloseEvent
         (Pointer (This),
          eventType,
          canBubble,
          cancelable,
          wasClean,
          code,
          reason));

      if Free then
               GNATCOM.IInterface.Free (eventType);
               GNATCOM.IInterface.Free (reason);
      
      end if;

   end initCloseEvent;

end MSHTML.IDOMCloseEvent_Interface;

