module Graphics.UI.WX.Types
(
Orientation(..)
, ( # ), feed, feed2
, Object, objectNull, objectIsNull, objectCast, objectIsManaged
, objectDelete
, Id, idAny, idCreate
, Var, varCreate, varGet, varSet, varUpdate, varSwap
, BitMask(..), mask, (.+.), (.-.), bits, bitsSet
, toCBool, fromCBool
, Style
, EventId
, TreeItem
, Color, rgb, colorRGB, colorRed, colorGreen, colorBlue
, black, darkgrey, dimgrey, mediumgrey, grey, lightgrey, white
, red, green, blue
, cyan, magenta, yellow
, SystemColor(..), colorSystem
, FontStyle(..), FontFamily(..), FontShape(..), FontWeight(..)
, fontDefault, fontSwiss, fontSmall, fontItalic, fontFixed
, BrushStyle(..), BrushKind(..)
, HatchStyle(..)
, brushDefault
, brushTransparent
, PenStyle(..), PenKind(..), CapStyle(..), JoinStyle(..), DashStyle(..)
, penDefault, penColored, penTransparent
, Point, Point2(Point,pointX,pointY), point, pt, pointFromVec, pointFromSize, pointZero, pointNull
, pointMove, pointMoveBySize, pointAdd, pointSub, pointScale
, Size, Size2D(Size,sizeW,sizeH), sz, sizeFromPoint, sizeFromVec, sizeZero, sizeNull, sizeEncloses
, sizeMin, sizeMax
, Vector, Vector2(Vector,vecX,vecY), vector, vec, vecFromPoint, vecFromSize, vecZero, vecNull
, vecNegate, vecOrtogonal, vecAdd, vecSub, vecScale, vecBetween, vecLength
, vecLengthDouble
, Rect, Rect2D(Rect,rectLeft,rectTop,rectWidth,rectHeight)
, rectTopLeft, rectTopRight, rectBottomLeft, rectBottomRight, rectBottom, rectRight
, rect, rectBetween, rectFromSize, rectZero, rectNull, rectSize, rectIsEmpty
, rectContains, rectMoveTo, rectFromPoint, rectCentralPoint, rectCentralRect, rectStretchTo
, rectCentralPointDouble, rectCentralRectDouble
, rectMove, rectOverlaps, rectsDiff, rectUnion, rectOverlap, rectUnions
, unitIO, bracket, bracket_, finally, finalize, when
) where
import Graphics.UI.WXCore.Types
import Graphics.UI.WXCore.Draw
import Graphics.UI.WXCore.Events( Orientation(..) )
feed :: a -> (a -> b) -> b
feed x f
= f x
feed2 :: a -> b -> (a -> b -> c) -> c
feed2 x y f
= f x y
class Eq b => BitMask b where
assocBitMask :: [(b,Int)]
toBitMask :: b -> Int
fromBitMask :: Int -> b
setBitMask :: b -> Int -> Int
toBitMask x
= case lookup x assocBitMask of
Just m -> m
Nothing -> 0
fromBitMask i
= walk assocBitMask
where
walk [] = error "Graphics.UI.WX.Types.fromBitMask: empty list"
walk [(x,0)] = x
walk ((x,m):xs) | bitsSet m i = x
| otherwise = walk xs
setBitMask x i
= i .-. (bits (map snd (assocBitMask::[(b,Int)]))) .+. toBitMask x
mask :: BitMask b => [b] -> Int
mask xs
= foldr (.+.) 0 (map toBitMask xs)