| Copyright | (c) Paul Schnapp 2023 |
|---|---|
| License | BSD3 |
| Maintainer | Paul Schnapp <paul.schnapp@gmail.com> |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
FULE.Layout
Description
This is the basic, low-level layout functionality.
You'll start by creating a LayoutDesign and then make a usable
Layout from it by building it.
Synopsis
- data LayoutDesign
- emptyLayoutDesign :: LayoutDesign
- data GuideID
- data PlasticDependencyType
- data GuideSpecification
- addGuide :: GuideSpecification -> LayoutDesign -> (GuideID, LayoutDesign)
- data GuideConstraint
- addGuideConstraint :: GuideConstraint -> LayoutDesign -> LayoutDesign
- data Layout
- build :: LayoutDesign -> Layout
- design :: Layout -> LayoutDesign
- getGuide :: GuideID -> Layout -> Int
- getGuides :: [GuideID] -> Layout -> [Int]
- reactToChange :: GuideID -> Int -> Layout -> Layout
- reactToChanges :: [(GuideID, Int)] -> Layout -> Layout
Documentation
data LayoutDesign Source #
A Layout that is still under construction.
Use the build function to turn a LayoutDesign into an elivened Layout.
Instances
| NFData LayoutDesign Source # | |
Defined in FULE.Layout Methods rnf :: LayoutDesign -> () # | |
emptyLayoutDesign :: LayoutDesign Source #
Create a new LayoutDesign.
An identifier for a Guide in a Layout or LayoutDesign.
data PlasticDependencyType Source #
The type of a plastic dependency between two Guides.
Constructors
| Asymmetric | Specifies that changes to the dependent Guide do not affect the reference Guide, but changes to the reference propagate to the dependent Guide. |
| Symmetric | Specifies that changes to either Guide are applied to the other as well. |
Instances
| Show PlasticDependencyType Source # | |
Defined in FULE.Layout Methods showsPrec :: Int -> PlasticDependencyType -> ShowS # show :: PlasticDependencyType -> String # showList :: [PlasticDependencyType] -> ShowS # | |
| Eq PlasticDependencyType Source # | |
Defined in FULE.Layout Methods (==) :: PlasticDependencyType -> PlasticDependencyType -> Bool # (/=) :: PlasticDependencyType -> PlasticDependencyType -> Bool # | |
data GuideSpecification Source #
The specification of a Guide to be added to a LayoutDesign.
A Guide may be added:
- at an absolute position within the design
- relative to a reference Guide within the design with a plastic dependencey upon the reference
- relative to two reference Guides within the design with an elastic dependency upon both
See each constructor and its fields for more information.
Constructors
| Absolute | Add a new Guide at an absolute position within the |
Fields
| |
| Relative | Add a new Guide with a plastic dependence on a reference Guide. |
Fields
| |
| Between | Add a new Guide between two other Guides with an elastic dependency on them: Whenever one of the reference Guides moves the dependent Guide will be moved to remain positioned relatively between them. The |
addGuide :: GuideSpecification -> LayoutDesign -> (GuideID, LayoutDesign) Source #
Add a new Guide to a LayoutDesign according to the given GuideSpecification.
Returns an ID for the new Guide along with an updated LayoutDesign.
data GuideConstraint Source #
The type of constraint one Guide should have relative to another.
Constructors
| LTE | Constrain a Guide to be always less-than or equal-to another. |
Fields
| |
| GTE | Constrain a Guide to be always greater-than or equal-to another. |
Fields
| |
Instances
| Show GuideConstraint Source # | |
Defined in FULE.Layout Methods showsPrec :: Int -> GuideConstraint -> ShowS # show :: GuideConstraint -> String # showList :: [GuideConstraint] -> ShowS # | |
| Eq GuideConstraint Source # | |
Defined in FULE.Layout Methods (==) :: GuideConstraint -> GuideConstraint -> Bool # (/=) :: GuideConstraint -> GuideConstraint -> Bool # | |
addGuideConstraint :: GuideConstraint -> LayoutDesign -> LayoutDesign Source #
Constrain the movement of one Guide relative to another. (Still slightly experimental.)
Important Notes:
- Never constrain a Guide against itself
- A Guide should be used only once as the constrainee (first argument) for a given constraint-type
- The above conditions will not be checked!
- If a guide depends on multiple other guides that are simultaneously affected by constraints, things may go a bit wonky, just sayin'.
A LayoutDesign that has been enlivened and can have its Guides queried or
moved.
build :: LayoutDesign -> Layout Source #
Create an enlivened Layout from a LayoutDesign.
design :: Layout -> LayoutDesign Source #
Transform a Layout back into a LayoutDesign.
getGuides :: [GuideID] -> Layout -> [Int] Source #
Get the position of multiple Guides within a Layout.