Win32-2.13.4.0: A binding to Windows Win32 API.
Copyright(c) Alastair Reid 1997-2003
LicenseBSD-style (see the file libraries/base/LICENSE)
MaintainerEsa Ilari Vuokko <ei@vuokko.info>
Stabilityprovisional
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell2010

Graphics.Win32.Window

Description

A collection of FFI declarations for interfacing with Win32.

Synopsis

Documentation

type Pos = Int Source #

setWindowClosure :: HWND -> WindowClosure -> IO (Maybe (FunPtr WindowClosure)) Source #

The standard C wndproc for every window class registered by registerClass is a C function pointer provided with this library. It in turn delegates to a Haskell function pointer stored in gWLP_USERDATA. This action creates that function pointer. All Haskell function pointers must be freed in order to allow the objects they close over to be garbage collected. Consequently, if you are replacing a window closure previously set via this method or indirectly with createWindow or createWindowEx you must free it. This action returns a function pointer to the old window closure for you to free. The current window closure is freed automatically by defWindowProc when it receives wM_NCDESTROY.

createWindow :: ClassName -> String -> WindowStyle -> Maybe Pos -> Maybe Pos -> Maybe Pos -> Maybe Pos -> Maybe HWND -> Maybe HMENU -> HINSTANCE -> WindowClosure -> IO HWND Source #

Creates a window with a default extended window style. If you create many windows over the life of your program, WindowClosure may leak memory. Be sure to delegate to defWindowProc for wM_NCDESTROY and see defWindowProc and setWindowClosure for details.

createWindowEx :: WindowStyle -> ClassName -> String -> WindowStyle -> Maybe Pos -> Maybe Pos -> Maybe Pos -> Maybe Pos -> Maybe HWND -> Maybe HMENU -> HINSTANCE -> WindowClosure -> IO HWND Source #

Creates a window and allows your to specify the extended window style. If you create many windows over the life of your program, WindowClosure may leak memory. Be sure to delegate to defWindowProc for wM_NCDESTROY and see defWindowProc and setWindowClosure for details.

defWindowProc :: Maybe HWND -> WindowMessage -> WPARAM -> LPARAM -> IO LRESULT Source #

Delegates to the Win32 default window procedure. If you are using a window created by createWindow, createWindowEx or on which you have called setWindowClosure, please note that the window will leak memory once it is destroyed unless you call freeWindowProc when it receives wM_NCDESTROY. If you wish to do this, instead of using this function directly, you can delegate to defWindowProcSafe which will handle it for you. As an alternative, you can manually retrieve the window closure function pointer and free it after the window has been destroyed. Check the implementation of freeWindowProc for a guide.

defWindowProcSafe :: Maybe HWND -> WindowMessage -> WPARAM -> LPARAM -> IO LRESULT Source #

Delegates to the standard default window procedure, but if it receives the wM_NCDESTROY message it first frees the window closure to allow the closure and any objects it closes over to be garbage collected. wM_NCDESTROY is the last message a window receives prior to being deleted.

freeWindowProc :: HWND -> IO () Source #

Frees a function pointer to the window closure which has been set directly by setWindowClosure or indirectly by createWindowEx. You should call this function in your window closure's wM_NCDESTROY case unless you delegate that case to defWindowProc (e.g. as part of the default).

findWindowByName :: String -> IO (Maybe HWND) Source #

Deprecated: Use 'findWindow Nothing' instead.

moveWindow :: HWND -> Int -> Int -> Int -> Int -> Bool -> IO () Source #

c_MoveWindow :: HWND -> Int -> Int -> Int -> Int -> Bool -> IO Bool Source #

allocaMessage :: (LPMSG -> IO a) -> IO a Source #