| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
NanoUI.Layout.Solve
Description
The layout solver: measures and places the node arena's flow tree, then positions modals, windows and popups.
Synopsis
- solveLayout :: NodeArena -> Measurers -> Float -> Float -> IO ()
- type FontResolver = Float -> FontWeight -> FontStyle -> FontVariant -> IO (FontMetrics, Text -> IO (Float, Float))
- data Measurers = Measurers {
- msFm :: !FontMetrics
- msMonoFm :: !FontMetrics
- msMeasure :: !(Text -> IO (Float, Float))
- msResolveFont :: !FontResolver
- msLookupMeasure :: !(WidgetId -> IO (Maybe CustomMeasureFn))
- placeModals :: NodeArena -> Measurers -> Float -> Float -> IO ()
- placeWindows :: NodeArena -> Measurers -> Float -> Float -> (WidgetId -> IO (Maybe (Float, Float))) -> (WidgetId -> IO (Maybe (Float, Float))) -> IO ()
- placePopups :: NodeArena -> Measurers -> Float -> Float -> (WidgetId -> IO (Maybe (PopupAnchor, PopupPlacement, Float))) -> IO ()
- computePopupPosition :: Float -> Float -> Float -> Float -> Float -> PopupAnchor -> PopupPlacement -> Float -> (Float, Float)
- placeWindowNode :: NodeArena -> Measurers -> Float -> Float -> NodeIdx -> Float -> Float -> (Float -> (Float, Float)) -> IO ()
- scrollBarSlotOf :: NodeArena -> NodeIdx -> IO ScrollBarSlot
- findAncestorMaxW :: NodeArena -> NodeIdx -> IO Float
- textWrapCap :: Float -> SizingTag -> Float -> Float
Documentation
type FontResolver = Float -> FontWeight -> FontStyle -> FontVariant -> IO (FontMetrics, Text -> IO (Float, Float)) Source #
How text and custom widgets are measured. The solve and the placement of floating nodes after it measure with the same, so a label placed in a modal wraps exactly as the solve measured it for the modal's size.
Constructors
| Measurers | |
Fields
| |
placeWindows :: NodeArena -> Measurers -> Float -> Float -> (WidgetId -> IO (Maybe (Float, Float))) -> (WidgetId -> IO (Maybe (Float, Float))) -> IO () Source #
placePopups :: NodeArena -> Measurers -> Float -> Float -> (WidgetId -> IO (Maybe (PopupAnchor, PopupPlacement, Float))) -> IO () Source #
computePopupPosition :: Float -> Float -> Float -> Float -> Float -> PopupAnchor -> PopupPlacement -> Float -> (Float, Float) Source #
placeWindowNode :: NodeArena -> Measurers -> Float -> Float -> NodeIdx -> Float -> Float -> (Float -> (Float, Float)) -> IO () Source #
Lay out window idx at size w0 h0, clamped to its min and max size and
the screen, with its origin, given that size, clamped on screen. Fit sizing
caps at intrinsic size; floating windows use an explicit frame size.
scrollBarSlotOf :: NodeArena -> NodeIdx -> IO ScrollBarSlot Source #
Where a scroll container's bar sits, as measurement stored it. Text
areas and other nodes read ScrollBarList.