Copyright | (c) Paul Schnapp 2023 |
---|---|
License | BSD3 |
Maintainer | Paul Schnapp <paul.schnapp@gmail.com> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
A typeclass which any visual component made by you should implement; related datatypes.
Synopsis
- class Monad m => Component k m where
- requiredWidth :: k -> m (Maybe Int)
- requiredHeight :: k -> m (Maybe Int)
- data ComponentInfo k = ComponentInfo {
- boundsOf :: Bounds
- componentOf :: k
- renderGroupOf :: RenderGroup
- type RenderGroup = Maybe Int
- data Bounds = Bounds {}
- class HasBoundingGuides a where
- boundingGuidesFor :: Layout -> a -> [Int]
- boundingGuidesInCSSOrderFor :: HasBoundingGuides a => Layout -> a -> [Int]
Documentation
class Monad m => Component k m where Source #
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.
Nothing
requiredWidth :: k -> m (Maybe Int) Source #
The width the component requires on-screen, if any.
The default implementation returns Nothing
.
requiredHeight :: k -> m (Maybe Int) Source #
The height the compnent requires on-screen, if any.
The default implementation returns Nothing
.
Instances
Monad m => Component k m Source # | A convenience instance for components that have no width or height requirements. |
Defined in FULE.Component requiredWidth :: k -> m (Maybe Int) Source # requiredHeight :: k -> m (Maybe Int) Source # | |
Monad m => Component (Reactor i ogadt m) m Source # | |
Defined in FULE.Reactor | |
Monad m => Component (Reactor' i ogadt m) m Source # | |
Defined in FULE.Reactor |
data ComponentInfo k Source #
Meta info about a component along with the component itself.
ComponentInfo | |
|
Instances
Functor ComponentInfo Source # | |
Defined in FULE.Component fmap :: (a -> b) -> ComponentInfo a -> ComponentInfo b # (<$) :: a -> ComponentInfo b -> ComponentInfo a # | |
HasBoundingGuides (ComponentInfo k) Source # | |
Defined in FULE.Component boundingGuidesFor :: Layout -> ComponentInfo k -> [Int] Source # | |
Show k => Show (ComponentInfo k) Source # | |
Defined in FULE.Component showsPrec :: Int -> ComponentInfo k -> ShowS # show :: ComponentInfo k -> String # showList :: [ComponentInfo k] -> ShowS # | |
NFData k => NFData (ComponentInfo k) Source # | |
Defined in FULE.Component rnf :: ComponentInfo k -> () # |
type RenderGroup = Maybe Int Source #
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.)
A collection of Guides representing the bounding rectangle of a visual component.
Bounds | |
|
class HasBoundingGuides a where Source #
A typeclass for retrieving Guides representing a bounding rectangle.
boundingGuidesFor :: Layout -> a -> [Int] Source #
Retrieves the bounding Guides for a type in the order: top, left, right, bottom.
Instances
HasBoundingGuides Bounds Source # | |
Defined in FULE.Component | |
HasBoundingGuides (ComponentInfo k) Source # | |
Defined in FULE.Component boundingGuidesFor :: Layout -> ComponentInfo k -> [Int] Source # |
boundingGuidesInCSSOrderFor :: HasBoundingGuides a => Layout -> a -> [Int] Source #
Retrieves the bounding Guides for a type in CSS-order: top, right, bottom, left.