| Copyright | (c) Paul Schnapp 2023 |
|---|---|
| License | BSD3 |
| Maintainer | Paul Schnapp <paul.schnapp@gmail.com> |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
FULE.Component
Description
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.
Minimal complete definition
Nothing
Methods
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
data ComponentInfo k Source #
Meta info about a component along with the component itself.
Constructors
| ComponentInfo | |
Fields
| |
Instances
| Functor ComponentInfo Source # | |
Defined in FULE.Component Methods fmap :: (a -> b) -> ComponentInfo a -> ComponentInfo b # (<$) :: a -> ComponentInfo b -> ComponentInfo a # | |
| HasBoundingGuides (ComponentInfo k) Source # | |
Defined in FULE.Component Methods boundingGuidesFor :: Layout -> ComponentInfo k -> [Int] Source # | |
| Show k => Show (ComponentInfo k) Source # | |
Defined in FULE.Component Methods showsPrec :: Int -> ComponentInfo k -> ShowS # show :: ComponentInfo k -> String # showList :: [ComponentInfo k] -> ShowS # | |
| NFData k => NFData (ComponentInfo k) Source # | |
Defined in FULE.Component Methods 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.
Constructors
| Bounds | |
Fields
| |
class HasBoundingGuides a where Source #
A typeclass for retrieving Guides representing a bounding rectangle.
Methods
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 Methods 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.