with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IDOMUIEvent_Interface is

   procedure Initialize (This : in out IDOMUIEvent_Type) is
   begin
      Set_IID (This, IID_IDOMUIEvent);
   end Initialize;

   function Pointer (This : IDOMUIEvent_Type)
     return Pointer_To_IDOMUIEvent
   is
   begin
      return To_Pointer_To_IDOMUIEvent (Address (This));
   end Pointer;

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

   function Get_view
     (This : IDOMUIEvent_Type)
     return Pointer_To_IHTMLWindow2
   is
       RetVal : aliased Pointer_To_IHTMLWindow2;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_view
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_view;

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

      return RetVal;
   end Get_detail;

   procedure initUIEvent
     (This       : IDOMUIEvent_Type;
      eventType  : GNATCOM.Types.BSTR;
      canBubble  : GNATCOM.Types.VARIANT_BOOL;
      cancelable : GNATCOM.Types.VARIANT_BOOL;
      view       : Pointer_To_IHTMLWindow2;
      detail     : Interfaces.C.long;
      Free       : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.initUIEvent
         (Pointer (This),
          eventType,
          canBubble,
          cancelable,
          view,
          detail));

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

   end initUIEvent;

end MSHTML.IDOMUIEvent_Interface;

