Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides a type and functions for handling focus rings of values.
This interface is experimental.
Synopsis
- data FocusRing n
- focusRing :: [n] -> FocusRing n
- focusNext :: FocusRing n -> FocusRing n
- focusPrev :: FocusRing n -> FocusRing n
- focusGetCurrent :: FocusRing n -> Maybe n
- focusSetCurrent :: Eq n => n -> FocusRing n -> FocusRing n
- focusRingLength :: FocusRing n -> Int
- focusRingCursor :: Eq n => (a -> FocusRing n) -> a -> [CursorLocation n] -> Maybe (CursorLocation n)
- withFocusRing :: (Eq n, Named a n) => FocusRing n -> (Bool -> a -> b) -> a -> b
- focusRingModify :: (CList n -> CList n) -> FocusRing n -> FocusRing n
Documentation
A focus ring containing a sequence of resource names to focus and a currently-focused name.
focusGetCurrent :: FocusRing n -> Maybe n Source #
Get the currently-focused resource name from the ring. If the ring
is emtpy, return Nothing
.
focusSetCurrent :: Eq n => n -> FocusRing n -> FocusRing n Source #
Set the currently-focused resource name in the ring, provided the name is in the ring. Otherwise return the ring unmodified.
focusRingLength :: FocusRing n -> Int Source #
Get the size of the FocusRing.
:: Eq n | |
=> (a -> FocusRing n) | The function used to get the focus ring out of your application state. |
-> a | Your application state. |
-> [CursorLocation n] | The list of available cursor positions. |
-> Maybe (CursorLocation n) | The cursor position, if any, that matches the
resource name currently focused by the |
Cursor selection convenience function for use as an
appChooseCursor
value.
:: (Eq n, Named a n) | |
=> FocusRing n | The focus ring to use as the source of focus state. |
-> (Bool -> a -> b) | A function that takes a value and its focus state. |
-> a | The wiget state value that we need to check for focus. |
-> b | The rest of the computation. |
This function is a convenience function to look up a widget state value's resource name in a focus ring and set its focus setting according to the focus ring's state. This function determines whether a given widget state value is the focus of the ring and passes the resulting boolean to a rendering function, along with the state value (a), to produce whatever comes next (b).
Focus-aware widgets have rendering functions that should be
usable with this combinator; see List
and
Edit
.