ContentsIndex
Graphics.UI.WXCore.WxcTypes
Contents
Object types
Type synonyms
Basic types
Point
Size
Vector
Rectangle
Color
Marshalling
Basic types
Managed object types
Primitive types
CString
CInt
CChar
CBool
Pointers
Description
Synopsis
data Object a
objectNull :: Object a
objectIsNull :: Object a -> Bool
objectCast :: Object a -> Object b
objectIsManaged :: Object a -> Bool
objectDelete :: WxObject a -> IO ()
objectFromPtr :: Ptr a -> Object a
managedObjectFromPtr :: Ptr (TWxObject a) -> IO (WxObject a)
withObjectPtr :: Object a -> (Ptr a -> IO b) -> IO b
withObjectRef :: String -> Object a -> (Ptr a -> IO b) -> IO b
withObjectResult :: IO (Ptr a) -> IO (Object a)
withManagedObjectResult :: IO (Ptr (TWxObject a)) -> IO (WxObject a)
objectFinalize :: Object a -> IO ()
objectNoFinalize :: Object a -> IO ()
type Id = Int
type Style = Int
type EventId = Int
intFromBool :: Bool -> Int
boolFromInt :: Int -> Bool
data Point = Point {
pointX :: !Int
pointY :: !Int
}
point :: Int -> Int -> Point
pt :: Int -> Int -> Point
pointFromVec :: Vector -> Point
pointFromSize :: Size -> Point
pointZero :: Point
pointNull :: Point
data Size = Size {
sizeW :: !Int
sizeH :: !Int
}
sz :: Int -> Int -> Size
sizeFromPoint :: Point -> Size
sizeFromVec :: Vector -> Size
sizeZero :: Size
sizeNull :: Size
data Vector = Vector {
vecX :: !Int
vecY :: !Int
}
vector :: Int -> Int -> Vector
vec :: Int -> Int -> Vector
vecFromPoint :: Point -> Vector
vecFromSize :: Size -> Vector
vecZero :: Vector
vecNull :: Vector
data Rect = Rect {
rectLeft :: !Int
rectTop :: !Int
rectWidth :: !Int
rectHeight :: !Int
}
rectTopLeft :: Rect -> Point
rectTopRight :: Rect -> Point
rectBottomLeft :: Rect -> Point
rectBottomRight :: Rect -> Point
rectBottom :: Rect -> Int
rectRight :: Rect -> Int
rect :: Point -> Size -> Rect
rectBetween :: Point -> Point -> Rect
rectFromSize :: Size -> Rect
rectZero :: Rect
rectNull :: Rect
rectSize :: Rect -> Size
rectIsEmpty :: Rect -> Bool
data Color
rgb :: Int -> Int -> Int -> Color
colorRGB :: Int -> Int -> Int -> Color
colorRed :: Color -> Int
colorGreen :: Color -> Int
colorBlue :: Color -> Int
intFromColor :: Color -> Int
colorFromInt :: Int -> Color
colorOk :: Color -> Bool
withPointResult :: (Ptr CInt -> Ptr CInt -> IO ()) -> IO Point
toCIntPointX :: Point -> CInt
toCIntPointY :: Point -> CInt
fromCPoint :: CInt -> CInt -> Point
withCPoint :: Point -> (CInt -> CInt -> IO a) -> IO a
withSizeResult :: (Ptr CInt -> Ptr CInt -> IO ()) -> IO Size
toCIntSizeW :: Size -> CInt
toCIntSizeH :: Size -> CInt
fromCSize :: CInt -> CInt -> Size
withCSize :: Size -> (CInt -> CInt -> IO a) -> IO a
withVectorResult :: (Ptr CInt -> Ptr CInt -> IO ()) -> IO Vector
toCIntVectorX :: Vector -> CInt
toCIntVectorY :: Vector -> CInt
fromCVector :: CInt -> CInt -> Vector
withCVector :: Vector -> (CInt -> CInt -> IO a) -> IO a
withRectResult :: (Ptr CInt -> Ptr CInt -> Ptr CInt -> Ptr CInt -> IO ()) -> IO Rect
toCIntRectX :: Rect -> CInt
toCIntRectY :: Rect -> CInt
toCIntRectW :: Rect -> CInt
toCIntRectH :: Rect -> CInt
fromCRect :: CInt -> CInt -> CInt -> CInt -> Rect
withCRect :: Rect -> (CInt -> CInt -> CInt -> CInt -> IO a) -> IO a
withArrayString :: [String] -> (CInt -> Ptr CString -> IO a) -> IO a
withArrayWString :: [String] -> (CInt -> Ptr CWString -> IO a) -> IO a
withArrayInt :: [Int] -> (CInt -> Ptr CInt -> IO a) -> IO a
withArrayObject :: [Ptr a] -> (CInt -> Ptr (Ptr a) -> IO b) -> IO b
withArrayIntResult :: (Ptr CInt -> IO CInt) -> IO [Int]
withArrayStringResult :: (Ptr (Ptr CChar) -> IO CInt) -> IO [String]
withArrayWStringResult :: (Ptr (Ptr CWchar) -> IO CInt) -> IO [String]
withArrayObjectResult :: (Ptr (Ptr a) -> IO CInt) -> IO [Object a]
colourFromColor :: Color -> IO (Colour ())
colorFromColour :: Colour a -> IO Color
colourCreate :: IO (Ptr (TColour a))
colourSafeDelete :: Ptr (TColour a) -> IO ()
toCCharColorRed :: Color -> CChar
toCCharColorGreen :: Color -> CChar
toCCharColorBlue :: Color -> CChar
data TreeItem
treeItemInvalid :: TreeItem
treeItemIsOk :: TreeItem -> Bool
treeItemFromInt :: Int -> TreeItem
withRefTreeItemId :: (Ptr (TTreeItemId ()) -> IO ()) -> IO TreeItem
withTreeItemIdPtr :: TreeItem -> (Ptr (TTreeItemId a) -> IO b) -> IO b
withTreeItemIdRef :: String -> TreeItem -> (Ptr (TTreeItemId a) -> IO b) -> IO b
withManagedTreeItemIdResult :: IO (Ptr (TTreeItemId a)) -> IO TreeItem
withStringRef :: String -> String -> (Ptr (TWxString s) -> IO a) -> IO a
withStringPtr :: String -> (Ptr (TWxString s) -> IO a) -> IO a
withManagedStringResult :: IO (Ptr (TWxString a)) -> IO String
withRefColour :: (Ptr (TColour a) -> IO ()) -> IO Color
withColourRef :: String -> Color -> (Ptr (TColour a) -> IO b) -> IO b
withColourPtr :: Color -> (Ptr (TColour a) -> IO b) -> IO b
withManagedColourResult :: IO (Ptr (TColour a)) -> IO Color
withRefBitmap :: (Ptr (TBitmap a) -> IO ()) -> IO (Bitmap a)
withManagedBitmapResult :: IO (Ptr (TBitmap a)) -> IO (Bitmap a)
withRefCursor :: (Ptr (TCursor a) -> IO ()) -> IO (Cursor a)
withManagedCursorResult :: IO (Ptr (TCursor a)) -> IO (Cursor a)
withRefIcon :: (Ptr (TIcon a) -> IO ()) -> IO (Icon a)
withManagedIconResult :: IO (Ptr (TIcon a)) -> IO (Icon a)
withRefPen :: (Ptr (TPen a) -> IO ()) -> IO (Pen a)
withManagedPenResult :: IO (Ptr (TPen a)) -> IO (Pen a)
withRefBrush :: (Ptr (TBrush a) -> IO ()) -> IO (Brush a)
withManagedBrushResult :: IO (Ptr (TBrush a)) -> IO (Brush a)
withRefFont :: (Ptr (TFont a) -> IO ()) -> IO (Font a)
withManagedFontResult :: IO (Ptr (TFont a)) -> IO (Font a)
withRefImage :: (Ptr (TImage a) -> IO ()) -> IO (Image a)
withRefListItem :: (Ptr (TListItem a) -> IO ()) -> IO (ListItem a)
withRefFontData :: (Ptr (TFontData a) -> IO ()) -> IO (FontData a)
withRefPrintData :: (Ptr (TPrintData a) -> IO ()) -> IO (PrintData a)
withRefPageSetupDialogData :: (Ptr (TPageSetupDialogData a) -> IO ()) -> IO (PageSetupDialogData a)
withRefPrintDialogData :: (Ptr (TPrintDialogData a) -> IO ()) -> IO (PrintDialogData a)
withRefDateTime :: (Ptr (TDateTime a) -> IO ()) -> IO (DateTime a)
withManagedDateTimeResult :: IO (Ptr (TDateTime a)) -> IO (DateTime a)
withRefGridCellCoordsArray :: (Ptr (TGridCellCoordsArray a) -> IO ()) -> IO (GridCellCoordsArray a)
withManagedGridCellCoordsArrayResult :: IO (Ptr (TGridCellCoordsArray a)) -> IO (GridCellCoordsArray a)
CString
withCString
withStringResult :: (Ptr CChar -> IO CInt) -> IO String
CWString
withCWString
withWStringResult :: (Ptr CWchar -> IO CInt) -> IO String
CInt
toCInt :: Int -> CInt
fromCInt :: CInt -> Int
withIntResult :: IO CInt -> IO Int
CChar
toCChar :: Char -> CChar
fromCChar :: CChar -> Char
withCharResult :: (Num a, Integral a) => IO a -> IO Char
CWchar
toCWchar :: Num a => Char -> a
type CBool = CInt
toCBool :: Bool -> CBool
fromCBool :: CBool -> Bool
withBoolResult :: IO CBool -> IO Bool
Ptr
ptrNull :: Ptr a
ptrIsNull :: Ptr a -> Bool
ptrCast :: Ptr a -> Ptr b
ForeignPtr
FunPtr
toCFunPtr :: FunPtr a -> Ptr a
Object types
data Object a

