with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IWBScriptControl_Interface is

   procedure Initialize (This : in out IWBScriptControl_Type) is
   begin
      Set_IID (This, IID_IWBScriptControl);
   end Initialize;

   function Pointer (This : IWBScriptControl_Type)
     return Pointer_To_IWBScriptControl
   is
   begin
      return To_Pointer_To_IWBScriptControl (Address (This));
   end Pointer;

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

   procedure raiseEvent
     (This      : IWBScriptControl_Type;
      name      : GNATCOM.Types.BSTR;
      eventData : GNATCOM.Types.VARIANT;
      Free      : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.raiseEvent
         (Pointer (This),
          name,
          eventData));

      if Free then
               GNATCOM.IInterface.Free (name);
               GNATCOM.IInterface.Free (eventData);
      
      end if;

   end raiseEvent;

   procedure bubbleEvent
     (This : IWBScriptControl_Type)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.bubbleEvent
         (Pointer (This)));

   end bubbleEvent;

   procedure setContextMenu
     (This          : IWBScriptControl_Type;
      menuItemPairs : GNATCOM.Types.VARIANT;
      Free          : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.setContextMenu
         (Pointer (This),
          menuItemPairs));

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

   end setContextMenu;

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

   end Put_selectableContent;

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

      return RetVal;
   end Get_selectableContent;

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

      return RetVal;
   end Get_frozen;

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

   end Put_Scrollbar;

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

      return RetVal;
   end Get_Scrollbar;

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

      return RetVal;
   end Get_version;

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

      return RetVal;
   end Get_visibility;

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

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

   end Put_onvisibilitychange;

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

      return RetVal;
   end Get_onvisibilitychange;

end MSHTML.IWBScriptControl_Interface;

