|
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 |
|
|
|
|
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 |
|
|
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 | |
|
|
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 | |
|
|
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 |
|
|
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 |