| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
NanoUI.Context.Types
Description
Record types behind Context: interaction, damage, overlay, animation,
scroll and drawing-cache state, theme scopes, and frame messages.
Synopsis
- data Context = Context {
- ctxNodeArena :: NodeArena
- ctxDrawArena :: DrawArena
- ctxHotId :: IORef WidgetId
- ctxLastHotId :: IORef WidgetId
- ctxActiveId :: IORef WidgetId
- ctxClickedId :: IORef WidgetId
- ctxReleaseClickedId :: IORef WidgetId
- ctxPressPos :: IORef (Maybe V2)
- ctxRightPressPos :: IORef (Maybe V2)
- ctxFocusId :: IORef WidgetId
- ctxFocusVisible :: IORef Bool
- ctxStore :: IORef WidgetStore
- ctxDamageState :: IORef DamageState
- ctxOverlayState :: IORef OverlayState
- ctxAnimationState :: IORef AnimationState
- ctxScrollState :: !(IORef ScrollState)
- ctxDrawingCache :: IORef DrawingCacheState
- ctxIdContext :: IORef IdContext
- ctxFontMetrics :: FontMetrics
- ctxMonoFontMetrics :: FontMetrics
- ctxMeasureText :: Text -> IO (Float, Float)
- ctxResolveFont :: !(Float -> FontWeight -> FontStyle -> FontVariant -> IO (FontMetrics, Bool))
- ctxResolveMeasure :: !(Float -> FontWeight -> FontStyle -> FontVariant -> Text -> IO (Float, Float))
- ctxMeasureCache :: Maybe (IORef (HashMap MeasureCacheKey (Float, Float)))
- ctxSpanCache :: !(IORef (IntMap SpanCacheEntry))
- ctxWidgetTextCache :: !(IORef (IntMap WidgetTextCacheEntry))
- ctxLayoutCache :: !(IORef (Maybe (LayoutCache, Size, Int)))
- ctxMetricGen :: !(IORef Int)
- ctxMetricSource :: !MetricSource
- ctxLastMetricSource :: !(IORef (Maybe MetricSource))
- ctxPaintFull :: !(IORef Bool)
- ctxExternalText :: Bool
- ctxTheme :: !(IORef Theme)
- ctxThemeScopes :: !(IORef ThemeScopes)
- ctxContainerStack :: IORef [Int]
- ctxMessages :: IORef [FrameMsg]
- ctxFocusables :: IORef (MutablePrimArray RealWorld WidgetId)
- ctxFocusablesCount :: IORef Int
- ctxSpanBase :: SpanArena
- ctxSpanOverlay :: SpanArena
- ctxInteractionState :: !(IORef InteractionState)
- ctxClipboardGet :: IO (Maybe Text)
- ctxClipboardSet :: Text -> IO Bool
- ctxImageAtlas :: ImageAtlas
- ctxWakeLoop :: IORef (Maybe (IO ()))
- ctxHost :: IORef (Map TypeRep Dynamic)
- ctxDefaultLayout :: IORef Layout
- type MeasureCacheKey = (Text, Float)
- data MetricSource
- = InitialMetricSource
- | MetricSource !FontMetrics !FontMetrics !(Text -> IO (Float, Float)) !(Float -> FontWeight -> FontStyle -> FontVariant -> IO (FontMetrics, Bool)) !(Float -> FontWeight -> FontStyle -> FontVariant -> Text -> IO (Float, Float))
- data TextInputMenu = TextInputMenu {}
- data TextInputDrag = TextInputDrag {}
- data TextFieldClickCell = TextFieldClickCell {}
- data WindowResizeEdge
- data WindowResizeDrag = WindowResizeDrag {}
- data DamageRequest
- = ReqWidget !WidgetId !DamageBounds
- | ReqKey !Int !DamageBounds
- | ReqRect !Rect
- | ReqPeers ![WidgetId] !DamageBounds
- | ReqFull
- data DamageState = DamageState {
- dsDirty :: !Bool
- dsDamage :: !Damage
- dsRequests :: ![DamageRequest]
- dsLastWindowSize :: !Size
- dsPrevRects :: !(IntMap Rect)
- dsPrevClips :: !(IntMap Rect)
- dsPrevNodeTexts :: !(IntMap Text)
- initialDamageState :: DamageState
- data OverlayState = OverlayState {
- osModalWasActive :: !Bool
- osModalActive :: !Bool
- osModalDepth :: !Int
- osEscapeConsumed :: !Bool
- osPrevFloatingRects :: !(IntMap Rect)
- osPrevFloatingOrder :: ![Int]
- osTopmostCache :: !(Maybe (V2, Maybe WidgetId))
- osCurrentFloatingId :: !(Maybe WidgetId)
- osLastPointerBlocked :: !Bool
- initialOverlayState :: OverlayState
- data AnimationState = AnimationState {
- asAnimations :: !(IntMap Animation)
- asAnimRest :: !(IntMap Float)
- asAnyAnimating :: !Bool
- asAnimSettled :: !Bool
- asRectless :: !(IntMap Int)
- initialAnimationState :: AnimationState
- data ScrollTuning = ScrollTuning {}
- defaultScrollTuning :: ScrollTuning
- data ScrollAxes
- data ScrollGlide = ScrollGlide {}
- data ScrollState = ScrollState {
- ssTuning :: !ScrollTuning
- ssGlides :: !(IntMap ScrollGlide)
- ssCached :: !IntSet
- initialScrollState :: ScrollState
- data DrawFitCache = DrawFitCache {}
- data DrawingEntry = DrawingEntry {
- deContent :: !Int
- deBuild :: !DrawingBuild
- data DrawingCacheState = DrawingCacheState {
- dcsPopupConfigs :: !(IntMap PopupConfig)
- dcsDrawings :: !(IntMap DrawingEntry)
- dcsCustomDrawings :: !(IntMap CustomDrawingEntry)
- dcsCustomMeasures :: !(IntMap CustomMeasureFn)
- dcsCustomCursors :: !(IntMap (CustomDrawContext -> UiCursorKind))
- dcsCustomDamageSlop :: !(IntMap Float)
- dcsDrawOpCache :: !(IntMap DrawOpCacheEntry)
- dcsCustomDrawOpCache :: !(IntMap CustomDrawOpCacheEntry)
- dcsDrawFitCache :: !(IntMap DrawFitCache)
- data PopupConfig = PopupConfig {
- pcAnchor :: !PopupAnchor
- pcPlacement :: !PopupPlacement
- pcOffset :: !Float
- data DrawOpCacheEntry = DrawOpCacheEntry {
- doeContent :: !Int
- doeBounds :: !Rect
- doeOps :: !(SmallArray DrawOp)
- data CustomDrawingEntry = CustomDrawingEntry {
- cdrContent :: !Int
- cdrBuild :: !CustomDrawBuild
- data CustomDrawOpCacheEntry = CustomDrawOpCacheEntry {
- cdeContent :: !Int
- cdeBounds :: !Rect
- cdeHovered :: !Bool
- cdePressed :: !Bool
- cdeFocused :: !Bool
- cdeDisabled :: !Bool
- cdeGen :: !Int
- cdeOps :: !(SmallArray DrawOp)
- data SpanCacheEntry = SpanCacheEntry {}
- data WidgetTextCacheEntry = WidgetTextCacheEntry {
- wtcNodeType :: !Int
- wtcStyle :: !Int
- wtcFontSize :: !Float
- wtcText :: !Text
- wtcWidth :: !Float
- wtcHeight :: !Float
- wtcAlign :: !Int
- wtcPlacement :: !(Maybe WidgetTextPlacement)
- data WidgetTextPlacement = WidgetTextPlacement !Text !Float !Float !Float !Float
- initialDrawingCacheState :: DrawingCacheState
- data InteractionState = InteractionState {
- isScrollDrag :: !(Maybe (WidgetId, DirTag, Float))
- isTextInputDrag :: !(Maybe TextInputDrag)
- isTextFieldClickCell :: !(Maybe TextFieldClickCell)
- isTextInputMenu :: !(Maybe TextInputMenu)
- isTextEditLastAction :: !(Maybe (WidgetId, TextCommand))
- isSelectDropPress :: !Bool
- isOpenSelectDrop :: !(Maybe (WidgetId, Rect))
- isMenuPointerGesture :: !Bool
- isWindowDrag :: !(Maybe (WidgetId, Float, Float))
- isWindowResize :: !(Maybe WindowResizeDrag)
- initialInteractionState :: InteractionState
- type CustomMeasureFn = FontMetrics -> (Float, Float) -> (Float, Float)
- data CustomDrawContext = CustomDrawContext {
- cdcHovered :: !Bool
- cdcPressed :: !Bool
- cdcFocused :: !Bool
- cdcActive :: !Bool
- cdcDisabled :: !Bool
- cdcTheme :: !Theme
- cdcFont :: !FontMetrics
- type CustomDrawBuild = CustomDrawContext -> Rect -> SmallArray DrawOp
- data ThemeScopes = ThemeScopes {
- tsCount :: !Int
- tsThemes :: !(SmallMutableArray RealWorld Theme)
- tsRaw :: !(SmallMutableArray RealWorld Theme)
- tsPrevCount :: !Int
- tsPrev :: !(SmallMutableArray RealWorld Theme)
- tsPrevRaw :: !(SmallMutableArray RealWorld Theme)
- tsDisabled :: !Bool
- tsChanged :: !Bool
- tsPrevSig :: !Word64
- data FrameMsg where
- decodeMessages :: (Foldable f, Typeable a) => f FrameMsg -> [a]
- reduceMessages :: (Foldable f, Typeable msg) => (msg -> model -> model) -> model -> f FrameMsg -> model
- reduceUpdates :: (Foldable f, Typeable model) => model -> f FrameMsg -> model
- intKey :: WidgetId -> Int
Documentation
Constructors
type MeasureCacheKey = (Text, Float) Source #
data MetricSource Source #
Identity of a font/measurement configuration. Pure Context modifiers replace this value; the next frame invalidates shared caches if its identity differs. Holding the current inputs (not a revision counter/history) also distinguishes two differently configured Contexts derived from one parent.
Constructors
| InitialMetricSource | |
| MetricSource !FontMetrics !FontMetrics !(Text -> IO (Float, Float)) !(Float -> FontWeight -> FontStyle -> FontVariant -> IO (FontMetrics, Bool)) !(Float -> FontWeight -> FontStyle -> FontVariant -> Text -> IO (Float, Float)) |
data TextInputMenu Source #
Constructors
| TextInputMenu | |
Fields | |
Instances
| Eq TextInputMenu Source # | |
Defined in NanoUI.Context.Types Methods (==) :: TextInputMenu -> TextInputMenu -> Bool # (/=) :: TextInputMenu -> TextInputMenu -> Bool # | |
| Show TextInputMenu Source # | |
Defined in NanoUI.Context.Types Methods showsPrec :: Int -> TextInputMenu -> ShowS # show :: TextInputMenu -> String # showList :: [TextInputMenu] -> ShowS # | |
data TextInputDrag Source #
Constructors
| TextInputDrag | |
Fields | |
Instances
| Eq TextInputDrag Source # | |
Defined in NanoUI.Context.Types Methods (==) :: TextInputDrag -> TextInputDrag -> Bool # (/=) :: TextInputDrag -> TextInputDrag -> Bool # | |
| Show TextInputDrag Source # | |
Defined in NanoUI.Context.Types Methods showsPrec :: Int -> TextInputDrag -> ShowS # show :: TextInputDrag -> String # showList :: [TextInputDrag] -> ShowS # | |
data TextFieldClickCell Source #
Constructors
| TextFieldClickCell | |
Fields | |
Instances
| Eq TextFieldClickCell Source # | |
Defined in NanoUI.Context.Types Methods (==) :: TextFieldClickCell -> TextFieldClickCell -> Bool # (/=) :: TextFieldClickCell -> TextFieldClickCell -> Bool # | |
| Show TextFieldClickCell Source # | |
Defined in NanoUI.Context.Types Methods showsPrec :: Int -> TextFieldClickCell -> ShowS # show :: TextFieldClickCell -> String # showList :: [TextFieldClickCell] -> ShowS # | |
data WindowResizeEdge Source #
Instances
| Eq WindowResizeEdge Source # | |
Defined in NanoUI.Context.Types Methods (==) :: WindowResizeEdge -> WindowResizeEdge -> Bool # (/=) :: WindowResizeEdge -> WindowResizeEdge -> Bool # | |
| Show WindowResizeEdge Source # | |
Defined in NanoUI.Context.Types Methods showsPrec :: Int -> WindowResizeEdge -> ShowS # show :: WindowResizeEdge -> String # showList :: [WindowResizeEdge] -> ShowS # | |
data WindowResizeDrag Source #
Constructors
| WindowResizeDrag | |
Instances
| Eq WindowResizeDrag Source # | |
Defined in NanoUI.Context.Types Methods (==) :: WindowResizeDrag -> WindowResizeDrag -> Bool # (/=) :: WindowResizeDrag -> WindowResizeDrag -> Bool # | |
| Show WindowResizeDrag Source # | |
Defined in NanoUI.Context.Types Methods showsPrec :: Int -> WindowResizeDrag -> ShowS # show :: WindowResizeDrag -> String # showList :: [WindowResizeDrag] -> ShowS # | |
data DamageRequest Source #
Explicit damage invalidation request queued during frame evaluation.
Constructors
| ReqWidget !WidgetId !DamageBounds | Invalidate widget layout bounds (old & new) |
| ReqKey !Int !DamageBounds | Invalidate widget bounds by integer key |
| ReqRect !Rect | Invalidate an explicit window-space rectangle |
| ReqPeers ![WidgetId] !DamageBounds | Invalidate a collection of widgets |
| ReqFull | Force full window invalidation |
Instances
| Eq DamageRequest Source # | |
Defined in NanoUI.Context.Types Methods (==) :: DamageRequest -> DamageRequest -> Bool # (/=) :: DamageRequest -> DamageRequest -> Bool # | |
| Show DamageRequest Source # | |
Defined in NanoUI.Context.Types Methods showsPrec :: Int -> DamageRequest -> ShowS # show :: DamageRequest -> String # showList :: [DamageRequest] -> ShowS # | |
data DamageState Source #
Constructors
| DamageState | |
Fields
| |
data OverlayState Source #
Constructors
| OverlayState | |
Fields
| |
data AnimationState Source #
Constructors
| AnimationState | |
Fields
| |
data ScrollTuning Source #
How far one wheel notch scrolls, and how long a scroll takes to settle.
One setting for the whole context; a single scroller can take its own step
(see setScrollStep).
Constructors
| ScrollTuning | |
Fields
| |
Instances
| Eq ScrollTuning Source # | |
Defined in NanoUI.Context.Types | |
| Show ScrollTuning Source # | |
Defined in NanoUI.Context.Types Methods showsPrec :: Int -> ScrollTuning -> ShowS # show :: ScrollTuning -> String # showList :: [ScrollTuning] -> ShowS # | |
data ScrollAxes Source #
Which axes a scroller moves on, and how an offset in window axes (x rightwards, y downwards) maps onto its stored offset. A 1D row scroller keeps its offset in the main-axis slot, so its horizontal offset is the one that needs swapping.
Constructors
| ScrollAxisY | |
| ScrollAxisX | |
| ScrollAxisXY |
Instances
| Eq ScrollAxes Source # | |
Defined in NanoUI.Context.Types | |
| Show ScrollAxes Source # | |
Defined in NanoUI.Context.Types Methods showsPrec :: Int -> ScrollAxes -> ShowS # show :: ScrollAxes -> String # showList :: [ScrollAxes] -> ShowS # | |
data ScrollGlide Source #
A scroller on its way to an offset it has not reached yet. The target is in window axes and already clamped to the scroller's range.
Constructors
| ScrollGlide | |
Instances
| Eq ScrollGlide Source # | |
Defined in NanoUI.Context.Types | |
| Show ScrollGlide Source # | |
Defined in NanoUI.Context.Types Methods showsPrec :: Int -> ScrollGlide -> ShowS # show :: ScrollGlide -> String # showList :: [ScrollGlide] -> ShowS # | |
data ScrollState Source #
Constructors
| ScrollState | |
Fields
| |
data DrawFitCache Source #
data DrawingEntry Source #
A registered drawing: content version plus the op builder. The version participates in the draw-op cache key, so a builder whose output changes without its size changing must bump the version to invalidate.
Constructors
| DrawingEntry | |
Fields
| |
data DrawingCacheState Source #
Constructors
| DrawingCacheState | |
Fields
| |
data PopupConfig Source #
Strict cache entry for a popup's anchor configuration.
Constructors
| PopupConfig | |
Fields
| |
data DrawOpCacheEntry Source #
Strict cache entry for a drawing's compiled draw ops.
Constructors
| DrawOpCacheEntry | |
Fields
| |
data CustomDrawingEntry Source #
A registered custom drawing: its content key plus the op builder. A non-zero key is the author's promise that the ops follow it, so a frame whose key is unchanged neither rebuilds nor repaints them. Key 0 means the drawing carries no key and is rebuilt every frame and compared.
Constructors
| CustomDrawingEntry | |
Fields
| |
data CustomDrawOpCacheEntry Source #
Strict cache entry for a custom drawing's compiled draw ops. Every input the ops can depend on is part of the key: the content key, the rect, the interaction state the draw context exposes, and the metric generation, which a theme or font change bumps.
Constructors
| CustomDrawOpCacheEntry | |
Fields
| |
data SpanCacheEntry Source #
Cached text-span layout for one arena node. Key fields are every input
that changes the produced spans; sceSpans is the shared result. The whole
cache is dropped on theme or font-scale changes.
data WidgetTextCacheEntry Source #
Constructors
| WidgetTextCacheEntry | |
Fields
| |
data WidgetTextPlacement Source #
A cacheable widget label is a single line (or absent for close buttons). Coordinates are relative to the node origin; paint translates them without rebuilding a list or invalidating the cache when a widget scrolls.
data InteractionState Source #
Constructors
| InteractionState | |
Fields
| |
Instances
| Eq InteractionState Source # | |
Defined in NanoUI.Context.Types Methods (==) :: InteractionState -> InteractionState -> Bool # (/=) :: InteractionState -> InteractionState -> Bool # | |
| Show InteractionState Source # | |
Defined in NanoUI.Context.Types Methods showsPrec :: Int -> InteractionState -> ShowS # show :: InteractionState -> String # showList :: [InteractionState] -> ShowS # | |
type CustomMeasureFn = FontMetrics -> (Float, Float) -> (Float, Float) Source #
Custom node measurement: font metrics and available (width, height) to the node's desired (width, height).
data CustomDrawContext Source #
Constructors
| CustomDrawContext | |
Fields
| |
type CustomDrawBuild = CustomDrawContext -> Rect -> SmallArray DrawOp Source #
data ThemeScopes Source #
Themes the view's styled scopes pushed this frame, and last frame's, to
tell whether a frame changed only how its scopes look. A node's scope holds
an index into tsThemes plus one; index 0 is the context theme.
Constructors
| ThemeScopes | |
Fields
| |