with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLCSSRule_Interface is

   procedure Initialize (This : in out IHTMLCSSRule_Type) is
   begin
      Set_IID (This, IID_IHTMLCSSRule);
   end Initialize;

   function Pointer (This : IHTMLCSSRule_Type)
     return Pointer_To_IHTMLCSSRule
   is
   begin
      return To_Pointer_To_IHTMLCSSRule (Address (This));
   end Pointer;

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

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

      return RetVal;
   end Get_type;

   procedure Put_cssText
     (This : IHTMLCSSRule_Type;
      p    : GNATCOM.Types.BSTR;
      Free : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_cssText
         (Pointer (This),
          p));

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

   end Put_cssText;

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

      return RetVal;
   end Get_cssText;

   function Get_parentRule
     (This : IHTMLCSSRule_Type)
     return Pointer_To_IHTMLCSSRule
   is
       RetVal : aliased Pointer_To_IHTMLCSSRule;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_parentRule
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_parentRule;

   function Get_parentStyleSheet
     (This : IHTMLCSSRule_Type)
     return Pointer_To_IHTMLStyleSheet
   is
       RetVal : aliased Pointer_To_IHTMLStyleSheet;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_parentStyleSheet
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_parentStyleSheet;

end MSHTML.IHTMLCSSRule_Interface;