An Object a is a pointer to an object of type a. The a parameter is used to encode the inheritance relation. When the type parameter is unit (), it denotes an object of exactly that class, when the parameter is a type variable a, it specifies an object that is at least an instance of that class. For example in wxWindows, we have the following class hierarchy:

 EvtHandler
   |- Window
        |- Frame
        |- Control
            |- Button
            |- Radiobox

In wxHaskell, all the creation functions will return objects of exactly that class and use the () type:

 frameCreate :: Window a -> ... -> IO (Frame ())
 buttonCreate :: Window a -> ... -> IO (Button ())
 ...

In contrast, all the this (or self) pointers of methods can take objects of any instance of that class and have a type variable, for example:

 windowSetClientSize :: Window a -> Size -> IO ()
 controlSetLabel     :: Control a -> String -> IO ()
 buttonSetDefault    :: Button a -> IO ()

This means that we can use windowSetClientSize on any window, including buttons and frames, but we can only use controlSetLabel on controls, not includeing frames.

In wxHaskell, this works since a Frame () is actually a type synonym for Window (CFrame ()) (where CFrame is an abstract data type). We can thus pass a value of type Frame () to anything that expects some Window a. For a button this works too, as it is a synonym for Control (CButton ()) which is in turn a synonym for Window (CControl (CButton ())). Note that we can't pass a frame to something that expects a value of type Control a. Of course, a Window a is actually a type synonym for EvtHandler (CWindow a). If you study the documentation in Graphics.UI.WXH.WxcClasses closely, you can discover where this chain ends :-).

