-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Functional UI Layout Engine -- -- Please see the README on GitHub at -- https://github.com/pschnapp/FULE#readme @package FULE @version 0.3.0 -- | The Orientation datatype is used to specify the visual -- orientation of an element. module FULE.Container.Config.Orientation -- | Layout orientation, used in multiple Containers. data Orientation Horizontal :: Orientation Vertical :: Orientation instance Control.DeepSeq.NFData FULE.Container.Config.Orientation.Orientation -- | Datatype and functions for specifying visual padding. module FULE.Container.Config.Padding -- | Visual padding around an element. type Padding = (Int, Int) -- | Padding to use; see parameters for details. padding :: Int -> Int -> Padding -- | Don't use any padding. noPadding :: Padding -- | Datatype and functions for specifying the size of content. module FULE.Container.Config.SizedContent -- | The size that the sized portion of a container should have; see the -- Divided container for an example use. type SizedContentSize a = Maybe a -- | Use a set size for the sized portion of a container. sizedTo :: a -> SizedContentSize a -- | Use the inherent size of the content for the sized portion of a -- container. sizedToContents :: SizedContentSize a -- | Configuration types that are common across containers. module FULE.Container.Config module FULE.Internal.Sparse data Matrix a type Pos = (Int, Int) empty :: Matrix a eye :: Num a => Int -> Matrix a matrix :: (Int, Int) -> [(Pos, a)] -> Matrix a dims :: Matrix a -> (Int, Int) expandTo :: (Int, Int) -> Matrix a -> Matrix a get :: Num a => Pos -> Matrix a -> a set :: (Eq a, Num a) => Pos -> a -> Matrix a -> Matrix a del :: Pos -> Matrix a -> Matrix a count :: Matrix a -> Int add :: Num a => Matrix a -> Matrix a -> Matrix a sub :: Num a => Matrix a -> Matrix a -> Matrix a mul :: Num a => Matrix a -> Matrix a -> Matrix a star :: Num a => Matrix a -> Matrix a -> Matrix a filter :: (a -> Bool) -> Matrix a -> Matrix a instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (FULE.Internal.Sparse.Matrix a) instance (GHC.Num.Num a, GHC.Show.Show a) => GHC.Show.Show (FULE.Internal.Sparse.Matrix a) instance GHC.Base.Functor FULE.Internal.Sparse.Matrix module FULE.Internal.Util collapseTo :: ([a] -> b) -> [Maybe a] -> Maybe b getMaxSize :: [Maybe Int] -> Maybe Int getTotalSize :: [Maybe Int] -> Maybe Int -- | 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. module FULE.Layout -- | A Layout that is still under construction. Use the build -- function to turn a LayoutDesign into an elivened -- Layout. data LayoutDesign -- | Create a new LayoutDesign. emptyLayoutDesign :: LayoutDesign -- | An identifier for a Guide in a Layout or LayoutDesign. data GuideID -- | The type of a plastic dependency between two Guides. data PlasticDependencyType -- | Specifies that changes to the dependent Guide do not affect the -- reference Guide, but changes to the reference propagate to the -- dependent Guide. Asymmetric :: PlasticDependencyType -- | Specifies that changes to either Guide are applied to the other as -- well. Symmetric :: PlasticDependencyType -- | The specification of a Guide to be added to a LayoutDesign. A -- Guide may be added: -- -- -- -- See each constructor and its fields for more information. data GuideSpecification -- | Add a new Guide at an absolute position within the Layout. Absolute :: Int -> GuideSpecification -- | The position the new Guide should have in the Layout. Note -- this could be either an x or y position, the axis -- doesn't matter for the specification. [positionOf] :: GuideSpecification -> Int -- | Add a new Guide with a plastic dependence on a reference Guide. Relative :: Int -> GuideID -> PlasticDependencyType -> GuideSpecification -- | The offset from the reference Guide the new dependent Guide should -- have. [offsetOf] :: GuideSpecification -> Int -- | The ID of the reference Guide. [dependencyOf] :: GuideSpecification -> GuideID -- | The type of dependency the dependent Guide should have on the -- reference Guide. [dependencyTypeOf] :: GuideSpecification -> PlasticDependencyType -- | 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 Double arguments of the pairs below should sum to equal -- 1.0; this will not be checked. Between :: (GuideID, Double) -> (GuideID, Double) -> GuideSpecification -- | Add a new Guide to a LayoutDesign according to the given -- GuideSpecification. -- -- Returns an ID for the new Guide along with an updated -- LayoutDesign. addGuide :: GuideSpecification -> LayoutDesign -> (GuideID, LayoutDesign) -- | The type of constraint one Guide should have relative to another. data GuideConstraint -- | Constrain a Guide to be always less-than or equal-to another. LTE :: GuideID -> GuideID -> GuideConstraint -- | The Guide to constrain the movement of. [constrainedOf] :: GuideConstraint -> GuideID -- | The reference Guide to constrain movement relative to. [referenceOf] :: GuideConstraint -> GuideID -- | Constrain a Guide to be always greater-than or equal-to another. GTE :: GuideID -> GuideID -> GuideConstraint -- | The Guide to constrain the movement of. [constrainedOf] :: GuideConstraint -> GuideID -- | The reference Guide to constrain movement relative to. [referenceOf] :: GuideConstraint -> GuideID -- | Constrain the movement of one Guide relative to another. (Still -- slightly experimental.) -- -- Important Notes: -- -- addGuideConstraint :: GuideConstraint -> LayoutDesign -> LayoutDesign -- | A LayoutDesign that has been enlivened and can have its Guides -- queried or moved. data Layout -- | Create an enlivened Layout from a LayoutDesign. build :: LayoutDesign -> Layout -- | Transform a Layout back into a LayoutDesign. design :: Layout -> LayoutDesign -- | Get the position of a Guide within a Layout. getGuide :: GuideID -> Layout -> Int -- | Get the position of multiple Guides within a Layout. getGuides :: [GuideID] -> Layout -> [Int] -- | Move a Guide within a Layout. reactToChange :: GuideID -> Int -> Layout -> Layout -- | Move multiple Guides within a Layout. reactToChanges :: [(GuideID, Int)] -> Layout -> Layout instance GHC.Show.Show FULE.Layout.GuideID instance GHC.Read.Read FULE.Layout.GuideID instance GHC.Classes.Ord FULE.Layout.GuideID instance GHC.Classes.Eq FULE.Layout.GuideID instance GHC.Show.Show FULE.Layout.PlasticDependencyType instance GHC.Classes.Eq FULE.Layout.PlasticDependencyType instance GHC.Show.Show FULE.Layout.GuideConstraint instance GHC.Classes.Eq FULE.Layout.GuideConstraint instance Control.DeepSeq.NFData FULE.Layout.Layout instance GHC.Show.Show FULE.Layout.Layout instance Control.DeepSeq.NFData FULE.Layout.GuideID instance Control.DeepSeq.NFData FULE.Layout.LayoutDesign -- | A typeclass which any visual component made by you should implement; -- related datatypes. module FULE.Component -- | A typeclass for specifying the display requirements of a visual -- component. -- -- A default implementation has been provided meaning you may wish to -- have your instances use the {-# OVERLAPS #-} or {-# -- OVERLAPPING #-} pragmas. -- -- You'll need to have the MultiParamTypeClasses language -- extension enabled to implement this. class (Monad m) => Component k m -- | The width the component requires on-screen, if any. The default -- implementation returns Nothing. requiredWidth :: Component k m => k -> m (Maybe Int) -- | The height the compnent requires on-screen, if any. The default -- implementation returns Nothing. requiredHeight :: Component k m => k -> m (Maybe Int) -- | Meta info about a component along with the component itself. data ComponentInfo k ComponentInfo :: Bounds -> k -> RenderGroup -> ComponentInfo k -- | The bounding rectangle of the component. [boundsOf] :: ComponentInfo k -> Bounds -- | The component itself. [componentOf] :: ComponentInfo k -> k -- | The render group of the component. [renderGroupOf] :: ComponentInfo k -> RenderGroup -- | A convenience type-wrapper representing the rendering group a -- component is associated with. Rendering groups are tracked when -- multiple components overlap (in the z-axis) or are part of containers -- which overlap. (They are not used internally but are tracked as a -- convenience for the consumer.) type RenderGroup = Maybe Int -- | A collection of Guides representing the bounding rectangle of a visual -- component. data Bounds Bounds :: GuideID -> GuideID -> GuideID -> GuideID -> Maybe Bounds -> Bounds -- | The Guide representing the top edge of the bounding rectangle. [topOf] :: Bounds -> GuideID -- | The Guide representing the left edge of the bounding rectangle. [leftOf] :: Bounds -> GuideID -- | The Guide representing the right edge of the bounding -- rectangle. [rightOf] :: Bounds -> GuideID -- | The Guide representing the bottom edge of the bounding -- rectangle. [bottomOf] :: Bounds -> GuideID -- | Another Bounds which may cause this one to clip. [clippingOf] :: Bounds -> Maybe Bounds -- | A typeclass for retrieving Guides representing a bounding rectangle. class HasBoundingGuides a -- | Retrieves the bounding Guides for a type in the order: top, -- left, right, bottom. boundingGuidesFor :: HasBoundingGuides a => Layout -> a -> [Int] -- | Retrieves the bounding Guides for a type in CSS-order: top, -- right, bottom, left. boundingGuidesInCSSOrderFor :: HasBoundingGuides a => Layout -> a -> [Int] instance GHC.Show.Show FULE.Component.Bounds instance GHC.Read.Read FULE.Component.Bounds instance GHC.Show.Show k => GHC.Show.Show (FULE.Component.ComponentInfo k) instance GHC.Base.Functor FULE.Component.ComponentInfo instance FULE.Component.HasBoundingGuides FULE.Component.Bounds instance FULE.Component.HasBoundingGuides (FULE.Component.ComponentInfo k) instance Control.DeepSeq.NFData k => Control.DeepSeq.NFData (FULE.Component.ComponentInfo k) instance Control.DeepSeq.NFData FULE.Component.Bounds instance GHC.Base.Monad m => FULE.Component.Component k m -- | Operations for constructing a LayoutDesign. module FULE.LayoutOp -- | An operation that will produce a LayoutDesign and a list of -- components of type k in the monad m. type LayoutOp k m = StateT LayoutOpState (WriterT [ComponentInfo k] m) -- | Internal. data LayoutOpState -- | Run a LayoutOp to create a LayoutDesign and a list of -- components of type k. runLayoutOp :: Monad m => LayoutOp k m () -> m (LayoutDesign, [ComponentInfo k]) -- | Add a Guide to the LayoutDesign. addGuideToLayout :: Monad m => GuideSpecification -> LayoutOp k m GuideID -- | Add a Guide constraint to the LayoutDesign. addGuideConstraintToLayout :: Monad m => GuideConstraint -> LayoutOp k m () -- | Get the next available render group from the LayoutOp state and -- advance to the next one internally. nextRenderGroup :: Monad m => LayoutOp k m Int -- | A typeclass for creating containers of visual content. module FULE.Container -- | A typeclass for laying-out a container of type c that holds -- content of type k. -- -- You'll need to have the FlexibleInstances and -- MultiParamTypeClasses language extensions enabled to use this -- and you may wish to have your instance use the {-# OVERLAPS -- #-} or {-# OVERLAPPING #-} pragmas. class (Monad m) => Container c k m -- | Get the minimum width required for display of the container -- c. minWidth :: Container c k m => c -> Proxy k -> m (Maybe Int) -- | Get the minimum height required for display of the container -- c. minHeight :: Container c k m => c -> Proxy k -> m (Maybe Int) -- | Add the container c and its contents k to a -- LayoutDesign. addToLayout :: Container c k m => c -> Proxy k -> Bounds -> RenderGroup -> LayoutOp k m () instance FULE.Component.Component k m => FULE.Container.Container k k m -- | This module contains Window, the base Conatiner for -- all layouts, and the layout and layoutM functions -- for building a Layout from it. module FULE.Container.Window -- | The base container of any (non-custom) Layout representing the -- window in the encompassing GUI framework. It is the only container -- that can be used with the layout and layoutM functions -- to build a Layout. data Window c k -- | Type of a function to produce a Component to adjust the -- Layout in response to a change in the size of the window in the -- encompassing GUI framework. The Component should use the -- Guides passed as arguments to this function to update the -- Layout. type WindowAdjustorGen k = -- | The Guide to use to adjust the /width/ of the 'FULE.Layout' in response -- to a change in the window size. Adjustments should be made using the delta -- of the old and new sizes. GuideID -> -- | The Guide to use to adjust the /height/ of the 'FULE.Layout' in response -- to a change in the window size. Adjustments should be made using the delta -- of the old and new sizes. GuideID -> k -- | Create a Window. window :: (Int, Int) -> WindowAdjustorGen k -> c -> Window c k -- | Build a layout for a Window in the specified monad m. layoutM :: Container c k m => Window c k -> m (Layout, [ComponentInfo k]) -- | Build a layout for a Window in the Identity monad. layout :: Container c k Identity => Window c k -> (Layout, [ComponentInfo k]) -- | A Container to remove dimension info from content when it's -- considered during the layout process. -- -- To add size to content, see the Sized container. module FULE.Container.Unreckoned -- | A container complementary to Sized: whereas Sized -- specifies a size for content which may or may not already have one, -- Unreckoned removes size associated with content as it -- is reckoned in the layout. This allows for content to overflow its -- bounds as far as the layout is concerned. -- -- The Bounds in the ComponentInfo for a Component -- which is Unreckoned will match the overflowing size of the -- Component even though the size was not taken into account -- during the layout process itself. data Unreckoned c -- | Elide the horizontal size of the content. unreckonedHoriz :: c -> Unreckoned c -- | Elide the verital size of the content. unreckonedVert :: c -> Unreckoned c -- | Elide all sizes associated with the content. unreckoned :: c -> Unreckoned c instance FULE.Container.Container c k m => FULE.Container.Container (FULE.Container.Unreckoned.Unreckoned c) k m -- | A Container to specify or override the (inherent) size of -- content. -- -- To remove the size of content from consideration during the -- layout process see the Unreckoned container. module FULE.Container.Sized -- | A container which specifies or overrides the size of content in the -- layout. data Sized c -- | Add or override the horizontal size of the content. sizedHoriz :: Int -> c -> Sized c -- | Add or override the vertical size of the content. sizedVert :: Int -> c -> Sized c -- | Add or override the size of the content in both dimensions. sized :: (Int, Int) -> c -> Sized c instance FULE.Container.Container c k m => FULE.Container.Container (FULE.Container.Sized.Sized c) k m -- | A Container to position content relative to its parent -- container, including in the center. module FULE.Container.Positioned -- | A container for positioning content within a larger container in one -- of nine positions relative to the parent. Relative positioning will -- adjust to keep up with changes to the size of the parent container. data Positioned c -- | Position content in the top-left corner of its parent -- container. topLeft :: c -> Positioned c -- | Position content in the middle of the top side of its parent -- container. topMiddle :: c -> Positioned c -- | Position content in the top-right corner of its parent -- container. topRight :: c -> Positioned c -- | Position content in the middle of the left side of its parent -- container. middleLeft :: c -> Positioned c -- | Position content in the very center of its parent container. centered :: c -> Positioned c -- | Position content in the middle of the right side of its parent -- container. middleRight :: c -> Positioned c -- | Position content in the bottom-left corner of its parent -- container. bottomLeft :: c -> Positioned c -- | Position content in the middle of the bottom side of its parent -- container. bottomMiddle :: c -> Positioned c -- | Position content in the bottom-right corner of its parent -- container. bottomRight :: c -> Positioned c instance FULE.Container.Container c k m => FULE.Container.Container (FULE.Container.Positioned.Positioned c) k m -- | A Container to add padding around content. module FULE.Container.Padded -- | A container with padding around the content. data Padded c -- | Create a container with padding around the content. padded :: Padding -> c -> Padded c instance FULE.Container.Container c k m => FULE.Container.Container (FULE.Container.Padded.Padded c) k m -- | A wrapper for heterogenous content to be used by other -- Containers. module FULE.Container.Item -- | A container for heterogenous items. This container lets items of -- different types be used in the same aggregating container, like -- ArrayedM, GridM, or LayeredM. -- -- When using ItemM you'll likely need to: -- -- -- -- For example: -- --
--   {-# LANGUAGE ScopedTypeVariables #-}
--   
--   import FULE
--   
--   ...
--   
--   someFn :: forall m => m (ArrayedM m Widget)
--   someFn = return $
--     arrayedHoriz noPadding
--       ([item someWidget
--       , item someContainer
--       , item someOtherWidget
--       ]::[ItemM m Widget])
--   
-- -- Reference: Heterogenous Collections data ItemM m k -- | Like ItemM but run in the Identity monad. type Item = ItemM Identity -- | Create an ItemM with a heterogenous item. item :: Container c k m => c -> ItemM m k instance GHC.Base.Monad m => FULE.Container.Container (FULE.Container.Item.ItemM m k) k m -- | A Container to layer multiple items within the same -- Bounds. module FULE.Container.Layered -- | This container layers multiple visual ItemMs within the same -- bounding rectangle, one on top of the other. Z-ordering is not really -- taken into account since that depends on how you are using the layout -- output, but the ItemMs will appear in the output of -- runLayoutOp in the same order in which they're passed to the -- layered function. data LayeredM m k -- | Like LayeredM but run in the Identity monad. type Layered = LayeredM Identity -- | Layer ItemMs within the same bounding rectangle. layered :: [ItemM m k] -> LayeredM m k instance GHC.Base.Monad m => FULE.Container.Container (FULE.Container.Layered.LayeredM m k) k m -- | A two-dimensional grid of items, evenly spaced. -- -- You may also wish to consider the Arrayed Container. module FULE.Container.Grid -- | A two-dimensional grid of visual ItemMs, evenly spaced. data GridM m k -- | Like GridM but run in the Identity monad. type Grid = GridM Identity -- | Create a GridM of ItemMs. grid :: (Int, Int) -> [ItemM m k] -> GridM m k instance GHC.Base.Monad m => FULE.Container.Container (FULE.Container.Grid.GridM m k) k m -- | A Container that is divided in half, horizontally or -- vertically. module FULE.Container.Divided -- | A container divided (horizontally or vertically) into two parts with -- one of the parts having a set size (height or width) and the other -- part resizing dynamically. -- -- When configured to be resizable, the resize bar's size is not included -- in the size of the sized content during layout but is treated as an -- additional size to be considered. data Divided s b u -- | Type of a function to produce a Component for controlling the -- resize bar, thus leaving the mechanics and presentation up to you. type BarControlGen b = -- | The orientation of the resize bar; a @Horizontal@ orientation would call -- for vertical movement, so should be paired with watching for changes in -- the @y@ axis, and likewise with @Vertical@ and the @x@ axis. Orientation -> -- | A Guide associated with the resize bar that should be updated with a -- delta when the bar is moved. GuideID -> -- | The bar component to be added to the layout. b -- | A specification of whether the sized portion of the container should -- be resizable and how the resize bar, if any, should be sized and -- controlled. data Dynamics b -- | Use a dynamic sizing, with a resize bar, for the sized portion of the -- container. dynamic :: BarControlGen b -> Int -> Dynamics b -- | Use a static size for the sized portion of the container. static :: Dynamics b -- | Create a Divided container with the top portion having a -- particular size. sizedTop :: SizedContentSize Int -> Dynamics b -> s -> u -> Divided s b u -- | Create a Divided container with the left portion having a -- particular size. sizedLeft :: SizedContentSize Int -> Dynamics b -> s -> u -> Divided s b u -- | Create a Divided container with the right portion having a -- particular size. sizedRight :: SizedContentSize Int -> Dynamics b -> s -> u -> Divided s b u -- | Create a Divided container with the bottom portion having a -- particular size. sizedBottom :: SizedContentSize Int -> Dynamics b -> s -> u -> Divided s b u instance (FULE.Container.Container s b m, FULE.Container.Container u b m) => FULE.Container.Container (FULE.Container.Divided.Divided s b u) b m -- | A Container to specify that content overflow should be clipped. module FULE.Container.Clipped -- | A container the content of which should be clipped on overflow. -- Clipping bounds are specified as part of Bounds of contained -- Components. -- -- It is up to you the consumer to implement the actual clipping of -- content. data Clipped c -- | Create a container which clips any overflow. clipped :: c -> Clipped c instance FULE.Container.Container c k m => FULE.Container.Container (FULE.Container.Clipped.Clipped c) k m -- | A Container to display items one after another, either -- vertically or horizontally. Items are spaced according to their -- inherent sizes. -- -- You may also wish to consider a Grid. module FULE.Container.Arrayed -- | An array (horizontal or vertical) of visual ItemMs in a layout. -- Each item will occupy a different amount of space in the array; if you -- wish each item to be evenly spaced, use a Grid instead. data ArrayedM m k -- | Like ArrayedM but run in the Identity monad. type Arrayed = ArrayedM Identity -- | Array ItemMs horizontally with the specified padding. -- -- Padding is added between the elements and around the perimeter of the -- array; the horizontal padding is added once between elements, and the -- same padding is used before and after the array -- thus the -- intra-element padding is not double the outside padding. arrayedHoriz :: Padding -> [ItemM m k] -> ArrayedM m k -- | Array ItemMs vertically with the specified padding. -- -- Padding is added between the elements and around the perimeter of the -- array; the vertical padding is added once between elements, and the -- same padding is used before and after the array -- thus the -- intra-element padding is not double the outside padding. arrayedVert :: Padding -> [ItemM m k] -> ArrayedM m k instance GHC.Base.Monad m => FULE.Container.Container (FULE.Container.Arrayed.ArrayedM m k) k m -- | This is the full library, just import this module. module FULE