{-# LINE 1 "Graphics\\Win32\\LayeredWindow.hsc" #-}
{-# LANGUAGE CPP #-}
module Graphics.Win32.LayeredWindow (module Graphics.Win32.LayeredWindow, Graphics.Win32.Window.c_GetWindowLongPtr ) where
import Control.Monad ( void )
import Data.Bits ( (.|.) )
import Foreign.Ptr ( Ptr )
import Graphics.Win32.GDI.AlphaBlend ( BLENDFUNCTION )
import Graphics.Win32.GDI.Types ( COLORREF, HDC, SIZE, SIZE, POINT )
import Graphics.Win32.Window ( WindowStyleEx, c_GetWindowLongPtr, c_SetWindowLongPtr )
import System.Win32.Types ( DWORD, HANDLE, BYTE, BOOL, INT )
#include "windows_cconv.h"
toLayeredWindow :: HANDLE -> IO ()
toLayeredWindow w = do
flg <- c_GetWindowLongPtr w gWL_EXSTYLE
void $ c_SetWindowLongPtr w gWL_EXSTYLE (flg .|. (fromIntegral wS_EX_LAYERED))
gWL_EXSTYLE :: INT
gWL_EXSTYLE = -20
{-# LINE 35 "Graphics\\Win32\\LayeredWindow.hsc" #-}
wS_EX_LAYERED :: WindowStyleEx
wS_EX_LAYERED = 524288
{-# LINE 38 "Graphics\\Win32\\LayeredWindow.hsc" #-}
lWA_COLORKEY, lWA_ALPHA :: DWORD
lWA_COLORKEY = 1
{-# LINE 41 "Graphics\\Win32\\LayeredWindow.hsc" #-}
lWA_ALPHA = 2
{-# LINE 42 "Graphics\\Win32\\LayeredWindow.hsc" #-}
foreign import WINDOWS_CCONV unsafe "windows.h SetLayeredWindowAttributes"
c_SetLayeredWindowAttributes :: HANDLE -> COLORREF -> BYTE -> DWORD -> IO BOOL
foreign import WINDOWS_CCONV unsafe "windows.h GetLayeredWindowAttributes"
c_GetLayeredWindowAttributes :: HANDLE -> COLORREF -> Ptr BYTE -> Ptr DWORD -> IO BOOL
foreign import WINDOWS_CCONV unsafe "windows.h UpdateLayeredWindow"
c_UpdateLayeredWindow :: HANDLE -> HDC -> Ptr POINT -> Ptr SIZE -> HDC -> Ptr POINT -> COLORREF -> Ptr BLENDFUNCTION -> DWORD -> IO BOOL
uLW_ALPHA :: DWORD
uLW_ALPHA = 2
uLW_COLORKEY :: DWORD
uLW_COLORKEY = 1
uLW_OPAQUE :: DWORD
uLW_OPAQUE = 4
{-# LINE 57 "Graphics\\Win32\\LayeredWindow.hsc" #-}