with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IDOMTextEvent_Interface is

   procedure Initialize (This : in out IDOMTextEvent_Type) is
   begin
      Set_IID (This, IID_IDOMTextEvent);
   end Initialize;

   function Pointer (This : IDOMTextEvent_Type)
     return Pointer_To_IDOMTextEvent
   is
   begin
      return To_Pointer_To_IDOMTextEvent (Address (This));
   end Pointer;

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

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

      return RetVal;
   end Get_data;

   function Get_inputMethod
     (This : IDOMTextEvent_Type)
     return Interfaces.C.unsigned_long
   is
       RetVal : aliased Interfaces.C.unsigned_long;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_inputMethod
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_inputMethod;

   procedure initTextEvent
     (This        : IDOMTextEvent_Type;
      eventType   : GNATCOM.Types.BSTR;
      canBubble   : GNATCOM.Types.VARIANT_BOOL;
      cancelable  : GNATCOM.Types.VARIANT_BOOL;
      viewArg     : Pointer_To_IHTMLWindow2;
      dataArg     : GNATCOM.Types.BSTR;
      inputMethod : Interfaces.C.unsigned_long;
      locale      : GNATCOM.Types.BSTR;
      Free        : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.initTextEvent
         (Pointer (This),
          eventType,
          canBubble,
          cancelable,
          viewArg,
          dataArg,
          inputMethod,
          locale));

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

   end initTextEvent;

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

      return RetVal;
   end Get_locale;

end MSHTML.IDOMTextEvent_Interface;

