Guide API
Skip to main content

Module capture

Module capture 

Source
Expand description

The capture stack — the single mechanism behind modality, mouse tracking, window drag/resize, and press-and-hold.

A LIFO stack of capture handlers see each event before normal view-tree routing and may consume it or pass it through. Modality, drag, and press-tracking are all handlers rather than nested loops: a modal handler that consumes every otherwise-unhandled event is the modal loop. Handlers hold a ViewId, never a view reference. The live event loop in Program owns this stack and drives CaptureStack::dispatch; the tests module here hand-plays the loop to prove the protocol composes.

Guide: Event capture.

§Turbo Vision heritage

Turbo Vision implements modality, view dragging, and a pressed button’s mouse-tracking by spinning nested blocking event loops (tgroup.cpp, tview.cpp). Rust cannot nest a blocking loop that re-borrows the view tree, so tvision-rs collapses all of them into one non-recursive event loop plus this LIFO capture stack (deviation D9). Handlers hold a ViewId rather than a view pointer (deviation D3).

Structs§

CaptureStack
A LIFO stack of CaptureHandlers.
MouseTrackCapture
The hold-tracking router: while a mouse button is held, it localizes and forwards masked mouse events to the tracked view, swallows everything else, and pops on MouseUp (forwarding the localized up too — a button/frame reads the up position after the hold ends).
TrackMask
Which mouse event classes the hold-tracker forwards to its view while a button is held (everything else is discarded until the terminating MouseUp).

Enums§

CaptureFlow
What a capture handler did with an event it was offered.

Traits§

CaptureHandler
A capture handler — a participant in the capture stack that stands in for a nested modal/drag/press loop.