Guide API
Skip to main content

Module view

Module view 

Source
Expand description

Views, geometry, and the downward-context substrate.

Carries the geometry primitives (Point/Rect), the global ViewId minter (id), the downward Context / DrawCtx types (context), and the View trait + ViewState that every widget builds on.

Guide: The view tree.

Structs§

Context
The event/update context handle_event and capture handlers reach for.
DragMode
Drag-mode flags — control whether a view can be moved or resized interactively and the owner-boundary limits applied during the drag.
DrawCtx
The clipped, themed writer every view paints through.
Group
A view that owns and routes to a tree of child views.
GrowMode
Grow-mode flags — control how each edge of the view tracks its owner when the owner is resized.
Options
The per-view option flags — fixed, build-time choices about how a view behaves (selectable, framed, centered, pre/post-process, …), as opposed to the live State bits.
Point
A screen coordinate pair (x, y).
Rect
A rectangle defined by its top-left corner a (inclusive) and bottom-right corner b (exclusive).
State
The per-view state flags — visibility, focus, selection, drag, and the rest of the activation/interaction bits a parent flips on its children.
ViewId
A lightweight, globally-unique view identity. Copy, carries no reference into the tree, so it can be stored freely (sibling links, focus stacks, capture handlers). Identity is ViewId equality.
ViewState
The data every view owns — origin, size, cursor, state/option/grow/drag flags, owner id, and more.

Enums§

Deferred
An effect on loop-owned state that a downward-borrowed view / capture handler cannot perform inline. During dispatch the view tree is a live &mut borrow stack (root → desktop → window → frame): a view cannot reach up or sideways — every ancestor is already &mut-borrowed above it, and a fresh root.find_mut(id) would alias that borrow. Nor does a view hold the program’s capture stack or command set. So any such effect is requested through Context (which pushes a variant here) and applied by the loop after the dispatch unwinds and the root is free again.
DividerOp
One operation on a splitter’s keyboard-resize session, brokered by id from the window’s resize capture (which knows the splitter only by ViewId).
Phase
Focused-event dispatch phase.
SelectMode
Which select/deselect side effects Group::set_current applies when changing the current view.
StateFlag
The state flags a parent group flips on a child through View::set_state — the subset of State that the focus / activation and visibility machinery drives, with side effects.

Traits§

View
The behavior every view implements. Widgets supply state / state_mut / draw; the rest default.