with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IDOMMouseEvent_Interface is

   procedure Initialize (This : in out IDOMMouseEvent_Type) is
   begin
      Set_IID (This, IID_IDOMMouseEvent);
   end Initialize;

   function Pointer (This : IDOMMouseEvent_Type)
     return Pointer_To_IDOMMouseEvent
   is
   begin
      return To_Pointer_To_IDOMMouseEvent (Address (This));
   end Pointer;

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

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

      return RetVal;
   end Get_screenX;

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

      return RetVal;
   end Get_screenY;

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

      return RetVal;
   end Get_clientX;

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

      return RetVal;
   end Get_clientY;

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

      return RetVal;
   end Get_ctrlKey;

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

      return RetVal;
   end Get_shiftKey;

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

      return RetVal;
   end Get_altKey;

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

      return RetVal;
   end Get_metaKey;

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

      return RetVal;
   end Get_button;

   function Get_relatedTarget
     (This : IDOMMouseEvent_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 initMouseEvent
     (This             : IDOMMouseEvent_Type;
      eventType        : GNATCOM.Types.BSTR;
      canBubble        : GNATCOM.Types.VARIANT_BOOL;
      cancelable       : GNATCOM.Types.VARIANT_BOOL;
      viewArg          : Pointer_To_IHTMLWindow2;
      detailArg        : Interfaces.C.long;
      screenXArg       : Interfaces.C.long;
      screenYArg       : Interfaces.C.long;
      clientXArg       : Interfaces.C.long;
      clientYArg       : Interfaces.C.long;
      ctrlKeyArg       : GNATCOM.Types.VARIANT_BOOL;
      altKeyArg        : GNATCOM.Types.VARIANT_BOOL;
      shiftKeyArg      : GNATCOM.Types.VARIANT_BOOL;
      metaKeyArg       : GNATCOM.Types.VARIANT_BOOL;
      buttonArg        : Interfaces.C.unsigned_short;
      relatedTargetArg : Pointer_To_IEventTarget;
      Free             : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.initMouseEvent
         (Pointer (This),
          eventType,
          canBubble,
          cancelable,
          viewArg,
          detailArg,
          screenXArg,
          screenYArg,
          clientXArg,
          clientYArg,
          ctrlKeyArg,
          altKeyArg,
          shiftKeyArg,
          metaKeyArg,
          buttonArg,
          relatedTargetArg));

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

   end initMouseEvent;

   function getModifierState
     (This      : IDOMMouseEvent_Type;
      keyArg    : GNATCOM.Types.BSTR;
      Free      : Boolean := True)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.getModifierState
         (Pointer (This),
          keyArg,
          RetVal'Unchecked_Access));

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

      return RetVal;
   end getModifierState;

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

      return RetVal;
   end Get_buttons;

   function Get_fromElement
     (This : IDOMMouseEvent_Type)
     return Pointer_To_IHTMLElement
   is
       RetVal : aliased Pointer_To_IHTMLElement;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_fromElement
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_fromElement;

   function Get_toElement
     (This : IDOMMouseEvent_Type)
     return Pointer_To_IHTMLElement
   is
       RetVal : aliased Pointer_To_IHTMLElement;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_toElement
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_toElement;

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

      return RetVal;
   end Get_x;

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

      return RetVal;
   end Get_y;

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

      return RetVal;
   end Get_offsetX;

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

      return RetVal;
   end Get_offsetY;

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

      return RetVal;
   end Get_pageX;

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

      return RetVal;
   end Get_pageY;

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

      return RetVal;
   end Get_layerX;

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

      return RetVal;
   end Get_layerY;

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

      return RetVal;
   end Get_which;

end MSHTML.IDOMMouseEvent_Interface;

