{-# LINE 1 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
{-# LANGUAGE Trustworthy #-}
module Graphics.Win32.GDI.Types
where
import System.Win32.Types
import Control.Monad( zipWithM_ )
import Foreign
{-# CFILES cbits/HsGDI.c #-}
type POINT =
( LONG
, LONG
)
sizeofPOINT :: Int
sizeofPOINT :: Int
sizeofPOINT = (Int
8)
{-# LINE 75 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
allocaPOINT :: (Ptr POINT -> IO a) -> IO a
allocaPOINT :: forall a. (Ptr POINT -> IO a) -> IO a
allocaPOINT =
Int -> (Ptr POINT -> IO a) -> IO a
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
sizeofPOINT
peekPOINT :: Ptr POINT -> IO POINT
peekPOINT :: Ptr POINT -> IO POINT
peekPOINT Ptr POINT
p = do
x <- (\Ptr POINT
hsc_ptr -> Ptr POINT -> Int -> IO Int32
forall b. Ptr b -> Int -> IO Int32
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr POINT
hsc_ptr Int
0) Ptr POINT
p
{-# LINE 83 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
y <- (\hsc_ptr -> peekByteOff hsc_ptr 4) p
{-# LINE 84 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
return (x,y)
pokePOINT :: Ptr POINT -> POINT -> IO ()
pokePOINT :: Ptr POINT -> POINT -> IO ()
pokePOINT Ptr POINT
p (Int32
x,Int32
y) = do
(\Ptr POINT
hsc_ptr -> Ptr POINT -> Int -> Int32 -> IO ()
forall b. Ptr b -> Int -> Int32 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr POINT
hsc_ptr Int
0) Ptr POINT
p Int32
x
{-# LINE 89 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
(\hsc_ptr -> pokeByteOff hsc_ptr 4) p y
{-# LINE 90 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
withPOINT :: POINT -> (Ptr POINT -> IO a) -> IO a
withPOINT :: forall a. POINT -> (Ptr POINT -> IO a) -> IO a
withPOINT POINT
p Ptr POINT -> IO a
f =
(Ptr POINT -> IO a) -> IO a
forall a. (Ptr POINT -> IO a) -> IO a
allocaPOINT ((Ptr POINT -> IO a) -> IO a) -> (Ptr POINT -> IO a) -> IO a
forall a b. (a -> b) -> a -> b
$ \ Ptr POINT
ptr -> do
Ptr POINT -> POINT -> IO ()
pokePOINT Ptr POINT
ptr POINT
p
Ptr POINT -> IO a
f Ptr POINT
ptr
type RECT =
( LONG
, LONG
, LONG
, LONG
)
allocaRECT :: (Ptr RECT -> IO a) -> IO a
allocaRECT :: forall a. (Ptr RECT -> IO a) -> IO a
allocaRECT =
Int -> (Ptr RECT -> IO a) -> IO a
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes ((Int
16))
{-# LINE 107 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
peekRECT :: Ptr RECT -> IO RECT
peekRECT :: Ptr RECT -> IO RECT
peekRECT Ptr RECT
p = do
left <- (\Ptr RECT
hsc_ptr -> Ptr RECT -> Int -> IO Int32
forall b. Ptr b -> Int -> IO Int32
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr RECT
hsc_ptr Int
0) Ptr RECT
p
{-# LINE 111 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
top <- (\hsc_ptr -> peekByteOff hsc_ptr 4) p
{-# LINE 112 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
right <- (\hsc_ptr -> peekByteOff hsc_ptr 8) p
{-# LINE 113 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
bottom <- (\hsc_ptr -> peekByteOff hsc_ptr 12) p
{-# LINE 114 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
return (left, top, right, bottom)
pokeRECT :: Ptr RECT -> RECT -> IO ()
pokeRECT :: Ptr RECT -> RECT -> IO ()
pokeRECT Ptr RECT
p (Int32
left, Int32
top, Int32
right, Int32
bottom) = do
(\Ptr RECT
hsc_ptr -> Ptr RECT -> Int -> Int32 -> IO ()
forall b. Ptr b -> Int -> Int32 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr RECT
hsc_ptr Int
0) Ptr RECT
p Int32
left
{-# LINE 119 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
(\hsc_ptr -> pokeByteOff hsc_ptr 4) p top
{-# LINE 120 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
(\hsc_ptr -> pokeByteOff hsc_ptr 8) p right
{-# LINE 121 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
(\hsc_ptr -> pokeByteOff hsc_ptr 12) p bottom
{-# LINE 122 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
type SIZE =
( LONG
, LONG
)
allocaSIZE :: (Ptr SIZE -> IO a) -> IO a
allocaSIZE :: forall a. (Ptr POINT -> IO a) -> IO a
allocaSIZE =
Int -> (Ptr POINT -> IO a) -> IO a
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes ((Int
8))
{-# LINE 131 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
peekSIZE :: Ptr SIZE -> IO SIZE
peekSIZE :: Ptr POINT -> IO POINT
peekSIZE Ptr POINT
p = do
cx <- (\Ptr POINT
hsc_ptr -> Ptr POINT -> Int -> IO Int32
forall b. Ptr b -> Int -> IO Int32
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr POINT
hsc_ptr Int
0) Ptr POINT
p
{-# LINE 135 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
cy <- (\hsc_ptr -> peekByteOff hsc_ptr 4) p
{-# LINE 136 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
return (cx,cy)
pokeSIZE :: Ptr SIZE -> SIZE -> IO ()
pokeSIZE :: Ptr POINT -> POINT -> IO ()
pokeSIZE Ptr POINT
p (Int32
cx,Int32
cy) = do
(\Ptr POINT
hsc_ptr -> Ptr POINT -> Int -> Int32 -> IO ()
forall b. Ptr b -> Int -> Int32 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr POINT
hsc_ptr Int
0) Ptr POINT
p Int32
cx
{-# LINE 141 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
(\hsc_ptr -> pokeByteOff hsc_ptr 4) p cy
{-# LINE 142 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
withPOINTArray :: [POINT] -> (Ptr POINT -> Int -> IO a) -> IO a
withPOINTArray :: forall a. [POINT] -> (Ptr POINT -> Int -> IO a) -> IO a
withPOINTArray [POINT]
xs Ptr POINT -> Int -> IO a
f = Int -> (Ptr POINT -> IO a) -> IO a
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes (Int
sizeofPOINT Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
len) ((Ptr POINT -> IO a) -> IO a) -> (Ptr POINT -> IO a) -> IO a
forall a b. (a -> b) -> a -> b
$ \ Ptr POINT
ptr -> do
Ptr POINT -> [POINT] -> IO ()
pokePOINTArray Ptr POINT
ptr [POINT]
xs
Ptr POINT -> Int -> IO a
f Ptr POINT
ptr Int
len
where
len :: Int
len = [POINT] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [POINT]
xs
pokePOINTArray :: Ptr POINT -> [POINT] -> IO ()
pokePOINTArray :: Ptr POINT -> [POINT] -> IO ()
pokePOINTArray Ptr POINT
ptr [POINT]
xs = (Int -> POINT -> IO ()) -> [Int] -> [POINT] -> IO ()
forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> m c) -> [a] -> [b] -> m ()
zipWithM_ (Ptr POINT -> Int -> POINT -> IO ()
setPOINT Ptr POINT
ptr) [Int
0..] [POINT]
xs
setPOINT :: Ptr POINT -> Int -> POINT -> IO ()
setPOINT :: Ptr POINT -> Int -> POINT -> IO ()
setPOINT Ptr POINT
ptr Int
off = Ptr POINT -> POINT -> IO ()
pokePOINT (Ptr POINT
ptr Ptr POINT -> Int -> Ptr POINT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
offInt -> Int -> Int
forall a. Num a => a -> a -> a
*Int
sizeofPOINT))
type LPRECT = Ptr RECT
type MbLPRECT = Maybe LPRECT
withRECT :: RECT -> (Ptr RECT -> IO a) -> IO a
withRECT :: forall a. RECT -> (Ptr RECT -> IO a) -> IO a
withRECT RECT
r Ptr RECT -> IO a
f =
(Ptr RECT -> IO a) -> IO a
forall a. (Ptr RECT -> IO a) -> IO a
allocaRECT ((Ptr RECT -> IO a) -> IO a) -> (Ptr RECT -> IO a) -> IO a
forall a b. (a -> b) -> a -> b
$ \ Ptr RECT
ptr -> do
Ptr RECT -> RECT -> IO ()
pokeRECT Ptr RECT
ptr RECT
r
Ptr RECT -> IO a
f Ptr RECT
ptr
getRECT :: LPRECT -> IO RECT
getRECT :: Ptr RECT -> IO RECT
getRECT = Ptr RECT -> IO RECT
peekRECT
type HBITMAP = HANDLE
type MbHBITMAP = Maybe HBITMAP
type HFONT = HANDLE
type MbHFONT = Maybe HFONT
type HCURSOR = HICON
type MbHCURSOR = Maybe HCURSOR
type HICON = HANDLE
type MbHICON = Maybe HICON
type HRGN = ForeignHANDLE
type PRGN = HANDLE
type MbHRGN = Maybe HRGN
type HPALETTE = HANDLE
type MbHPALETTE = Maybe HPALETTE
type HBRUSH = HANDLE
type MbHBRUSH = Maybe HBRUSH
type HPEN = HANDLE
type MbHPEN = Maybe HPEN
type HACCEL = HANDLE
type HDC = HANDLE
type MbHDC = Maybe HDC
type HDWP = HANDLE
type MbHDWP = Maybe HDWP
type HWND = HANDLE
type MbHWND = Maybe HWND
hWND_BOTTOM :: HWND
hWND_BOTTOM :: HWND
hWND_BOTTOM = UINT_PTR -> HWND
forall a. UINT_PTR -> Ptr a
castUINTPtrToPtr UINT_PTR
1
hWND_NOTOPMOST :: HWND
hWND_NOTOPMOST :: HWND
hWND_NOTOPMOST = UINT_PTR -> HWND
forall a. UINT_PTR -> Ptr a
castUINTPtrToPtr UINT_PTR
18446744073709551614
hWND_TOP :: HWND
hWND_TOP :: HWND
hWND_TOP = UINT_PTR -> HWND
forall a. UINT_PTR -> Ptr a
castUINTPtrToPtr UINT_PTR
0
hWND_TOPMOST :: HWND
hWND_TOPMOST :: HWND
hWND_TOPMOST = UINT_PTR -> HWND
forall a. UINT_PTR -> Ptr a
castUINTPtrToPtr UINT_PTR
18446744073709551615
{-# LINE 222 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
type HMENU = HANDLE
type MbHMENU = Maybe HMENU
type COLORREF = Word32
{-# LINE 231 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
foreign import ccall unsafe "HsGDI.h"
rgb :: BYTE -> BYTE -> BYTE -> COLORREF
foreign import ccall unsafe "HsGDI.h"
getRValue :: COLORREF -> BYTE
foreign import ccall unsafe "HsGDI.h"
getGValue :: COLORREF -> BYTE
foreign import ccall unsafe "HsGDI.h"
getBValue :: COLORREF -> BYTE
foreign import ccall unsafe "HsGDI.h"
pALETTERGB :: BYTE -> BYTE -> BYTE -> COLORREF
foreign import ccall unsafe "HsGDI.h"
pALETTEINDEX :: WORD -> COLORREF
type RasterOp3 = Word32
type RasterOp4 = Word32
foreign import ccall unsafe "HsGDI.h"
mAKEROP4 :: RasterOp3 -> RasterOp3 -> RasterOp4
type PolyFillMode = INT
aLTERNATE :: PolyFillMode
aLTERNATE :: Int32
aLTERNATE = Int32
1
wINDING :: PolyFillMode
wINDING :: Int32
wINDING = Int32
2
{-# LINE 269 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
type ArcDirection = INT
type MbArcDirection = Maybe ArcDirection
aD_COUNTERCLOCKWISE :: ArcDirection
aD_COUNTERCLOCKWISE :: Int32
aD_COUNTERCLOCKWISE = Int32
1
aD_CLOCKWISE :: ArcDirection
aD_CLOCKWISE :: Int32
aD_CLOCKWISE = Int32
2
{-# LINE 278 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
type GraphicsMode = DWORD
type MbGraphicsMode = Maybe GraphicsMode
gM_COMPATIBLE :: GraphicsMode
gM_COMPATIBLE :: Word32
gM_COMPATIBLE = Word32
1
gM_ADVANCED :: GraphicsMode
gM_ADVANCED :: Word32
gM_ADVANCED = Word32
2
{-# LINE 287 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
type BackgroundMode = INT
tRANSPARENT :: BackgroundMode
tRANSPARENT :: Int32
tRANSPARENT = Int32
1
oPAQUE :: BackgroundMode
oPAQUE :: Int32
oPAQUE = Int32
2
{-# LINE 295 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
type HatchStyle = INT
hS_HORIZONTAL :: HatchStyle
hS_HORIZONTAL :: Int32
hS_HORIZONTAL = Int32
0
hS_VERTICAL :: HatchStyle
hS_VERTICAL :: Int32
hS_VERTICAL = Int32
1
hS_FDIAGONAL :: HatchStyle
hS_FDIAGONAL :: Int32
hS_FDIAGONAL = Int32
2
hS_BDIAGONAL :: HatchStyle
hS_BDIAGONAL :: Int32
hS_BDIAGONAL = Int32
3
hS_CROSS :: HatchStyle
hS_CROSS :: Int32
hS_CROSS = Int32
4
hS_DIAGCROSS :: HatchStyle
hS_DIAGCROSS :: Int32
hS_DIAGCROSS = Int32
5
{-# LINE 307 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
type StretchBltMode = INT
bLACKONWHITE :: StretchBltMode
bLACKONWHITE = 1
wHITEONBLACK :: StretchBltMode
wHITEONBLACK :: Int32
wHITEONBLACK = Int32
2
cOLORONCOLOR :: StretchBltMode
cOLORONCOLOR :: Int32
cOLORONCOLOR = Int32
3
hALFTONE :: StretchBltMode
hALFTONE :: Int32
hALFTONE = Int32
4
sTRETCH_ANDSCANS :: StretchBltMode
sTRETCH_ANDSCANS :: Int32
sTRETCH_ANDSCANS = Int32
1
sTRETCH_ORSCANS :: StretchBltMode
sTRETCH_ORSCANS :: Int32
sTRETCH_ORSCANS = Int32
2
sTRETCH_DELETESCANS :: StretchBltMode
sTRETCH_DELETESCANS :: Int32
sTRETCH_DELETESCANS = Int32
3
{-# LINE 320 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
type TextAlignment = UINT
tA_NOUPDATECP :: TextAlignment
tA_NOUPDATECP = 0
tA_UPDATECP :: TextAlignment
tA_UPDATECP :: Word32
tA_UPDATECP = Word32
1
tA_LEFT :: TextAlignment
tA_LEFT :: Word32
tA_LEFT = Word32
0
tA_RIGHT :: TextAlignment
tA_RIGHT :: Word32
tA_RIGHT = Word32
2
tA_CENTER :: TextAlignment
tA_CENTER :: Word32
tA_CENTER = Word32
6
tA_TOP :: TextAlignment
tA_TOP :: Word32
tA_TOP = Word32
0
tA_BOTTOM :: TextAlignment
tA_BOTTOM :: Word32
tA_BOTTOM = Word32
8
tA_BASELINE :: TextAlignment
tA_BASELINE :: Word32
tA_BASELINE = 24
{-# LINE 334 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
type ClippingMode = INT
rGN_AND :: ClippingMode
rGN_AND = 1
rGN_OR :: ClippingMode
rGN_OR = 2
rGN_XOR :: ClippingMode
rGN_XOR :: Int32
rGN_XOR = Int32
3
rGN_DIFF :: ClippingMode
rGN_DIFF :: Int32
rGN_DIFF = Int32
4
rGN_COPY :: ClippingMode
rGN_COPY :: Int32
rGN_COPY = Int32
5
{-# LINE 345 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
type RegionType = INT
eRROR :: RegionType
eRROR :: Int32
eRROR = Int32
0
nULLREGION :: RegionType
nULLREGION :: Int32
nULLREGION = Int32
1
sIMPLEREGION :: RegionType
sIMPLEREGION :: Int32
sIMPLEREGION = Int32
2
cOMPLEXREGION :: RegionType
cOMPLEXREGION :: Int32
cOMPLEXREGION = Int32
3
{-# LINE 355 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
gDI_ERROR :: Num a => a
gDI_ERROR = 4294967295
{-# LINE 358 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
cLR_INVALID :: COLORREF
cLR_INVALID :: Word32
cLR_INVALID = Word32
4294967295
{-# LINE 361 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
oBJ_PEN :: UINT
oBJ_PEN :: Word32
oBJ_PEN = Word32
1
oBJ_BRUSH :: UINT
oBJ_BRUSH :: Word32
oBJ_BRUSH = Word32
2
oBJ_DC :: UINT
oBJ_DC :: Word32
oBJ_DC = Word32
3
oBJ_METADC :: UINT
oBJ_METADC :: Word32
oBJ_METADC = Word32
4
oBJ_PAL :: UINT
oBJ_PAL :: Word32
oBJ_PAL = Word32
5
oBJ_FONT :: UINT
oBJ_FONT :: Word32
oBJ_FONT = Word32
6
oBJ_BITMAP :: UINT
oBJ_BITMAP :: Word32
oBJ_BITMAP = Word32
7
oBJ_REGION :: UINT
oBJ_REGION :: Word32
oBJ_REGION = Word32
8
oBJ_METAFILE :: UINT
oBJ_METAFILE :: Word32
oBJ_METAFILE = Word32
9
oBJ_MEMDC :: UINT
oBJ_MEMDC :: Word32
oBJ_MEMDC = Word32
10
oBJ_EXTPEN :: UINT
oBJ_EXTPEN :: Word32
oBJ_EXTPEN = Word32
11
oBJ_ENHMETADC :: UINT
oBJ_ENHMETADC :: Word32
oBJ_ENHMETADC = Word32
12
oBJ_ENHMETAFILE :: UINT
oBJ_ENHMETAFILE :: Word32
oBJ_ENHMETAFILE = Word32
13
{-# LINE 379 "libraries\\Win32\\Graphics\\Win32\\GDI\\Types.hsc" #-}
foreign import ccall unsafe "HsGDI.h"
prim_ChildWindowFromPoint :: HWND -> Ptr POINT -> IO HWND
foreign import ccall unsafe "HsGDI.h"
prim_ChildWindowFromPointEx :: HWND -> Ptr POINT -> DWORD -> IO HWND
foreign import ccall unsafe "HsGDI.h"
prim_MenuItemFromPoint :: HWND -> HMENU -> Ptr POINT -> IO UINT