Safe Haskell | None |
---|---|
Language | Haskell2010 |
Basic types used by this library.
- data Widget = Widget {}
- data Location = Location {}
- locL :: Iso' Location (Int, Int)
- class TerminalLocation a where
- data CursorLocation = CursorLocation {
- cursorLocation :: !Location
- cursorLocationName :: !(Maybe Name)
- cursorLocationL :: Lens' CursorLocation Location
- cursorLocationNameL :: Lens' CursorLocation (Maybe Name)
- data Viewport = VP {}
- data ViewportType
- = Vertical
- | Horizontal
- | Both
- vpSize :: Lens' Viewport DisplayRegion
- vpTop :: Lens' Viewport Int
- vpLeft :: Lens' Viewport Int
- type EventM a = ReaderT (Map Name Viewport) (StateT EventState IO) a
- data Next a
- class HandleEvent a where
- handleEvent :: Event -> a -> EventM a
- handleEventLensed :: HandleEvent b => a -> Lens' a b -> Event -> EventM a
- type RenderM a = ReaderT Context (State RenderState) a
- getContext :: RenderM Context
- data Context
- attrL :: (Contravariant f, Functor f) => (Attr -> f Attr) -> Context -> f Context
- availWidthL :: Lens' Context Int
- availHeightL :: Lens' Context Int
- ctxAttrMapL :: Lens' Context AttrMap
- ctxAttrNameL :: Lens' Context AttrName
- ctxBorderStyleL :: Lens' Context BorderStyle
- data Result = Result {
- image :: Image
- cursors :: [CursorLocation]
- visibilityRequests :: [VisibilityRequest]
- lookupAttrName :: AttrName -> RenderM Attr
- imageL :: Lens' Result Image
- cursorsL :: Lens' Result [CursorLocation]
- visibilityRequestsL :: Lens' Result [VisibilityRequest]
- data VisibilityRequest = VR {
- vrPosition :: Location
- vrSize :: DisplayRegion
- vrPositionL :: Lens' VisibilityRequest Location
- vrSizeL :: Lens' VisibilityRequest DisplayRegion
- suffixLenses :: Name -> DecsQ
- data Size
- data Padding
- data Direction
- newtype Name = Name String
The Widget type
The type of widgets.
Location types and lenses
A terminal screen location.
class TerminalLocation a where Source
The class of types that behave like terminal locations.
Get the column out of the value
Get the row out of the value
data CursorLocation Source
A cursor location. These are returned by the rendering process.
CursorLocation | |
|
Viewports
Describes the state of a viewport as it appears as its most recent rendering.
data ViewportType Source
The type of viewports that indicates the direction(s) in which a viewport is scrollable.
Vertical | Viewports of this type are scrollable only vertically. |
Horizontal | Viewports of this type are scrollable only horizontally. |
Both | Viewports of this type are scrollable vertically and horizontally. |
Event-handling types
type EventM a = ReaderT (Map Name Viewport) (StateT EventState IO) a Source
The monad in which event handlers run. Although it may be tempting
to dig into the reader value yourself, just use
lookupViewport
.
class HandleEvent a where Source
The class of types that provide some basic event-handling.
handleEvent :: Event -> a -> EventM a Source
Handle a Vty event
HandleEvent Editor | |
HandleEvent (Dialog a) | |
HandleEvent (List e) |
:: HandleEvent b | |
=> a | The state value. |
-> Lens' a b | The lens to use to extract and store the target of the event. |
-> Event | The event to handle. |
-> EventM a |
A convenience function for handling events intended for values
that are targets of lenses in your application state. This function
obtains the target value of the specified lens, invokes handleEvent
on it, and stores the resulting transformed value back in the state
using the lens.
Rendering infrastructure
type RenderM a = ReaderT Context (State RenderState) a Source
The type of the rendering monad. This monad is used by the library's rendering routines to manage rendering state and communicate rendering parameters to widgets' rendering functions.
getContext :: RenderM Context Source
Get the current rendering context.
The rendering context
The rendering context. This tells widgets how to render: how much space they have in which to render, which attribute they should use to render, which bordring style should be used, and the attribute map available for rendering.
attrL :: (Contravariant f, Functor f) => (Attr -> f Attr) -> Context -> f Context Source
The rendering context's current drawing attribute.
Rendering results
The type of result returned by a widget's rendering function. The result provides the image, cursor positions, and visibility requests that resulted from the rendering process.
Result | |
|
lookupAttrName :: AttrName -> RenderM Attr Source
Given an attribute name, obtain the attribute for the attribute name by consulting the context's attribute map.
Rendering result lenses
Visibility requests
data VisibilityRequest Source
VR | |
|
vrSizeL :: Lens' VisibilityRequest DisplayRegion Source
Making lenses
suffixLenses :: Name -> DecsQ Source
A template haskell function to build lenses for a record type. This
function differs from the makeLenses
function in that
it does not require the record fields to be prefixed with underscores
and it adds an L suffix to lens names to make it clear that they
are lenses.
Miscellaneous
Widget growth policies. These policies communicate to layout algorithms how a widget uses space when being rendered. These policies influence rendering order and space allocation in the box layout algorithm.
The type of padding.