Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Datastructures representing the CSS box model, & utilities for operating on them.
Synopsis
- data Border m n = Border {}
- mapX :: (n -> nn) -> Border m n -> Border m nn
- mapY :: (m -> mm) -> Border m n -> Border mm n
- data Size m n = Size {}
- mapSizeX :: (n -> nn) -> Size m n -> Size m nn
- mapSizeY :: (m -> mm) -> Size m n -> Size mm n
- data PaddedBox m n = PaddedBox {}
- zeroBox :: PaddedBox Double Double
- lengthBox :: PaddedBox Length Length
- mapX' :: (n -> nn) -> PaddedBox m n -> PaddedBox m nn
- mapY' :: (m -> mm) -> PaddedBox m n -> PaddedBox mm n
- width :: Num a => PaddedBox m a -> a
- height :: Num a => PaddedBox a n -> a
- minWidth :: Num a => PaddedBox m a -> a
- minHeight :: Num a => PaddedBox a n -> a
- maxWidth :: Num a => PaddedBox m a -> a
- maxHeight :: Num a => PaddedBox a n -> a
- leftSpace :: Num a => PaddedBox m a -> a
- rightSpace :: Num a => PaddedBox m a -> a
- topSpace :: Num a => PaddedBox a n -> a
- bottomSpace :: Num a => PaddedBox a n -> a
- hSpace :: Num a => PaddedBox m a -> a
- vSpace :: Num a => PaddedBox a n -> a
- data Length
- mapAuto :: Double -> Length -> Length
- lowerLength :: Double -> Length -> Double
- class Zero a where
- zero :: a
- class CastDouble a where
- fromDouble :: Double -> a
- toDouble :: a -> Double
Documentation
Amount of space surrounding the box.
Instances
Generic (Border m n) Source # | |
(Read m, Read n) => Read (Border m n) Source # | |
(Show m, Show n) => Show (Border m n) Source # | |
(Zero m, Zero n) => Zero (Border m n) Source # | |
Defined in Graphics.Layout.Box | |
(NFData m, NFData n) => NFData (Border m n) Source # | |
Defined in Graphics.Layout.Box | |
(Eq m, Eq n) => Eq (Border m n) Source # | |
type Rep (Border m n) Source # | |
Defined in Graphics.Layout.Box type Rep (Border m n) = D1 ('MetaData "Border" "Graphics.Layout.Box" "cattrap-0.3.1.0-inplace" 'False) (C1 ('MetaCons "Border" 'PrefixI 'True) ((S1 ('MetaSel ('Just "top") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 m) :*: S1 ('MetaSel ('Just "bottom") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 m)) :*: (S1 ('MetaSel ('Just "left") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 n) :*: S1 ('MetaSel ('Just "right") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 n)))) |
mapX :: (n -> nn) -> Border m n -> Border m nn Source #
Convert horizontal spacing via given callback.
2D size of a box. Typically inline is width & block is height. This may change as support for vertical layout is added.
Instances
Generic (Size m n) Source # | |
(Read n, Read m) => Read (Size m n) Source # | |
(Show n, Show m) => Show (Size m n) Source # | |
(NFData m, NFData n) => NFData (Size m n) Source # | |
Defined in Graphics.Layout.Box | |
(Eq n, Eq m) => Eq (Size m n) Source # | |
type Rep (Size m n) Source # | |
Defined in Graphics.Layout.Box type Rep (Size m n) = D1 ('MetaData "Size" "Graphics.Layout.Box" "cattrap-0.3.1.0-inplace" 'False) (C1 ('MetaCons "Size" 'PrefixI 'True) (S1 ('MetaSel ('Just "inline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 n) :*: S1 ('MetaSel ('Just "block") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 m))) |
A box with min & max bounds & surrounding borders. The CSS Box Model.
PaddedBox | |
|
Instances
lengthBox :: PaddedBox Length Length Source #
A box which takes up all available space with no borders.
mapX' :: (n -> nn) -> PaddedBox m n -> PaddedBox m nn Source #
Convert all sizes along the inline axis via given callback.
mapY' :: (m -> mm) -> PaddedBox m n -> PaddedBox mm n Source #
Convert all sizes along the block axis via given callback.
width :: Num a => PaddedBox m a -> a Source #
The total size along the inline axis including borders, etc.
height :: Num a => PaddedBox a n -> a Source #
The total size along the block axis, including borders, etc.
rightSpace :: Num a => PaddedBox m a -> a Source #
bottomSpace :: Num a => PaddedBox a n -> a Source #
A partially-computed length value.
Pixels Double | Absolute number of device pixels. |
Percent Double | Multiplier by container width. |
Auto | Use normal layout computations. |
Preferred | Use computed preferred width. |
Min | Use minimum legible width. |
Instances
Generic Length Source # | |
Read Length Source # | |
Show Length Source # | |
CastDouble Length Source # | |
Zero Length Source # | |
Defined in Graphics.Layout.Box | |
NFData Length Source # | |
Defined in Graphics.Layout.Box | |
Eq Length Source # | |
type Rep Length Source # | |
Defined in Graphics.Layout.Box type Rep Length = D1 ('MetaData "Length" "Graphics.Layout.Box" "cattrap-0.3.1.0-inplace" 'False) ((C1 ('MetaCons "Pixels" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)) :+: C1 ('MetaCons "Percent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double))) :+: (C1 ('MetaCons "Auto" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Preferred" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Min" 'PrefixI 'False) (U1 :: Type -> Type)))) |
mapAuto :: Double -> Length -> Length Source #
Replace keywords with a given number of pixels. Useful for avoiding messing up percentage calculations in later processing.
lowerLength :: Double -> Length -> Double Source #
Convert a length given the container's width. Filling in 0 for keywords. If you wish for keywords to be handled differently, callers need to compute that themselves.
Instances
Zero Length Source # | |
Defined in Graphics.Layout.Box | |
Zero Unitted Source # | |
Defined in Graphics.Layout.CSS.Length | |
Zero Double Source # | |
Defined in Graphics.Layout.Box | |
(Zero m, Zero n) => Zero (Border m n) Source # | |
Defined in Graphics.Layout.Box | |
(Zero m, Zero n) => Zero (PaddedBox m n) Source # | |
Defined in Graphics.Layout.Box |
class CastDouble a where Source #
fromDouble :: Double -> a Source #
Convert a double to a double or length.
toDouble :: a -> Double Source #
Convert a double or length to a double.