Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Widget z
- data WidgetFocus z
- zipW :: CombineGraphics ((Point, MouseButton) -> Widget z) -> Widget z -> Widget z -> Widget z
- graphicWidget :: GraphicTree () -> Widget a
- above :: Widget z -> Widget z -> Widget z
- beside :: Widget z -> Widget z -> Widget z
- runOnCanvas :: String -> Double -> Double -> (forall z. Widget z) -> IO ()
- data GraphicTree :: * -> * where
- Offset :: Point -> GraphicTree a -> GraphicTree a
- Branch :: Rect -> GraphicTree a -> Rect -> GraphicTree a -> GraphicTree a
- Leaf :: Graphic -> GraphicTree ()
- FMap :: (a -> b) -> GraphicTree a -> GraphicTree b
- graphicList :: [Graphic] -> GraphicTree ()
- graphicTreeBounds :: GraphicTree a -> Rect
- data MouseButton
- type Key = Int
- balancedFold :: (a -> a -> a) -> [a] -> a
- type Output a = GraphicTree ((Point, MouseButton) -> a)
- type CombineGraphics a = GraphicTree a -> GraphicTree a -> GraphicTree a
- type Animate a = TimeDifference -> a
- type MouseOut a = a
- type HandleKey a = Key -> a
- type TimeDifference = Double
Widgets
Atom of a sneath lane application
data WidgetFocus z Source
Determines the focus behavior of the widget
zipW :: CombineGraphics ((Point, MouseButton) -> Widget z) -> Widget z -> Widget z -> Widget z Source
Combine two widgets to run in parallel as a single widget
Build Widgets
graphicWidget :: GraphicTree () -> Widget a Source
A widget which just shows a constant graphic output.
Run Widgets
runOnCanvas :: String -> Double -> Double -> (forall z. Widget z) -> IO () Source
Run the widget on the canvas element with ID "canvas"
Graphics
data GraphicTree :: * -> * where Source
A tree of graphics, used as widget output type. FMap functions are stored in the tree instead of being mapped over the leaves, so that tree reconstruction is fast when a widget changes. This is why GraphicTree is a GADT.
Offset: a sub-tree translated by a point
Branch: Two sub-trees; graphicTreeBounds are cached for each
Leaf: A leaf, consisting of a single graphic element
FMap: A graphic tree composed with a function.
Offset :: Point -> GraphicTree a -> GraphicTree a | |
Branch :: Rect -> GraphicTree a -> Rect -> GraphicTree a -> GraphicTree a | |
Leaf :: Graphic -> GraphicTree () | |
FMap :: (a -> b) -> GraphicTree a -> GraphicTree b |
graphicList :: [Graphic] -> GraphicTree () Source
Construct a graphic tree from a nonempty list of graphics.
graphicTreeBounds :: GraphicTree a -> Rect Source
Find a rectangle containing the entire contents of the graphic tree
Events
Utility
balancedFold :: (a -> a -> a) -> [a] -> a Source
Apply a fold in a balanced fashion over a list. Recommended for combining lists of widgets, so that the widget tree has logarithmic depth.
Type synonyms
type Output a = GraphicTree ((Point, MouseButton) -> a) Source
type CombineGraphics a = GraphicTree a -> GraphicTree a -> GraphicTree a Source
type Animate a = TimeDifference -> a Source
type TimeDifference = Double Source