{-# LINE 1 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}

{-# LANGUAGE CPP #-}

{- |

   Module      :  System.Win32.Automation.Input.Mouse

   Copyright   :  2013 shelarcy

   License     :  BSD-style



   Maintainer  :  shelarcy@gmail.com

   Stability   :  Provisional

   Portability :  Non-portable (Win32 API)



   Mouse input events

-}

module System.Win32.Automation.Input.Mouse where

import Foreign.Ptr               ( Ptr )

import Foreign.Storable          ( Storable(..) )

import System.Win32.Types        ( LONG, ULONG_PTR )

import System.Win32.Word         ( DWORD )











type PMOUSEINPUT = Ptr MOUSEINPUT



data MOUSEINPUT = MOUSEINPUT

     { dx           :: LONG

     , dy           :: LONG

     , mouseData    :: DWORD

     , dwFlags      :: DWORD

     , time         :: DWORD

     , dwExtraInfo :: ULONG_PTR

     } deriving Show



instance Storable MOUSEINPUT where

    sizeOf = const (32)

{-# LINE 36 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}

    alignment _ = 8

{-# LINE 37 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}

    poke buf input = do

        ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) buf (dx input)

{-# LINE 39 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}

        ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) buf (dy input)

{-# LINE 40 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}

        ((\hsc_ptr -> pokeByteOff hsc_ptr 8))   buf (mouseData input)

{-# LINE 41 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}

        ((\hsc_ptr -> pokeByteOff hsc_ptr 12))     buf (dwFlags input)

{-# LINE 42 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}

        ((\hsc_ptr -> pokeByteOff hsc_ptr 16))        buf (time input)

{-# LINE 43 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}

        ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) buf (dwExtraInfo input)

{-# LINE 44 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}

    peek buf = do

        dx' <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) buf

{-# LINE 46 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}

        dy' <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) buf

{-# LINE 47 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}

        mouseData'   <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) buf

{-# LINE 48 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}

        dwFlags'     <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) buf

{-# LINE 49 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}

        time'        <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) buf

{-# LINE 50 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}

        dwExtraInfo' <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) buf

{-# LINE 51 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}

        return $ MOUSEINPUT dx' dy' mouseData' dwFlags' time' dwExtraInfo'



xBUTTON1  :: DWORD

xBUTTON1  =  1

xBUTTON2  :: DWORD

xBUTTON2  =  2



{-# LINE 57 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}



mOUSEEVENTF_ABSOLUTE     :: DWORD

mOUSEEVENTF_ABSOLUTE     =  32768

mOUSEEVENTF_MOVE         :: DWORD

mOUSEEVENTF_MOVE         =  1

mOUSEEVENTF_LEFTDOWN     :: DWORD

mOUSEEVENTF_LEFTDOWN     =  2

mOUSEEVENTF_LEFTUP       :: DWORD

mOUSEEVENTF_LEFTUP       =  4

mOUSEEVENTF_RIGHTDOWN    :: DWORD

mOUSEEVENTF_RIGHTDOWN    =  8

mOUSEEVENTF_RIGHTUP      :: DWORD

mOUSEEVENTF_RIGHTUP      =  16

mOUSEEVENTF_MIDDLEDOWN   :: DWORD

mOUSEEVENTF_MIDDLEDOWN   =  32

mOUSEEVENTF_MIDDLEUP     :: DWORD

mOUSEEVENTF_MIDDLEUP     =  64

mOUSEEVENTF_WHEEL        :: DWORD

mOUSEEVENTF_WHEEL        =  2048

mOUSEEVENTF_XDOWN        :: DWORD

mOUSEEVENTF_XDOWN        =  128

mOUSEEVENTF_XUP          :: DWORD

mOUSEEVENTF_XUP          =  256



{-# LINE 71 "System\\Win32\\Automation\\Input\\Mouse.hsc" #-}



{-

 , mOUSEEVENTF_VIRTUALDESK = MOUSEEVENTF_VIRTUALDESK -- I don't know why we can't find this

 , mOUSEEVENTF_HWHEEL      = MOUSEEVENTF_HWHEEL

 , mOUSEEVENTF_MOVE_NOCOALESCE = MOUSEEVENTF_MOVE_NOCOALESCE

-}