nano-ui
Safe HaskellNone
LanguageGHC2024

NanoUI.Context.Types

Description

Record types behind Context: interaction, damage, overlay, animation, scroll and drawing-cache state, theme scopes, and frame messages.

Synopsis

Documentation

data Context Source #

Constructors

Context 

Fields

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.

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

Instances details
Eq DamageRequest Source # 
Instance details

Defined in NanoUI.Context.Types

Show DamageRequest Source # 
Instance details

Defined in NanoUI.Context.Types

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

  • scrollWheelStep :: Float

    Pixels one wheel notch scrolls. The default is three text lines, which is what Windows and most desktops send a notch as.

  • scrollSmoothTime :: Float

    Seconds a scroll takes to cover most of the distance to its target. 0 (the default) lands on it in the same frame.

Instances

Instances details
Eq ScrollTuning Source # 
Instance details

Defined in NanoUI.Context.Types

Show ScrollTuning Source # 
Instance details

Defined in NanoUI.Context.Types

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.

Instances

Instances details
Eq ScrollAxes Source # 
Instance details

Defined in NanoUI.Context.Types

Show ScrollAxes Source # 
Instance details

Defined in NanoUI.Context.Types

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

Instances details
Eq ScrollGlide Source # 
Instance details

Defined in NanoUI.Context.Types

Show ScrollGlide Source # 
Instance details

Defined in NanoUI.Context.Types

data ScrollState Source #

Constructors

ScrollState 

Fields

  • ssTuning :: !ScrollTuning
     
  • ssGlides :: !(IntMap ScrollGlide)
     
  • ssCached :: !IntSet

    Scrollers whose geometry has been published this frame. Two scroll nodes can share a widget id (a table's frozen pane and its body), and without this the second would overwrite the first every frame, churning the store and flipping the geometry the commands read.

data DrawFitCache Source #

Constructors

DrawFitCache 

Fields

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 

data PopupConfig Source #

Strict cache entry for a popup's anchor configuration.

data DrawOpCacheEntry Source #

Strict cache entry for a drawing's compiled draw ops.

Constructors

DrawOpCacheEntry 

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.

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.

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 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.

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 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

data FrameMsg where Source #

Constructors

FrameMsg :: forall a. Typeable a => a -> FrameMsg 

reduceMessages :: (Foldable f, Typeable msg) => (msg -> model -> model) -> model -> f FrameMsg -> model Source #

reduceUpdates :: (Foldable f, Typeable model) => model -> f FrameMsg -> model Source #