with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IDOMCustomEvent_Interface is

   procedure Initialize (This : in out IDOMCustomEvent_Type) is
   begin
      Set_IID (This, IID_IDOMCustomEvent);
   end Initialize;

   function Pointer (This : IDOMCustomEvent_Type)
     return Pointer_To_IDOMCustomEvent
   is
   begin
      return To_Pointer_To_IDOMCustomEvent (Address (This));
   end Pointer;

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

   function Get_detail
     (This : IDOMCustomEvent_Type)
     return GNATCOM.Types.VARIANT
   is
       RetVal : aliased GNATCOM.Types.VARIANT;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_detail
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_detail;

   procedure initCustomEvent
     (This       : IDOMCustomEvent_Type;
      eventType  : GNATCOM.Types.BSTR;
      canBubble  : GNATCOM.Types.VARIANT_BOOL;
      cancelable : GNATCOM.Types.VARIANT_BOOL;
      detail     : access GNATCOM.Types.VARIANT :=
        GNATCOM.Types.PVARIANT_MISSING;
      Free       : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.initCustomEvent
         (Pointer (This),
          eventType,
          canBubble,
          cancelable,
          detail));

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

   end initCustomEvent;

end MSHTML.IDOMCustomEvent_Interface;

