with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLStyleMedia_Interface is

   procedure Initialize (This : in out IHTMLStyleMedia_Type) is
   begin
      Set_IID (This, IID_IHTMLStyleMedia);
   end Initialize;

   function Pointer (This : IHTMLStyleMedia_Type)
     return Pointer_To_IHTMLStyleMedia
   is
   begin
      return To_Pointer_To_IHTMLStyleMedia (Address (This));
   end Pointer;

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

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

      return RetVal;
   end Get_type;

   function matchMedium
     (This       : IHTMLStyleMedia_Type;
      mediaQuery : GNATCOM.Types.BSTR;
      Free       : Boolean := True)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.matchMedium
         (Pointer (This),
          mediaQuery,
          RetVal'Unchecked_Access));

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

      return RetVal;
   end matchMedium;

end MSHTML.IHTMLStyleMedia_Interface;

