with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IDOMMutationEvent_Interface is

   procedure Initialize (This : in out IDOMMutationEvent_Type) is
   begin
      Set_IID (This, IID_IDOMMutationEvent);
   end Initialize;

   function Pointer (This : IDOMMutationEvent_Type)
     return Pointer_To_IDOMMutationEvent
   is
   begin
      return To_Pointer_To_IDOMMutationEvent (Address (This));
   end Pointer;

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

   function Get_relatedNode
     (This : IDOMMutationEvent_Type)
     return GNATCOM.Types.Pointer_To_IDispatch
   is
       RetVal : aliased GNATCOM.Types.Pointer_To_IDispatch;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_relatedNode
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_relatedNode;

   function Get_prevValue
     (This : IDOMMutationEvent_Type)
     return GNATCOM.Types.BSTR
   is
       RetVal : aliased GNATCOM.Types.BSTR;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_prevValue
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_prevValue;

   function Get_newValue
     (This : IDOMMutationEvent_Type)
     return GNATCOM.Types.BSTR
   is
       RetVal : aliased GNATCOM.Types.BSTR;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_newValue
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_newValue;

   function Get_attrName
     (This : IDOMMutationEvent_Type)
     return GNATCOM.Types.BSTR
   is
       RetVal : aliased GNATCOM.Types.BSTR;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_attrName
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_attrName;

   function Get_attrChange
     (This : IDOMMutationEvent_Type)
     return Interfaces.C.unsigned_short
   is
       RetVal : aliased Interfaces.C.unsigned_short;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_attrChange
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_attrChange;

   procedure initMutationEvent
     (This           : IDOMMutationEvent_Type;
      eventType      : GNATCOM.Types.BSTR;
      canBubble      : GNATCOM.Types.VARIANT_BOOL;
      cancelable     : GNATCOM.Types.VARIANT_BOOL;
      relatedNodeArg : GNATCOM.Types.Pointer_To_IDispatch;
      prevValueArg   : GNATCOM.Types.BSTR;
      newValueArg    : GNATCOM.Types.BSTR;
      attrNameArg    : GNATCOM.Types.BSTR;
      attrChangeArg  : Interfaces.C.unsigned_short;
      Free           : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.initMutationEvent
         (Pointer (This),
          eventType,
          canBubble,
          cancelable,
          relatedNodeArg,
          prevValueArg,
          newValueArg,
          attrNameArg,
          attrChangeArg));

      if Free then
               GNATCOM.IInterface.Free (eventType);
               GNATCOM.IInterface.Free (prevValueArg);
               GNATCOM.IInterface.Free (newValueArg);
               GNATCOM.IInterface.Free (attrNameArg);
      
      end if;

   end initMutationEvent;

end MSHTML.IDOMMutationEvent_Interface;

