with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLOptionElement_Interface is

   procedure Initialize (This : in out IHTMLOptionElement_Type) is
   begin
      Set_IID (This, IID_IHTMLOptionElement);
   end Initialize;

   function Pointer (This : IHTMLOptionElement_Type)
     return Pointer_To_IHTMLOptionElement
   is
   begin
      return To_Pointer_To_IHTMLOptionElement (Address (This));
   end Pointer;

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

   procedure Put_selected
     (This : IHTMLOptionElement_Type;
      p    : GNATCOM.Types.VARIANT_BOOL)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_selected
         (Pointer (This),
          p));

   end Put_selected;

   function Get_selected
     (This : IHTMLOptionElement_Type)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_selected
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_selected;

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

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

   end Put_value;

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

      return RetVal;
   end Get_value;

   procedure Put_defaultSelected
     (This : IHTMLOptionElement_Type;
      p    : GNATCOM.Types.VARIANT_BOOL)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_defaultSelected
         (Pointer (This),
          p));

   end Put_defaultSelected;

   function Get_defaultSelected
     (This : IHTMLOptionElement_Type)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_defaultSelected
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_defaultSelected;

   procedure Put_index
     (This : IHTMLOptionElement_Type;
      p    : Interfaces.C.long)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_index
         (Pointer (This),
          p));

   end Put_index;

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

      return RetVal;
   end Get_index;

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

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

   end Put_text;

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

      return RetVal;
   end Get_text;

   function Get_form
     (This : IHTMLOptionElement_Type)
     return Pointer_To_IHTMLFormElement
   is
       RetVal : aliased Pointer_To_IHTMLFormElement;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_form
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_form;

end MSHTML.IHTMLOptionElement_Interface;

