Safe Haskell | None |
---|---|
Language | Haskell98 |
- data StateTree a = Branch {
- state :: State a
- enterWhen :: StateTransition
- leaveWhen :: StateTransition
- adjacents :: [StateTree a]
- type EnterWhen = StateTransition
- type LeaveWhen = StateTransition
- data StateTransition
- = ByKey Key InputState
- | ByKeyWithMod Key InputState Modifier
- | ByMouse MouseButton InputState
- | ByMouseWithMod MouseButton InputState Modifier
- | NoTransition
- root :: State a -> [StateTree a] -> StateTree a
- enterState :: MousePos -> a -> StateTree a -> Maybe (a, StateTree a)
- leaveState :: a -> StateTree a -> (a, StateTree a)
- handleKeyEvent :: KeyInfo -> a -> StateTree a -> (a, StateTree a)
- handleMouseEvent :: MouseInfo -> a -> StateTree a -> (a, StateTree a)
Documentation
the tree of application states and how they entered and leaved
Branch | |
|
type EnterWhen = StateTransition Source
at which event the next state should be entered
type LeaveWhen = StateTransition Source
at which event the current state should be leaved
data StateTransition Source
when a state should be entered or leaved
ByKey Key InputState | |
ByKeyWithMod Key InputState Modifier | |
ByMouse MouseButton InputState | |
ByMouseWithMod MouseButton InputState Modifier | |
NoTransition |
leaveState :: a -> StateTree a -> (a, StateTree a) Source
handleKeyEvent :: KeyInfo -> a -> StateTree a -> (a, StateTree a) Source
handleMouseEvent :: MouseInfo -> a -> StateTree a -> (a, StateTree a) Source