with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLWindow6_Interface is

   procedure Initialize (This : in out IHTMLWindow6_Type) is
   begin
      Set_IID (This, IID_IHTMLWindow6);
   end Initialize;

   function Pointer (This : IHTMLWindow6_Type)
     return Pointer_To_IHTMLWindow6
   is
   begin
      return To_Pointer_To_IHTMLWindow6 (Address (This));
   end Pointer;

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

   procedure Put_XDomainRequest
     (This : IHTMLWindow6_Type;
      p    : GNATCOM.Types.VARIANT;
      Free : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_XDomainRequest
         (Pointer (This),
          p));

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

   end Put_XDomainRequest;

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

      return RetVal;
   end Get_XDomainRequest;

   function Get_sessionStorage
     (This : IHTMLWindow6_Type)
     return Pointer_To_IHTMLStorage
   is
       RetVal : aliased Pointer_To_IHTMLStorage;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_sessionStorage
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_sessionStorage;

   function Get_localStorage
     (This : IHTMLWindow6_Type)
     return Pointer_To_IHTMLStorage
   is
       RetVal : aliased Pointer_To_IHTMLStorage;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_localStorage
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_localStorage;

   procedure Put_onhashchange
     (This : IHTMLWindow6_Type;
      p    : GNATCOM.Types.VARIANT;
      Free : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_onhashchange
         (Pointer (This),
          p));

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

   end Put_onhashchange;

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

      return RetVal;
   end Get_onhashchange;

   function Get_maxConnectionsPerServer
     (This : IHTMLWindow6_Type)
     return Interfaces.C.long
   is
       RetVal : aliased Interfaces.C.long;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_maxConnectionsPerServer
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_maxConnectionsPerServer;

   procedure postMessage
     (This         : IHTMLWindow6_Type;
      msg          : GNATCOM.Types.BSTR;
      targetOrigin : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      Free         : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.postMessage
         (Pointer (This),
          msg,
          targetOrigin));

      if Free then
               GNATCOM.IInterface.Free (msg);
               GNATCOM.IInterface.Free (targetOrigin);
      
      end if;

   end postMessage;

   function toStaticHTML
     (This            : IHTMLWindow6_Type;
      bstrHTML        : GNATCOM.Types.BSTR;
      Free            : Boolean := True)
     return GNATCOM.Types.BSTR
   is
       RetVal : aliased GNATCOM.Types.BSTR;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.toStaticHTML
         (Pointer (This),
          bstrHTML,
          RetVal'Unchecked_Access));

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

      return RetVal;
   end toStaticHTML;

   procedure Put_onmessage
     (This : IHTMLWindow6_Type;
      p    : GNATCOM.Types.VARIANT;
      Free : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_onmessage
         (Pointer (This),
          p));

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

   end Put_onmessage;

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

      return RetVal;
   end Get_onmessage;

   procedure msWriteProfilerMark
     (This                 : IHTMLWindow6_Type;
      bstrProfilerMarkName : GNATCOM.Types.BSTR;
      Free                 : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.msWriteProfilerMark
         (Pointer (This),
          bstrProfilerMarkName));

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

   end msWriteProfilerMark;

end MSHTML.IHTMLWindow6_Interface;

