monomer-1.0.0.0: A GUI library for writing native Haskell applications.
Copyright(c) 2018 Francisco Vallarino
LicenseBSD-3-Clause (see the LICENSE file)
Maintainerfjvallarino@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Monomer.Core.SizeReq

Description

Helper functions creating, validating and merging size requirements.

Synopsis

Documentation

type SizeReqUpdater = (SizeReq, SizeReq) -> (SizeReq, SizeReq) Source #

Transforms a SizeReq pair by applying an arbitrary operation.

clearExtra :: SizeReqUpdater Source #

Clears the extra field of a SizeReq.

sizeReqBounded :: SizeReq -> Double -> Double -> Double Source #

Returns a bounded value by the SizeReq, starting from value and offset.

sizeReqValid :: SizeReq -> Double -> Double -> Bool Source #

Checks that value, given an offset, matches a SizeReq.

sizeReqAddStyle :: StyleState -> (SizeReq, SizeReq) -> (SizeReq, SizeReq) Source #

Adds border/padding size to a SizeReq pair.

sizeReqMin :: SizeReq -> Double Source #

Returns the minimum valid value for a SizeReq.

sizeReqMax :: SizeReq -> Double Source #

Returns the maximum valid value for a SizeReq. This can be unbounded if extra field is not zero.

sizeReqMaxBounded :: SizeReq -> Double Source #

Returns the maximum, bounded, valid value for a SizeReq. Extra is ignored.

sizeReqFixed :: SizeReq -> Double Source #

Returns the fixed size of a SizeReq.

sizeReqFlex :: SizeReq -> Double Source #

Returns the flex size of a SizeReq.

sizeReqExtra :: SizeReq -> Double Source #

Returns the extra size of a SizeReq.

sizeReqFactor :: SizeReq -> Double Source #

Returns the resize factor of a SizeReq.

sizeReqMergeSum :: SizeReq -> SizeReq -> SizeReq Source #

Sums two SizeReqs. This is used for combining two widgets one after the other, summing their sizes.

The fixed, flex and extra fields are summed individually, while the max factor is kept.

sizeReqMergeMax :: SizeReq -> SizeReq -> SizeReq Source #

Merges two SizeReqs. This is used for combining two widgets by keeping the largest size requirement.

Fields are combined in order to first satisfy fixed requirements, adapting flex if one of the fixed provided more space than required. For both extra and factor the largest value is kept.