with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IDOMFocusEvent_Interface is

   procedure Initialize (This : in out IDOMFocusEvent_Type) is
   begin
      Set_IID (This, IID_IDOMFocusEvent);
   end Initialize;

   function Pointer (This : IDOMFocusEvent_Type)
     return Pointer_To_IDOMFocusEvent
   is
   begin
      return To_Pointer_To_IDOMFocusEvent (Address (This));
   end Pointer;

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

   function Get_relatedTarget
     (This : IDOMFocusEvent_Type)
     return Pointer_To_IEventTarget
   is
       RetVal : aliased Pointer_To_IEventTarget;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_relatedTarget
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_relatedTarget;

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

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

   end initFocusEvent;

end MSHTML.IDOMFocusEvent_Interface;

