cattrap-0.2.0.0: Lays out boxes according to the CSS Box Model.
Safe HaskellNone
LanguageHaskell2010

Graphics.Layout

Description

Generic layout logic, handling a hierarchy of varying formulas. Unless callers have more specific needs they probably wish to use this abstraction. Attempts to follow the CSS specs. See boxLayout for a main entrypoint, & CSS to receive CSS input.

Synopsis

Documentation

data LayoutItem m n x Source #

A tree of different layout algorithms. More to come...

Constructors

LayoutFlow x (PaddedBox m n) [LayoutItem m n x]

A block element. With margins, borders, & padding.

LayoutGrid x (Grid m n) [GridItem] [LayoutItem m n x]

A grid or table element.

LayoutInline x (Paragraph (UserData m n x)) PageOptions

Some richtext. (Balkón holds children)

LayoutInline' x (ParagraphLayout (UserData m n x)) PageOptions

Results laying out richtext, has fixed width. Generated from LayoutInline for the sake of pagination.

LayoutConst x (PaddedBox m n) [LayoutItem m n x]

A branch with constant bounding box. Generated from LayoutInline when attaching position info.

LayoutSpan (FragmentTree (UserData m n x))

Children of a LayoutInline or LayoutInline`.

type UserData m n x = ((Font', Int), PaddedBox m n, x) Source #

Additional data routed through Balkon.

layoutGetChilds :: (CastDouble m, CastDouble n, Eq m, Eq n, Eq x) => LayoutItem m n x -> [LayoutItem m n x] Source #

Retrieve the subtree under a node.

layoutGetInner :: LayoutItem m n c -> c Source #

Retrieve the caller-specified data attached to a layout node.

boxMinWidth :: (Zero y, CastDouble y) => Maybe Double -> LayoutItem y Length x -> LayoutItem y Length x Source #

Update a (sub)tree to compute & cache minimum legible sizes.

boxMaxWidth :: CastDouble y => PaddedBox a Double -> LayoutItem y Length x -> LayoutItem y Length x Source #

Update a (sub)tree to compute & cache maximum legible width.

boxNatWidth :: (Zero y, CastDouble y) => Maybe Double -> LayoutItem y Length x -> LayoutItem y Length x Source #

Update a (sub)tree to compute & cache ideal width.

boxWidth :: (Zero y, CastDouble y) => PaddedBox b Double -> LayoutItem y Length x -> LayoutItem y Double x Source #

Update a (sub)tree to compute & cache final width.

boxNatHeight :: Double -> LayoutItem Length Double x -> LayoutItem Length Double x Source #

Update a (sub)tree to compute & cache ideal legible height.

boxMinHeight :: Double -> LayoutItem Length Double x -> LayoutItem Length Double x Source #

Update a (sub)tree to compute & cache minimum legible height.

boxMaxHeight :: PaddedBox Double Double -> LayoutItem Length Double x -> LayoutItem Length Double x Source #

Update a subtree to compute & cache maximum legible height.

boxHeight :: PaddedBox Double Double -> LayoutItem Length Double x -> LayoutItem Double Double x Source #

Update a (sub)tree to compute & cache final height.

boxSplit :: PropertyParser x => Double -> Double -> LayoutItem Double Double x -> (LayoutItem Double Double x, Maybe (LayoutItem Double Double x)) Source #

Split a (sub)tree to fit within max-height. May take full page height into account.

boxPaginate :: PropertyParser x => Double -> LayoutItem Double Double x -> [LayoutItem Double Double x] Source #

Generate a list of pages from a node, splitting subtrees where necessary.

boxPosition :: (PropertyParser x, Eq x) => (Double, Double) -> LayoutItem Double Double x -> LayoutItem Double Double ((Double, Double), x) Source #

Compute position of all nodes in the (sub)tree relative to a base coordinate.

boxLayout :: (PropertyParser x, Eq x) => PaddedBox Double Double -> LayoutItem Length Length x -> Bool -> [LayoutItem Double Double ((Double, Double), x)] Source #

Compute sizes & position information for all nodes in the (sub)tree.