- module DataTreeView
- newtype CustomHandler = CH {}
- showType :: TypeRep -> String
- showTypeOf :: Typeable a => a -> String
- data MCH a
- self :: Data d => d -> MCH (StrictTree Row)
- simpleCH :: Typeable a => (a -> MCH ([CellAttr], [CellAttr])) -> CustomHandler
- monoCH :: Typeable a => (a -> MCH (Maybe (StrictTree Row))) -> CustomHandler
- monoPureCH :: Typeable a => (a -> Maybe (StrictTree Row)) -> CustomHandler
- monoPureCH' :: Typeable a => (a -> StrictTree Row) -> CustomHandler
- poly1CH :: Typeable1 f => (forall a. Data a => f a -> MCH (Maybe (StrictTree Row))) -> CustomHandler
- poly2CH :: Typeable2 f => (forall a b. (Data a, Data b) => f a b -> MCH (Maybe (StrictTree Row))) -> CustomHandler
- module DataTreeView.StrictTypes
- type CellData = StrictList CellAttr
- data Row = Row {
- rowCV :: !CellData
- rowFieldName :: !CellData
- rowCustomInfo :: !CellData
- rowTypeName :: !CellData
- newRow :: [CellAttr] -> [CellAttr] -> [CellAttr] -> Row
- addToAll :: Row -> [CellAttr] -> Row
- data CellAttr
- type ColorName = String
- txt :: String -> CellAttr
- bgcolor :: ColorName -> CellAttr
- bgcolor' :: Word16 -> Word16 -> Word16 -> CellAttr
- fgcolor :: ColorName -> CellAttr
- fgcolor' :: Word16 -> Word16 -> Word16 -> CellAttr
- scale :: Double -> CellAttr
- dataToTree :: forall d. Data d => CustomHandler -> d -> IO (StrictTree Row)
Documentation
module DataTreeView
Custom handlers
newtype CustomHandler Source
Custom handlers are used for overriding the generic formatting behaviour at some values (for example, printing a String
directly into the Constructor or value column rather than as a list of chars).
If a custom handler matches (returns a Just
), no recursion into its children is performed by default. You can recurse manually using self
.
Monoid CustomHandler | The |
showType :: TypeRep -> StringSource
Show a type with some prettification like replacing [Char]
with String
.
showTypeOf :: Typeable a => a -> StringSource
The monad in which custom handlers run
self :: Data d => d -> MCH (StrictTree Row)Source
Invokes the final Data-to-Tree conversion function, which includes the generic handler, the CustomHandler
being defined, and any CustomHandler
s mappend
ed to the one being defined.
Thus, invoking
from your implementation of self
x
will usually amount to an infinite loop, but invoking runCH
x
on some child self
yy
of x
is fine.
Specialized constructors
simpleCH :: Typeable a => (a -> MCH ([CellAttr], [CellAttr])) -> CustomHandlerSource
A CustomHandler
that only works at a fixed type (and always works there), and generates a node with no children and with the default text in the type column.
The function should return the rowCV
in the first component and the rowCustomInfo
in the second.
monoCH :: Typeable a => (a -> MCH (Maybe (StrictTree Row))) -> CustomHandlerSource
Creates a custom handler that only applies at a fixed monomorphic type a
.
monoPureCH :: Typeable a => (a -> Maybe (StrictTree Row)) -> CustomHandlerSource
Creates a pure custom handler that only applies at a fixed monomorphic type a
.
monoPureCH' :: Typeable a => (a -> StrictTree Row) -> CustomHandlerSource
Creates a pure custom handler that only and always applies at a fixed monomorphic type a
.
poly1CH :: Typeable1 f => (forall a. Data a => f a -> MCH (Maybe (StrictTree Row))) -> CustomHandlerSource
Creates a custom handler that applies at f a
for a fixed type constructor f
and for any a
.
poly2CH :: Typeable2 f => (forall a b. (Data a, Data b) => f a b -> MCH (Maybe (StrictTree Row))) -> CustomHandlerSource
Creates a custom handler that applies at f a b
for a fixed binary type constructor f
and for any a
and b
.
Data that custom handlers must produce
module DataTreeView.StrictTypes
type CellData = StrictList CellAttrSource
Data for a row of the tree widget.
Row | |
|
Construct a Row
with empty rowFieldName
.
You usually can't know the field name for a node x
during a recursive call with x
at its root - the field name will be added afterwards by the generic handler for the parent node of x
if that parent node is a constructor with named fields.
Cell attributes
Cell attributes
txt :: String -> CellAttrSource
The cell's text. If this attribute occurs multiple times for a single cell, the occurences are concatenated.
Internal
dataToTree :: forall d. Data d => CustomHandler -> d -> IO (StrictTree Row)Source