Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Extensions |
|
Grid tabular list is a uniform grid that supports cell-by-cell navigation.
Because this list is designed to show arbitrary numbers of columns, horizontal scrolling is supported through cell-by-cell navigation.
Grid tabular list tries to show the current column in the center. If it can't show the current column in the center, it shows the first column in the left corner or the last column in the right corner.
It should be fast enough to handle a large spreadsheet. It is also suitable for an interface to a database table.
Synopsis
- data GridContext = GridContext {
- row :: FlatContext
- col :: FlatContext
- data GridColHdr n = GridColHdr {
- draw :: ListFocused -> WidthDeficit -> FlatContext -> Widget n
- height :: Height
- data GridRenderers n e r = GridRenderers {
- drawCell :: ListFocused -> WidthDeficit -> GridContext -> e -> Widget n
- rowHdr :: Maybe (RowHdr n e r)
- colHdr :: Maybe (GridColHdr n)
- drawColHdrRowHdr :: DrawColHdrRowHdr n
- type GridWidths = Seq Width
- data GridTabularList n e = GridTabularList {
- list :: GenericList n Seq e
- widths :: GridWidths
- currentColumn :: Index
- gridTabularList :: n -> Seq e -> ListItemHeight -> GridWidths -> GridTabularList n e
- renderGridTabularList :: (Ord n, Show n) => GridRenderers n e r -> ListFocused -> GridTabularList n e -> Widget n
- gridMoveLeft :: GridTabularList n e -> GridTabularList n e
- gridMoveRight :: GridTabularList n e -> GridTabularList n e
- gridMoveTo :: Index -> GridTabularList n e -> GridTabularList n e
- gridMoveToBeginning :: GridTabularList n e -> GridTabularList n e
- gridMoveToEnd :: GridTabularList n e -> GridTabularList n e
- gridMovePageUp :: Ord n => GridRenderers n e r -> EventM n (GridTabularList n e) ()
- gridMovePageDown :: Ord n => GridRenderers n e r -> EventM n (GridTabularList n e) ()
- handleGridListEvent :: Ord n => GridRenderers n e r -> Event -> EventM n (GridTabularList n e) ()
- handleGridListEventVi :: Ord n => GridRenderers n e r -> Event -> EventM n (GridTabularList n e) ()
- module Brick.Widgets.TabularList.Types
Data types
data GridContext Source #
Context for grid cells
GridContext | |
|
Instances
Generic GridContext Source # | |
Defined in Brick.Widgets.TabularList.Grid type Rep GridContext :: Type -> Type # from :: GridContext -> Rep GridContext x # to :: Rep GridContext x -> GridContext # | |
Show GridContext Source # | |
Defined in Brick.Widgets.TabularList.Grid showsPrec :: Int -> GridContext -> ShowS # show :: GridContext -> String # showList :: [GridContext] -> ShowS # | |
type Rep GridContext Source # | |
Defined in Brick.Widgets.TabularList.Grid type Rep GridContext = D1 ('MetaData "GridContext" "Brick.Widgets.TabularList.Grid" "brick-tabular-list-1.0.0.1-En9LBR6wT7ZEawsXqx3s8t" 'False) (C1 ('MetaCons "GridContext" 'PrefixI 'True) (S1 ('MetaSel ('Just "row") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FlatContext) :*: S1 ('MetaSel ('Just "col") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FlatContext))) |
data GridColHdr n Source #
Grid column header
GridColHdr | |
|
Instances
Generic (GridColHdr n) Source # | |
Defined in Brick.Widgets.TabularList.Grid type Rep (GridColHdr n) :: Type -> Type # from :: GridColHdr n -> Rep (GridColHdr n) x # to :: Rep (GridColHdr n) x -> GridColHdr n # | |
type Rep (GridColHdr n) Source # | |
Defined in Brick.Widgets.TabularList.Grid type Rep (GridColHdr n) = D1 ('MetaData "GridColHdr" "Brick.Widgets.TabularList.Grid" "brick-tabular-list-1.0.0.1-En9LBR6wT7ZEawsXqx3s8t" 'False) (C1 ('MetaCons "GridColHdr" 'PrefixI 'True) (S1 ('MetaSel ('Just "draw") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ListFocused -> WidthDeficit -> FlatContext -> Widget n)) :*: S1 ('MetaSel ('Just "height") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Height))) |
data GridRenderers n e r Source #
Rendering functions for components of grid tabular list
GridRenderers | |
|
Instances
type GridWidths = Seq Width Source #
Widths for column headers and row columns.
data GridTabularList n e Source #
GridTabularList | |
|
Instances
Generic (GridTabularList n e) Source # | |
Defined in Brick.Widgets.TabularList.Grid type Rep (GridTabularList n e) :: Type -> Type # from :: GridTabularList n e -> Rep (GridTabularList n e) x # to :: Rep (GridTabularList n e) x -> GridTabularList n e # | |
type Rep (GridTabularList n e) Source # | |
Defined in Brick.Widgets.TabularList.Grid type Rep (GridTabularList n e) = D1 ('MetaData "GridTabularList" "Brick.Widgets.TabularList.Grid" "brick-tabular-list-1.0.0.1-En9LBR6wT7ZEawsXqx3s8t" 'False) (C1 ('MetaCons "GridTabularList" 'PrefixI 'True) (S1 ('MetaSel ('Just "list") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (GenericList n Seq e)) :*: (S1 ('MetaSel ('Just "widths") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 GridWidths) :*: S1 ('MetaSel ('Just "currentColumn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Index)))) |
List construction
:: n | The list name (must be unique) |
-> Seq e | The initial list elements |
-> ListItemHeight | |
-> GridWidths | |
-> GridTabularList n e |
Create a grid tabular list
Rendering
renderGridTabularList Source #
:: (Ord n, Show n) | |
=> GridRenderers n e r | |
-> ListFocused | |
-> GridTabularList n e | The list |
-> Widget n |
Render grid tabular list
Column navigation
:: GridTabularList n e | The list |
-> GridTabularList n e |
Move to the left by one column.
:: GridTabularList n e | The list |
-> GridTabularList n e |
Move to the right by one column.
:: Index | |
-> GridTabularList n e | The list |
-> GridTabularList n e |
Move to the given column index
:: GridTabularList n e | The list |
-> GridTabularList n e |
Move to the first column.
:: Ord n | |
=> GridRenderers n e r | Renderers |
-> EventM n (GridTabularList n e) () |
Move to the previous page of columns.
GridRenderers
are needed because if row header doesn't exist, width calculation is affected.
:: Ord n | |
=> GridRenderers n e r | Renderers |
-> EventM n (GridTabularList n e) () |
Move to the next page of columns.
GridRenderers
are needed because if row header doesn't exist, width calculation is affected.
Event handlers
:: Ord n | |
=> GridRenderers n e r | Renderers |
-> Event | |
-> EventM n (GridTabularList n e) () |
Handle events for grid tabular list with navigation keys.
It adds the following keyboard shortcuts to handleListEvent
.
- Move to the left by one column (Left arrow key)
- Move to the right by one column (Right arrow key)
- Go to the first column (Ctrl+Home)
- Go to the last column (Ctrl+End)
- Move to the previous page of columns (Ctrl+PageUp)
- Move to the next page of columns (Ctrl+PageDown)
GridRenderers
are needed because if row header doesn't exist, width calculation is affected.
handleGridListEventVi Source #
:: Ord n | |
=> GridRenderers n e r | Renderers |
-> Event | |
-> EventM n (GridTabularList n e) () |
Handle events for grid tabular list with vim keys.
It adds the following keyboard shortcuts to handleListEventVi
.
- Move to the left by one column (h)
- Move to the right by one column (l)
- Go to the first column (H)
- Go to the last column (L)
- Move to the previous page of columns (Alt+h)
- Move to the next page of columns (Alt+l)
GridRenderers
are needed because if row header doesn't exist, width calculation is affected.