Objects are not automatically deleted. Normally you can use a delete function like windowDelete to delete an object. However, almost all objects in the wxWindows library are automatically deleted by the library. The only objects that should be used with care are resources as bitmaps, fonts and brushes.

show/hide Instances
objectNull :: Object a
A null object. Use with care.
objectIsNull :: Object a -> Bool
Test for null object.
objectCast :: Object a -> Object b
Cast an object to another type. Use with care.
objectIsManaged :: Object a -> Bool
Is this a managed object.
objectDelete :: WxObject a -> IO ()
Delete a wxObject, works for managed and unmanaged objects.
objectFromPtr :: Ptr a -> Object a
Create an unmanaged object.
managedObjectFromPtr :: Ptr (TWxObject a) -> IO (WxObject a)
Create a managed object that will be deleted using |wxObject_SafeDelete|.
withObjectPtr :: Object a -> (Ptr a -> IO b) -> IO b
Do something with the object pointer.
withObjectRef :: String -> Object a -> (Ptr a -> IO b) -> IO b
Extract the object pointer and raise an exception if NULL. Otherwise continue with the valid pointer.
withObjectResult :: IO (Ptr a) -> IO (Object a)
Return an unmanaged object.
withManagedObjectResult :: IO (Ptr (TWxObject a)) -> IO (WxObject a)
Create a managed object that will be deleted using |wxObject_SafeDelete|.
objectFinalize :: Object a -> IO ()
Finalize a managed object manually. (no effect on unmanaged objects)
objectNoFinalize :: Object a -> IO ()
Remove the finalizer on a managed object. (no effect on unmanaged objects)
Type synonyms
type Id = Int
An Id is used to identify objects during event handling.
type Style = Int
A Style is normally used as a flag mask to specify some window style
type EventId = Int
An EventId is identifies specific events.
Basic types
intFromBool :: Bool -> Int
boolFromInt :: Int -> Bool
Point
data Point
A point has an x and y coordinate. Coordinates are normally relative to the upper-left corner of their view frame, where a positive x goes to the right and a positive y to the bottom of the view.
Constructors
Point
pointX :: !Intx component of a point.
pointY :: !Inty component of a point.
show/hide Instances
point :: Int -> Int -> Point
Construct a point.
pt :: Int -> Int -> Point
Shorter function to construct a point.
pointFromVec :: Vector -> Point
pointFromSize :: Size -> Point
pointZero :: Point
Point at the origin.
pointNull :: Point
A null point is not a legal point (x and y are -1) and can be used for some wxWindows functions to select a default point.
Size
data Size
A Size has a width and height.
Constructors
Size
sizeW :: !Intthe width of a size
sizeH :: !Intthe height of a size
show/hide Instances
sz :: Int -> Int -> Size
Short function to construct a size
sizeFromPoint :: Point -> Size
sizeFromVec :: Vector -> Size
sizeZero :: Size
sizeNull :: Size
A null size is not a legal size (width and height are -1) and can be used for some wxWindows functions to select a default size.
Vector
data Vector
A vector with an x and y delta.
Constructors
Vector
vecX :: !Intdelta-x component of a vector
vecY :: !Intdelta-y component of a vector
show/hide Instances
vector :: Int -> Int -> Vector
Construct a vector.
vec :: Int -> Int -> Vector
Short function to construct a vector.
vecFromPoint :: Point -> Vector
vecFromSize :: Size -> Vector
vecZero :: Vector
A zero vector
vecNull :: Vector
A null vector has a delta x and y of -1 and can be used for some wxWindows functions to select a default vector.
Rectangle
data Rect
A rectangle is defined by the left x coordinate, the top y coordinate, the width and the height.
Constructors
Rect
rectLeft :: !Int
rectTop :: !Int
rectWidth :: !Int
rectHeight :: !Int
show/hide Instances
rectTopLeft :: Rect -> Point
rectTopRight :: Rect -> Point
rectBottomLeft :: Rect -> Point
rectBottomRight :: Rect -> Point
rectBottom :: Rect -> Int
rectRight :: Rect -> Int
rect :: Point -> Size -> Rect
Create a rectangle at a certain (upper-left) point with a certain size.
rectBetween :: Point -> Point -> Rect
Construct a (positive) rectangle between two (arbitrary) points.
rectFromSize :: Size -> Rect
Create a rectangle of a certain size with the upper-left corner at (pt 0 0).
rectZero :: Rect
An empty rectangle at (0,0).
rectNull :: Rect
An null rectangle is not a valid rectangle (Rect -1 -1 -1 -1) but can used for some wxWindows functions to select a default rectangle. (i.e. frameCreate).
rectSize :: Rect -> Size
Get the size of a rectangle.
rectIsEmpty :: Rect -> Bool
Color
data Color
An abstract data type to define colors.
show/hide Instances
rgb :: Int -> Int -> Int -> Color
Create a color from a red/green/blue triple.
colorRGB :: Int -> Int -> Int -> Color
Create a color from a red/green/blue triple.
colorRed :: Color -> Int
Returns a red color component
colorGreen :: Color -> Int
Returns a green color component
colorBlue :: Color -> Int
Returns a blue color component
intFromColor :: Color -> Int
Return an Int where the three least significant bytes contain the red, green, and blue component of a color.
colorFromInt :: Int -> Color
Set the color according to an rgb integer. (see rgbIntFromColor).
colorOk :: Color -> Bool
Check of a color is valid (Colour::Ok)
Marshalling
Basic types
withPointResult :: (Ptr CInt -> Ptr CInt -> IO ()) -> IO Point
toCIntPointX :: Point -> CInt
toCIntPointY :: Point -> CInt
fromCPoint :: CInt -> CInt -> Point
withCPoint :: Point -> (CInt -> CInt -> IO a) -> IO a
withSizeResult :: (Ptr CInt -> Ptr CInt -> IO ()) -> IO Size
toCIntSizeW :: Size -> CInt
toCIntSizeH :: Size -> CInt
fromCSize :: CInt -> CInt -> Size
withCSize :: Size -> (CInt -> CInt -> IO a) -> IO a
withVectorResult :: (Ptr CInt -> Ptr CInt -> IO ()) -> IO Vector
toCIntVectorX :: Vector -> CInt
toCIntVectorY :: Vector -> CInt
fromCVector :: CInt -> CInt -> Vector
withCVector :: Vector -> (CInt -> CInt -> IO a) -> IO a
withRectResult :: (Ptr CInt -> Ptr CInt -> Ptr CInt -> Ptr CInt -> IO ()) -> IO Rect
toCIntRectX :: Rect -> CInt
toCIntRectY :: Rect -> CInt
toCIntRectW :: Rect -> CInt
toCIntRectH :: Rect -> CInt
fromCRect :: CInt -> CInt -> CInt -> CInt -> Rect
withCRect :: Rect -> (CInt -> CInt -> CInt -> CInt -> IO a) -> IO a
withArrayString :: [String] -> (CInt -> Ptr CString -> IO a) -> IO a
withArrayWString :: [String] -> (CInt -> Ptr CWString -> IO a) -> IO a
withArrayInt :: [Int] -> (CInt -> Ptr CInt -> IO a) -> IO a
withArrayObject :: [Ptr a] -> (CInt -> Ptr (Ptr a) -> IO b) -> IO b
withArrayIntResult :: (Ptr CInt -> IO CInt) -> IO [Int]
withArrayStringResult :: (Ptr (Ptr CChar) -> IO CInt) -> IO [String]
withArrayWStringResult :: (Ptr (Ptr CWchar) -> IO CInt) -> IO [String]
withArrayObjectResult :: (Ptr (Ptr a) -> IO CInt) -> IO [Object a]
colourFromColor :: Color -> IO (Colour ())
colorFromColour :: Colour a -> IO Color
colourCreate :: IO (Ptr (TColour a))
colourSafeDelete :: Ptr (TColour a) -> IO ()
toCCharColorRed :: Color -> CChar
toCCharColorGreen :: Color -> CChar
toCCharColorBlue :: Color -> CChar
Managed object types
data TreeItem
Identifies tree items. Note: Replaces the TreeItemId object and takes automatically care of allocation issues.
show/hide Instances
treeItemInvalid :: TreeItem
Invalid tree item.
treeItemIsOk :: TreeItem -> Bool
Is a tree item ok? (i.e. not invalid).
treeItemFromInt :: Int -> TreeItem
withRefTreeItemId :: (Ptr (TTreeItemId ()) -> IO ()) -> IO TreeItem
withTreeItemIdPtr :: TreeItem -> (Ptr (TTreeItemId a) -> IO b) -> IO b
withTreeItemIdRef :: String -> TreeItem -> (Ptr (TTreeItemId a) -> IO b) -> IO b
withManagedTreeItemIdResult :: IO (Ptr (TTreeItemId a)) -> IO TreeItem
withStringRef :: String -> String -> (Ptr (TWxString s) -> IO a) -> IO a
withStringPtr :: String -> (Ptr (TWxString s) -> IO a) -> IO a
withManagedStringResult :: IO (Ptr (TWxString a)) -> IO String
withRefColour :: (Ptr (TColour a) -> IO ()) -> IO Color
withColourRef :: String -> Color -> (Ptr (TColour a) -> IO b) -> IO b
withColourPtr :: Color -> (Ptr (TColour a) -> IO b) -> IO b
withManagedColourResult :: IO (Ptr (TColour a)) -> IO Color
withRefBitmap :: (Ptr (TBitmap a) -> IO ()) -> IO (Bitmap a)
withManagedBitmapResult :: IO (Ptr (TBitmap a)) -> IO (Bitmap a)
withRefCursor :: (Ptr (TCursor a) -> IO ()) -> IO (Cursor a)
withManagedCursorResult :: IO (Ptr (TCursor a)) -> IO (Cursor a)
withRefIcon :: (Ptr (TIcon a) -> IO ()) -> IO (Icon a)
withManagedIconResult :: IO (Ptr (TIcon a)) -> IO (Icon a)
withRefPen :: (Ptr (TPen a) -> IO ()) -> IO (Pen a)
withManagedPenResult :: IO (Ptr (TPen a)) -> IO (Pen a)
withRefBrush :: (Ptr (TBrush a) -> IO ()) -> IO (Brush a)
withManagedBrushResult :: IO (Ptr (TBrush a)) -> IO (Brush a)
withRefFont :: (Ptr (TFont a) -> IO ()) -> IO (Font a)
withManagedFontResult :: IO (Ptr (TFont a)) -> IO (Font a)
withRefImage :: (Ptr (TImage a) -> IO ()) -> IO (Image a)
withRefListItem :: (Ptr (TListItem a) -> IO ()) -> IO (ListItem a)
withRefFontData :: (Ptr (TFontData a) -> IO ()) -> IO (FontData a)
withRefPrintData :: (Ptr (TPrintData a) -> IO ()) -> IO (PrintData a)
withRefPageSetupDialogData :: (Ptr (TPageSetupDialogData a) -> IO ()) -> IO (PageSetupDialogData a)
withRefPrintDialogData :: (Ptr (TPrintDialogData a) -> IO ()) -> IO (PrintDialogData a)
withRefDateTime :: (Ptr (TDateTime a) -> IO ()) -> IO (DateTime a)
withManagedDateTimeResult :: IO (Ptr (TDateTime a)) -> IO (DateTime a)
withRefGridCellCoordsArray :: (Ptr (TGridCellCoordsArray a) -> IO ()) -> IO (GridCellCoordsArray a)
withManagedGridCellCoordsArrayResult :: IO (Ptr (TGridCellCoordsArray a)) -> IO (GridCellCoordsArray a)
Primitive types
CString
CString
withCString
withStringResult :: (Ptr CChar -> IO CInt) -> IO String
CWString
withCWString
withWStringResult :: (Ptr CWchar -> IO CInt) -> IO String
CInt
CInt
toCInt :: Int -> CInt
fromCInt :: CInt -> Int
withIntResult :: IO CInt -> IO Int
CChar
CChar
toCChar :: Char -> CChar
fromCChar :: CChar -> Char
withCharResult :: (Num a, Integral a) => IO a -> IO Char
CWchar
toCWchar :: Num a => Char -> a
CBool
type CBool = CInt
toCBool :: Bool -> CBool
fromCBool :: CBool -> Bool
withBoolResult :: IO CBool -> IO Bool
Pointers
Ptr
ptrNull :: Ptr a
Null pointer, use with care.
ptrIsNull :: Ptr a -> Bool
Test for null.
ptrCast :: Ptr a -> Ptr b
Cast a pointer type, use with care.
ForeignPtr
FunPtr
toCFunPtr :: FunPtr a -> Ptr a
Produced by Haddock version 0.8