Guide API
Skip to main content

Module frame

Module frame 

Source
Expand description

The decorative border Frame a Window places around its interior: the box, the centered title, the optional window number, and the close / zoom / resize icons. It is a passive view — it never takes focus.

§How a frame gets its data

A frame never reaches up into the window that owns it. Instead, Frame holds its own copy of exactly the data it renders, pushed down by the owning window through public setters:

The window calls these setters whenever its own state changes. The frame’s active / dragging state instead arrives through the normal View::set_state propagation that Group drives onto every child, so Frame::draw reads it from its own state directly.

§Drag, resize, and close

The frame deliberately leaves window-drag MouseDown events (title-bar move, bottom-corner resize, middle-button move) unconsumed so they fall through to the owning Window, which runs the drag. The close icon, by contrast, is handled here: pressing it arms a press-and-hold MouseTrackCapture and posts Command::CLOSE only if the button is released back over the close zone.

Guide: Windows & the desktop.

§Turbo Vision heritage

Ports TFrame (tframe.cpp / framelin.cpp). The original frame’s draw and event handling reached up through the owner into the window; tvision-rs instead pushes the needed data down from the window (deviation D3). Inheritance becomes the View trait plus ViewState composition (deviation D2), the frame flag word becomes WindowFlags (deviation D5), and palette lookups become Role-keyed theme styles (deviation D7).

The classic sibling tee-walk (TFrame::frameLine reaching sideways to read its siblings’ bounds) is not reproduced as a sideways walk — deviation D3 forbids a child reaching its siblings. Instead, a window that hosts a joined Splitter (opted in via Splitter::joined) auto-brokers: it computes the divider abutments from its Splitter child and pushes them down to this frame as JunctionMarks via set_junction_marks; the frame then substitutes the matching tee glyph at each marked edge cell — the same visual result as frameLine, fed by pushed data. A frame with no marks (every window without a joined splitter) draws plain corners and edges, exactly as before.

Structs§

Frame
A window’s decorative border: box, title, number, and close/zoom/resize icons.