Safe Haskell | Safe-Infered |
---|
- module DataTreeView
- newtype CustomHandler = CH {}
- showType :: TypeRep -> String
- showTypeOf :: Typeable a => a -> String
- data MCH a
- self :: Data d => d -> MCH (StrictTree Row)
- genericHandler :: forall e. Data e => e -> 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
- data AnyData = forall a . Data a => AnyData a
- container0CH :: Typeable a => (a -> (String, [(String, String)], [AnyData])) -> CustomHandler
- container1CH :: Typeable1 f => (forall a. Data a => f a -> (String, [(String, String)], [AnyData])) -> CustomHandler
- container2CH :: Typeable2 f => (forall a b. (Data a, Data b) => f a b -> (String, [(String, String)], [AnyData])) -> 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
- addFieldName :: String -> Row -> 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
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.
genericHandler :: forall e. Data e => e -> MCH (StrictTree Row)Source
Generates the subtree using the Data
instance of the argument (calls self
on the children, not genericHandler
).
You can invoke this from your CustomHandler
and then override some attributes of the result.
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
.
... for containers
container0CH :: Typeable a => (a -> (String, [(String, String)], [AnyData])) -> CustomHandlerSource
Makes a CustomHandler
for container-like types. The given function should return:
- The string for the
rowCV
cell - A list of arbitrary (key,value) pairs to be displayed in the
rowCustomInfo
cell (this should be things like the size of the collection, not a list of elements) - The list of elements
container1CH :: Typeable1 f => (forall a. Data a => f a -> (String, [(String, String)], [AnyData])) -> CustomHandlerSource
Like container0CH
, but for type constructors
container2CH :: Typeable2 f => (forall a b. (Data a, Data b) => f a b -> (String, [(String, String)], [AnyData])) -> CustomHandlerSource
Like container1CH
, but for binary type constructor
Data that custom handlers must produce
module DataTreeView.StrictTypes
type CellData = StrictList CellAttrSource
Row
Data for a row of the tree widget.
Row | |
|
Construction
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.
Modification
addFieldName :: String -> Row -> RowSource
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