|
Graphics.UI.Port | Portability | portable | Stability | provisional | Maintainer | ka2_mail@yahoo.com |
|
|
|
|
Contents |
- Re-exports
- Windows
- Controls
- Drawing
- Timers
- Process
- Fundamental
- Geometry
- Points
- Sizes
- Rectangles
- Render
- Colors
- Bitmaps
- Canvas
- Fonts
- Events
- Modifiers
- Mouse events
- Keyboard events
- Document interface
- PositionType
- Primitive Handles
- Marshalling to C
- Configuration
|
|
Description |
The main interface of Port. Re-exports functionality from
other modules.
|
|
Synopsis |
|
|
|
|
Re-exports |
|
Windows |
|
module Graphics.UI.Port.Menu |
|
module Graphics.UI.Port.Window |
|
module Graphics.UI.Port.CommonDialogs |
|
module Graphics.UI.Port.Message |
|
module Graphics.UI.Port.ToolBar |
|
Controls |
|
module Graphics.UI.Port.Controls |
|
Drawing |
|
module Graphics.UI.Port.Canvas |
|
module Graphics.UI.Port.Font |
|
module Graphics.UI.Port.Bitmap |
|
Timers |
|
module Graphics.UI.Port.Timer |
|
Process |
|
module Graphics.UI.Port.Process |
|
Fundamental |
|
module Graphics.UI.Port.Handlers |
|
Geometry |
|
Points |
|
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 |
|
Sizes |
|
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 |
|
Rectangles |
|
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 | |
|
|
|
|
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 |
|
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. |
|
rectSize :: Rect -> Size |
Get the size of a rectangle. |
|
rectOfSize :: Size -> Rect |
Create a rectangle of a certain size with the upper-left corner at (pt 0 0). |
|
rectIsEmpty :: Rect -> Bool |
|
pointInRect :: Point -> Rect -> Bool |
|
rectMove :: Size -> Rect -> Rect |
|
rectMoveTo :: Point -> Rect -> Rect |
|
pointToRect :: Point -> Rect |
|
centralPoint :: Rect -> Point |
|
centralRect :: Rect -> Size -> Rect |
|
rectStretchTo :: Size -> Rect -> Rect |
|
disjointRects :: Rect -> Rect -> Bool |
|
rectsDiff :: Rect -> Rect -> [Rect] |
|
rectUnion :: Rect -> Rect -> Rect |
|
rectSect :: Rect -> Rect -> Rect |
|
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. |
|
|
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 |
|
| Instances | |
|
|
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 | | Instances | |
|
|
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. |
|
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. |
|
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. |
|
noModifiers :: Modifiers |
Construct a Modifiers structure with no meta keys 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 | |
|
|
keyModifiers :: Key -> Modifiers |
Extract the modifiers from a key |
|
keyboardKey :: KeyboardEvent -> Key |
Extract the key from a KeyboardEvent |
|
keyboardRepeat :: KeyboardEvent -> Bool |
Is this a key that is held down. |
|
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 | |
|
|
|
Primitive Handles |
|
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 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 |
|
type ToolHandle = Ptr TLH |
Abstract handle to a tool |
|
nullHandle :: Ptr a |
A null handle. Use with care. |
|
Marshalling to C |
|
toCDrawMode :: DrawMode -> CInt |
|
toCBufferMode :: BufferMode -> CBool |
|
toCJoinStyle :: JoinStyle -> CInt |
|
toCCapStyle :: CapStyle -> CInt |
|
withCLineStyle :: LineStyle -> (CInt -> CInt -> Ptr CUChar -> IO a) -> IO a |
|
withCHatchStyle :: HatchStyle -> (CInt -> BitmapHandle -> IO a) -> IO a |
|
withCBitmap :: Bitmap -> (BitmapHandle -> IO a) -> IO a |
|
fromCBitmap :: BitmapHandle -> IO Bitmap |
|
withCFont :: Font -> (FontHandle -> IO a) -> IO a |
|
fromCFont :: FontDef -> FontHandle -> IO Font |
|
withCFontDef :: FontDef -> (CString -> CInt -> CInt -> CInt -> IO a) -> IO a |
|
withCFontDefResult :: (Ptr CString -> Ptr CInt -> Ptr CInt -> Ptr CInt -> Ptr CBool -> Ptr CBool -> IO ()) -> IO FontDef |
|
fromCFontDef :: CString -> CInt -> CInt -> CInt -> CBool -> CBool -> IO FontDef |
|
fromCStyle :: CInt -> (FontStyle, Bool, Bool) |
|
fromCWeight :: CInt -> Int |
|
withCFontMetricsResult :: (Ptr CInt -> Ptr CInt -> Ptr CInt -> Ptr CInt -> IO ()) -> IO FontMetrics |
|
fromCFontMetrics :: CInt -> CInt -> CInt -> CInt -> FontMetrics |
|
withCPoint :: Point -> (CInt -> CInt -> IO a) -> IO a |
|
withCPointResult :: (Ptr CInt -> IO ()) -> IO Point |
|
fromCPoint :: CInt -> CInt -> Point |
|
withCSize :: Size -> (CInt -> CInt -> IO a) -> IO a |
|
withCSizeResult :: (Ptr CInt -> IO ()) -> IO Size |
|
fromCSize :: CInt -> CInt -> Size |
|
withCRect :: Rect -> (CInt -> CInt -> CInt -> CInt -> IO a) -> IO a |
|
withCRectResult :: (Ptr CInt -> IO ()) -> IO Rect |
|
fromCRect :: CInt -> CInt -> CInt -> CInt -> Rect |
|
fromCModifiers :: CWord -> Modifiers |
|
toCModifiers :: Modifiers -> CWord |
|
fromCKey :: CInt -> CWord -> Key |
|
toCKey :: Key -> (CInt, CWord) |
|
fromCMouseEvent :: CInt -> CInt -> CInt -> CWord -> MouseEvent |
|
fromCKeyboardEvent :: CInt -> CInt -> CWord -> KeyboardEvent |
|
toCDocumentInterface :: DocumentInterface -> CInt |
|
toCPositionType :: PositionType -> CInt |
|
fromCPositionType :: CInt -> PositionType |
|
fromCInt :: CInt -> Int |
|
toCInt :: Int -> CInt |
|
type CWord = CUInt |
|
fromCWord :: CWord -> Int |
|
toCWord :: Int -> CWord |
|
type CBool = CInt |
|
fromCBool :: CBool -> Bool |
|
toCBool :: Bool -> CBool |
|
fromCChar :: CChar -> Char |
|
toCChar :: Char -> CChar |
|
withCStrings :: [String] -> (Ptr CChar -> IO a) -> IO a |
|
peekCStrings :: Ptr CChar -> IO [String] |
|
resultCString :: IO CString -> IO String |
Convert and free a c-string. |
|
resultCStrings :: IO (Ptr CChar) -> IO [String] |
Convert and free a c-string of c-strings. |
|
Configuration |
|
module Graphics.UI.Port.ConfigKey |
|
Produced by Haddock version 0.4 |