Safe Haskell | None |
---|---|
Language | Haskell2010 |
Basic types used by this library.
- data Widget n = Widget {}
- data Location = Location {}
- locL :: Lens' Location (Int, Int)
- class TerminalLocation a where
- data CursorLocation n = CursorLocation {
- cursorLocation :: !Location
- cursorLocationName :: !(Maybe n)
- cursorLocationL :: forall n. Lens' (CursorLocation n) Location
- cursorLocationNameL :: forall n n. Lens (CursorLocation n) (CursorLocation n) (Maybe n) (Maybe n)
- data Viewport = VP {}
- data ViewportType
- = Vertical
- | Horizontal
- | Both
- vpSize :: Lens' Viewport DisplayRegion
- vpTop :: Lens' Viewport Int
- vpLeft :: Lens' Viewport Int
- newtype EventM n a = EventM {}
- data Next a
- data BrickEvent n e
- handleEventLensed :: a -> Lens' a b -> (e -> b -> EventM n b) -> e -> EventM n a
- type RenderM n a = ReaderT Context (State (RenderState n)) a
- getContext :: RenderM n Context
- data Context
- attrL :: forall r. Getting r Context Attr
- availWidthL :: Lens' Context Int
- availHeightL :: Lens' Context Int
- ctxAttrMapL :: Lens' Context AttrMap
- ctxAttrNameL :: Lens' Context AttrName
- ctxBorderStyleL :: Lens' Context BorderStyle
- ctxDynBordersL :: Lens' Context Bool
- data Result n = Result {
- image :: Image
- cursors :: [CursorLocation n]
- visibilityRequests :: [VisibilityRequest]
- extents :: [Extent n]
- borders :: BorderMap DynBorder
- emptyResult :: Result n
- lookupAttrName :: AttrName -> RenderM n Attr
- data Extent n = Extent {
- extentName :: n
- extentUpperLeft :: Location
- extentSize :: (Int, Int)
- extentOffset :: Location
- imageL :: forall n. Lens' (Result n) Image
- cursorsL :: forall n. Lens' (Result n) [CursorLocation n]
- visibilityRequestsL :: forall n. Lens' (Result n) [VisibilityRequest]
- extentsL :: forall n. Lens' (Result n) [Extent n]
- data VisibilityRequest = VR {}
- vrPositionL :: Lens' VisibilityRequest Location
- vrSizeL :: Lens' VisibilityRequest DisplayRegion
- suffixLenses :: Name -> DecsQ
- bordersL :: forall n. Lens' (Result n) (BorderMap DynBorder)
- data DynBorder = DynBorder {}
- dbStyleL :: Lens' DynBorder BorderStyle
- dbAttrL :: Lens' DynBorder Attr
- dbSegmentsL :: Lens' DynBorder (Edges BorderSegment)
- data BorderSegment = BorderSegment {}
- bsAcceptL :: Lens' BorderSegment Bool
- bsOfferL :: Lens' BorderSegment Bool
- bsDrawL :: Lens' BorderSegment Bool
- data Edges a = Edges {}
- eTopL :: forall a. Lens' (Edges a) a
- eBottomL :: forall a. Lens' (Edges a) a
- eRightL :: forall a. Lens' (Edges a) a
- eLeftL :: forall a. Lens' (Edges a) a
- data Size
- data Padding
- data Direction
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.
locationColumnL :: Lens' a Int Source #
Get the column out of the value
locationColumn :: a -> Int Source #
locationRowL :: Lens' a Int Source #
Get the row out of the value
locationRow :: a -> Int Source #
data CursorLocation n Source #
A cursor location. These are returned by the rendering process.
CursorLocation | |
|
Show n => Show (CursorLocation n) Source # | |
cursorLocationL :: forall n. Lens' (CursorLocation n) Location Source #
cursorLocationNameL :: forall n n. Lens (CursorLocation n) (CursorLocation n) (Maybe n) (Maybe n) Source #
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
The monad in which event handlers run. Although it may be tempting
to dig into the reader value yourself, just use
lookupViewport
.
The type of actions to take upon completion of an event handler.
data BrickEvent n e Source #
The type of events.
VtyEvent Event | The event was a Vty event. |
AppEvent e | The event was an application event. |
MouseDown n Button [Modifier] Location | A mouse-down event on the specified region was
received. The |
MouseUp n (Maybe Button) Location | A mouse-up event on the specified region was
received. The |
:: a | The state value. |
-> Lens' a b | The lens to use to extract and store the target of the event. |
-> (e -> b -> EventM n b) | The event handler. |
-> e | The event to handle. |
-> EventM n 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 n a = ReaderT Context (State (RenderState n)) 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 n 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 bordering style should be used, and the attribute map available for rendering.
attrL :: forall r. Getting r Context Attr 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 | |
|
emptyResult :: Result n Source #
lookupAttrName :: AttrName -> RenderM n Attr Source #
Given an attribute name, obtain the attribute for the attribute name by consulting the context's attribute map.
An extent of a named area: its size, location, and origin.
Extent | |
|
Rendering result lenses
visibilityRequestsL :: forall n. Lens' (Result n) [VisibilityRequest] Source #
Visibility requests
data VisibilityRequest 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.
Dynamic borders
Information about how to redraw a dynamic border character when it abuts another dynamic border character.
DynBorder | |
|
data BorderSegment Source #
A border character has four segments, one extending in each direction (horizontally and vertically) from the center of the character.
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.
Scrolling direction.