ParentContentsIndex
Graphics.UI.GIO.Types
Portability portable
Stability provisional
Maintainer ka2_mail@yahoo.com
Contents
Geometry
Size
Point
Rectangle
Construction
Access
Calculations
Events
Modifiers
Mouse events
Keyboard events
Document interface
PositionType
Render
Colors
Bitmaps
Canvas
Fonts
Utility
Variables
Misc.
Internal
Description
Basic types.
Synopsis
data Size = Size {
sw :: !Int
sh :: !Int
}
sz :: Int -> Int -> Size
sizeEncloses :: Size -> Size -> Bool
maxSize :: Size -> Size -> Size
addh :: Size -> Size -> Size
addv :: Size -> Size -> Size
addSize :: Size -> Size -> Size
sizeDistance :: Point -> Point -> Size
data Point = Point {
px :: !Int
py :: !Int
}
pt :: Int -> Int -> Point
pointMove :: Size -> Point -> Point
pointAdd :: Point -> Point -> Point
pointSub :: Point -> Point -> Point
pointScale :: Int -> Point -> Point
data Rect = Rect {
left :: !Int
top :: !Int
right :: !Int
bottom :: !Int
}
rect :: Point -> Point -> Rect
rectAt :: Point -> Size -> Rect
rectOfSize :: Size -> Rect
pointToRect :: Point -> Rect
topLeft :: Rect -> Point
topRight :: Rect -> Point
bottomLeft :: Rect -> Point
bottomRight :: Rect -> Point
rectSize :: Rect -> Size
rectMove :: Size -> Rect -> Rect
rectMoveTo :: Point -> Rect -> Rect
rectStretchTo :: Size -> Rect -> Rect
rectUnion :: Rect -> Rect -> Rect
rectSect :: Rect -> Rect -> Rect
disjointRects :: Rect -> Rect -> Bool
rectsDiff :: Rect -> Rect -> [Rect]
centralPoint :: Rect -> Point
centralRect :: Rect -> Size -> Rect
rectIsEmpty :: Rect -> Bool
pointInRect :: Point -> Rect -> Bool
data Modifiers = Modifiers {
shiftDown :: !Bool
controlDown :: !Bool
altDown :: !Bool
}
noneDown :: Modifiers -> Bool
noModifiers :: Modifiers
justShift :: Modifiers
justAlt :: Modifiers
justControl :: Modifiers
data MouseEvent
= MouseMove !Point !Modifiers
| MouseRightDown !Point !Modifiers
| MouseRightUp !Point !Modifiers
| MouseLeftDown !Point !Modifiers
| MouseLeftUp !Point !Modifiers
| MouseDoubleClick !Point !Modifiers
| MouseDrag !Point !Modifiers
mousePos :: MouseEvent -> Point
mouseModifiers :: MouseEvent -> Modifiers
data KeyboardEvent
= KeyDown !Key !IsRepeatKey
| KeyUp !Key
| KeyLost !Key
data Key
= KeyBegin Modifiers
| KeyClear Modifiers
| KeyDelete Modifiers
| KeyEnd Modifiers
| KeyArrowDown Modifiers
| KeyArrowLeft Modifiers
| KeyArrowRight Modifiers
| KeyArrowUp Modifiers
| KeyPageDown Modifiers
| KeyPageUp Modifiers
| KeyEscape Modifiers
| KeyEnter Modifiers
| KeyTab Modifiers
| KeyBackSpace Modifiers
| KeyF1 Modifiers
| KeyF2 Modifiers
| KeyF3 Modifiers
| KeyF4 Modifiers
| KeyF5 Modifiers
| KeyF6 Modifiers
| KeyF7 Modifiers
| KeyF8 Modifiers
| KeyF9 Modifiers
| KeyF10 Modifiers
| KeyF11 Modifiers
| KeyF12 Modifiers
| KeyF13 Modifiers
| KeyF14 Modifiers
| KeyF15 Modifiers
| KeyHelp Modifiers
| KeyChar !Char
| KeyAltChar !Char
| KeyNull
keyboardKey :: KeyboardEvent -> Key
keyboardRepeat :: KeyboardEvent -> Bool
keyModifiers :: Key -> Modifiers
data DocumentInterface
= NDI
| SDI
| MDI
data PositionType
= PosLeft
| PosTop
| PosRight
| PosBottom
module Graphics.UI.Port.Colors
data Bitmap
data Codec = Codec {
codecName :: !String
codecDescr :: !String
codecMime :: !String
codecExtensions :: ![String]
codecIsReadable :: !Bool
codecIsWritable :: !Bool
}
data DrawMode
= DrawCopy
| DrawInvert
| DrawXor
data BufferMode
= Buffered
| UnBuffered
data JoinStyle
= JoinBevel
| JoinMiter
| JoinRound
data CapStyle
= CapRound
| CapSquare
| CapFlat
data LineStyle
= LineSolid
| LineDash
| LineDot
| LineDashDot
| LineDashDotDot
| LineCustomStyle [Word8]
data HatchStyle
= HatchSolid
| HatchBDiagonal
| HatchFDiagonal
| HatchCross
| HatchDiagCross
| HatchHorizontal
| HatchVertical
| HatchPattern Bitmap
data Font
fontDef :: Font -> FontDef
data FontDef = FontDef {
fontName :: !FontName
fontSize :: !FontSize
fontWeight :: !FontWeight
fontStyle :: !FontStyle
fontUnderline :: !Bool
fontStrikeOut :: !Bool
}
type FontName = String
type FontSize = Int
type FontWeight = Int
data FontStyle
= Roman
| Italic
| Oblique
fontMinWeight :: Int
fontMaxWeight :: Int
fontNormalWeight :: Int
fontBoldWeight :: Int
data FontMetrics = FontMetrics {
fontAscent :: !Int
fontDescent :: !Int
fontLeading :: !Int
fontMaxWidth :: !Int
}
fontLineHeight :: FontMetrics -> Int
type Var a = MVar a
newVar :: a -> IO (Var a)
getVar :: Var a -> IO a
setVar :: Var a -> a -> IO ()
updateVar :: Var a -> (a -> a) -> IO a
takeVar :: Var a -> IO a
putVar :: Var a -> a -> IO ()
bounded :: (Ord a) => a -> a -> a -> a
type WindowHandle = Ptr WH
type CanvasHandle = Ptr CH
type MenuHandle = Ptr MH
type ToolHandle = Ptr TLH
type FontHandle = Ptr FH
type BitmapHandle = Ptr BH
type TimerHandle = Ptr TH
nullHandle :: Ptr a
Geometry
Size
data Size
A Size has a width and height.
Constructors
Size
sw :: !Int the width of a size
sh :: !Int the height of a size
sz :: Int -> Int -> Size
Short function to construct a size
sizeEncloses :: Size -> Size -> Bool
maxSize :: Size -> Size -> Size
addh :: Size -> Size -> Size
addv :: Size -> Size -> Size
addSize :: Size -> Size -> Size
sizeDistance :: Point -> Point -> Size
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
px :: !Int x component of a point.
py :: !Int y component of a point.
pt :: Int -> Int -> Point
Short function to construct a point.
pointMove :: Size -> Point -> Point
pointAdd :: Point -> Point -> Point
pointSub :: Point -> Point -> Point
pointScale :: Int -> Point -> Point
Rectangle
data Rect
A rectangle is defined by four points -- the left x coordinate, the top y coordinate, the right x coordinate and the bottom y coordinate. Pixels lie between the cooridinates. This means that a rectangle where all coordinates are the same, designates an empty area (and not a single pixel). The pixel width of a rectangle is therefore simply the difference between the right and left, or bottom and top coordinate.
Constructors
Rect
left :: !Int
top :: !Int
right :: !Int
bottom :: !Int
Construction
rect :: Point -> Point -> Rect
Construct a (positive) rectangle between two (arbitraty) points.
rectAt :: Point -> Size -> Rect
Create a rectangle at a certain (upper-left) point with a certain size.
rectOfSize :: Size -> Rect
Create a rectangle of a certain size with the upper-left corner at (pt 0 0).
pointToRect :: Point -> Rect
Access
topLeft :: Rect -> Point
The top left corner of the rectangle
topRight :: Rect -> Point
The top right corner of the rectangle
bottomLeft :: Rect -> Point
The bottom left corner of the rectangle
bottomRight :: Rect -> Point
The bottom right corner of the rectangle
rectSize :: Rect -> Size
Get the size of a rectangle.
Calculations
rectMove :: Size -> Rect -> Rect
rectMoveTo :: Point -> Rect -> Rect
rectStretchTo :: Size -> Rect -> Rect
rectUnion :: Rect -> Rect -> Rect
rectSect :: Rect -> Rect -> Rect
disjointRects :: Rect -> Rect -> Bool
rectsDiff :: Rect -> Rect -> [Rect]
centralPoint :: Rect -> Point
centralRect :: Rect -> Size -> Rect
rectIsEmpty :: Rect -> Bool
pointInRect :: Point -> Rect -> Bool
Events
Modifiers
data Modifiers
The Modifiers indicate the meta keys that have been pressed (True) or not (False).
Constructors
Modifiers
shiftDown :: !Bool shift key down
controlDown :: !Bool control key down
altDown :: !Bool alt key down
noneDown :: Modifiers -> Bool
Test if no meta key was pressed.
noModifiers :: Modifiers
Construct a Modifiers structure with no meta keys pressed.
justShift :: Modifiers
Construct a Modifiers structure with just Shift meta key pressed.
justAlt :: Modifiers
Construct a Modifiers structure with just Alt meta key pressed.
justControl :: Modifiers
Construct a Modifiers structure with just Ctrl meta key pressed.
Mouse events
data MouseEvent
Mouse events
Constructors
MouseMove !Point !Modifiers Mouse was moved over the client area of the window
MouseRightDown !Point !Modifiers Mouse right button goes down
MouseRightUp !Point !Modifiers Mouse right button goes up
MouseLeftDown !Point !Modifiers Mouse left button goes down
MouseLeftUp !Point !Modifiers Mouse left button goes up
MouseDoubleClick !Point !Modifiers Mouse left button is double clicked
MouseDrag !Point !Modifiers Mouse is moved over the client area of the window and its left button is down
mousePos :: MouseEvent -> Point
Extract the position from a MouseEvent.
mouseModifiers :: MouseEvent -> Modifiers
Extract the modifiers from a MouseEvent.
Keyboard events
data KeyboardEvent
The KeyboardEvent type.
Constructors
KeyDown !Key !IsRepeatKey Key is down
KeyUp !Key Key goes up
KeyLost !Key The key was down when the widget lost focus
data Key
Keyboard keys. A Shift-character combinations gets translated into an upper-case character and a Ctrl-character in a control character. Alt-character combinations are normally processed by the system to handle menu's etc.
Constructors
KeyBegin Modifiers
KeyClear Modifiers
KeyDelete Modifiers
KeyEnd Modifiers
KeyArrowDown Modifiers
KeyArrowLeft Modifiers
KeyArrowRight Modifiers
KeyArrowUp Modifiers
KeyPageDown Modifiers
KeyPageUp Modifiers
KeyEscape Modifiers
KeyEnter Modifiers
KeyTab Modifiers
KeyBackSpace Modifiers
KeyF1 Modifiers
KeyF2 Modifiers
KeyF3 Modifiers
KeyF4 Modifiers
KeyF5 Modifiers
KeyF6 Modifiers
KeyF7 Modifiers
KeyF8 Modifiers
KeyF9 Modifiers
KeyF10 Modifiers
KeyF11 Modifiers
KeyF12 Modifiers
KeyF13 Modifiers
KeyF14 Modifiers
KeyF15 Modifiers
KeyHelp Modifiers
KeyChar !Char
KeyAltChar !Char
KeyNull
keyboardKey :: KeyboardEvent -> Key
Extract the key from a KeyboardEvent
keyboardRepeat :: KeyboardEvent -> Bool
Is this a key that is held down.
keyModifiers :: Key -> Modifiers
Extract the modifiers from a key
Document interface
data DocumentInterface
The document interface type of interactive processes.
Constructors
NDI No document interface
SDI Single document interface
MDI Multiple document interface
PositionType
data PositionType
Constructors
PosLeft
PosTop
PosRight
PosBottom
Render
Colors
module Graphics.UI.Port.Colors
Bitmaps
data Bitmap
A bitmap. Resources for a bitmap are automatically de-allocated. Equality on bitmaps is only shallow equality: i.e. are the bitmap handles the same.
Instances
Dimensions Bitmap
data Codec
A Codec is an (image) format description.
Constructors
Codec
codecName :: !String Name of the codec.
codecDescr :: !String Description of the code.
codecMime :: !String MIME string of the file format (i.e. "image/bmp")
codecExtensions :: ![String] File extensions used for this format
codecIsReadable :: !Bool Can decode files in this format
codecIsWritable :: !Bool Can encode bitmaps in the format
Canvas
data DrawMode
The drawing mode.
Constructors
DrawCopy Copy directly to the canvas
DrawInvert Invert all colors
DrawXor xor the colors with the colors on the canvas. Doing this twice restores the original picture.
data BufferMode
The drawing buffer.
Constructors
Buffered Draw via a buffer for smoother animations (double buffering)
UnBuffered Draw directly to the canvas
data JoinStyle
The join style is applied to corners of figures (like rectangles).
Constructors
JoinBevel Cut off corners diagonally.
JoinMiter Leave it as is.
JoinRound Round off the corners.
data CapStyle
The cap style is applied to the end points of lines.
Constructors
CapRound Round: put a disc at the logical end point.
CapSquare Square: put a square at the logical end point.
CapFlat End flatly at the logical end point. (Doesn't stick out like square or round).
data LineStyle
The line style is applied when drawing figures.
Constructors
LineSolid Solid line
LineDash Dashed line
LineDot Dotted line
LineDashDot Dash - Dot pattern.
LineDashDotDot Dash - Dot - Dot pattern.
LineCustomStyle [Word8] Custom pattern: each element specifies the pixel length of a dash.
data HatchStyle
The HatchStyle is applied when filling an object.
Constructors
HatchSolid Solid pattern
HatchBDiagonal A 45-degree upward, left-to-right hatch
HatchFDiagonal A 45-degree downward, left-to-right hatch
HatchCross Horizontal and vertical cross-hatch
HatchDiagCross 45-degree crosshatch
HatchHorizontal Horizontal hatch
HatchVertical Vertical hatch
HatchPattern Bitmap A bitmap pattern -- 8x8 pixel bitmaps are always supported.
Fonts
data Font
A font. Resources for a font are automatically de-allocated.
fontDef :: Font -> FontDef
data FontDef
A font definition.
Constructors
FontDef
fontName :: !FontName The name of font
fontSize :: !FontSize The size of font
fontWeight :: !FontWeight Weight between 100 and 900, 400 is normal.
fontStyle :: !FontStyle Style
fontUnderline :: !Bool Underlined
fontStrikeOut :: !Bool Striked out
type FontName = String
Name of the font.
type FontSize = Int
Point size of a font.
type FontWeight = Int
Font weight between 100 and 900, 400 is normal.
data FontStyle
Font styles.
Constructors
Roman
Italic
Oblique
fontMinWeight :: Int
fontMaxWeight :: Int
fontNormalWeight :: Int
fontBoldWeight :: Int
data FontMetrics
The metrics of a font.
Constructors
FontMetrics
fontAscent :: !Int Distance between top and base line
fontDescent :: !Int Distance between bottom and base line
fontLeading :: !Int Distance between two text lines
fontMaxWidth :: !Int Max. character width including spacing
fontLineHeight :: FontMetrics -> Int
Standard line height of a font is the sum of its leading, ascent and descent.
Utility
Variables
type Var a = MVar a
newVar :: a -> IO (Var a)
getVar :: Var a -> IO a
setVar :: Var a -> a -> IO ()
updateVar :: Var a -> (a -> a) -> IO a
takeVar :: Var a -> IO a
putVar :: Var a -> a -> IO ()
Misc.
bounded :: (Ord a) => a -> a -> a -> a
Internal
type WindowHandle = Ptr WH
Abstract handle to a window
type CanvasHandle = Ptr CH
Abstract handle to a drawing context
type MenuHandle = Ptr MH
Abstract handle to a menu
type ToolHandle = Ptr TLH
Abstract handle to a tool
type FontHandle = Ptr FH
Abstract handle to a font
type BitmapHandle = Ptr BH
Abstract handle to a bitmap
type TimerHandle = Ptr TH
Abstract handle to a timer
nullHandle :: Ptr a
A null handle. Use with care.
Produced by Haddock version 0.4