Unreleased APIs from PR #2. Not in 0.2.1. Stable 0.2.1 reference.
LOOM Unreleased (PR #2) / WIDGETS
WindowFrame
Owns geometry and pointer interaction for one window; the app renders content and manages window lifetime. An expanded window fills its viewport. Normal windows are clamped to the viewport and configured minimum sizes. Only chrome events are consumed by handleMouse. edgeResizing is an alias for insetTitle; resizing still starts at the lower-right border.
Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.
Example
var window = WindowFrame(viewport: Rect(width: 80, height: 24), preferredWidth: 40, preferredHeight: 12)
window.move(byColumns: 2, rows: 1)
window.toggleExpanded()
_ = window.contentAreaMembers on this page
Feature guides and release status
WindowFrame
struct WindowFrameConforms to: Widget.
A single floating window's terminal-cell geometry and pointer interaction.
The caller owns its content and paints it inside bounds. This type draws only
the border and controls. Pointer events starting in the content remain available
to the caller, so text selection and other body interactions stay independent.
viewport
var viewport: Rect { get }Available terminal-cell viewport.
Source · WindowFrame.swift:9bounds
var bounds: Rect { get }Current window rectangle within the viewport.
Source · WindowFrame.swift:10isExpanded
var isExpanded: Bool { get }Whether the window fills its viewport.
Source · WindowFrame.swift:11style
var style: StyleVisual attributes used when painting this value.
Source · WindowFrame.swift:12insetTitle
var insetTitle: BoolPlaces the draggable title row below the top border.
Source · WindowFrame.swift:14edgeResizing
var edgeResizing: Bool { get set }A source-compatible alias for insetTitle; resizing always starts at the lower-right border.
init(viewport:preferredWidth:preferredHeight:minimumWidth:minimumHeight:)
init(viewport: Rect, preferredWidth: Int, preferredHeight: Int, minimumWidth: Int = 24, minimumHeight: Int = 8)Creates a centered window, bounded by the available terminal-cell viewport.
Parameters (5)
viewport- Available terminal-cell viewport.
preferredWidth- Argument type and any default are shown in the declaration; see the behavior notes above.
preferredHeight- Argument type and any default are shown in the declaration; see the behavior notes above.
minimumWidth- Argument type and any default are shown in the declaration; see the behavior notes above.
minimumHeight- Argument type and any default are shown in the declaration; see the behavior notes above.
contentArea
var contentArea: Rect { get }The space inside the border, measured in terminal cells.
Source · WindowFrame.swift:50titleArea
var titleArea: Rect { get }The draggable row between the corners, below the top border when insetTitle is enabled.
expandButton
var expandButton: Rect { get }The three-cell control just inside the upper-right border.
Source · WindowFrame.swift:59minimizeButton
var minimizeButton: Rect { get }The inset minimize control immediately left of expand.
Source · WindowFrame.swift:65resizeHandle
var resizeHandle: Rect { get }The lower-right border's resize region, measured in terminal cells.
Only its outer border cells resize the window; use isResizeHandle(at:) for hit testing.
isResizeHandle(at:)
func isResizeHandle(at point: Point) -> BoolTests the connected bottom and right border cells beside the lower-right corner.
Parameters (1)
at- Argument type and any default are shown in the declaration; see the behavior notes above.
Returns Bool.
resizeViewport(to:)
mutating func resizeViewport(to viewport: Rect)Clamps the window to a new terminal-cell viewport while retaining its normal size.
An expanded window continues to fill the viewport. Repeating the current viewport preserves active drags.
Parameters (1)
to- Argument type and any default are shown in the declaration; see the behavior notes above.
toggleExpanded()
mutating func toggleExpanded()Expands to the viewport or restores the previous window bounds.
Source · WindowFrame.swift:98move(byColumns:rows:)
mutating func move(byColumns columns: Int, rows: Int)Moves an unexpanded window by terminal cells, keeping it inside the viewport.
Parameters (2)
byColumns- Argument type and any default are shown in the declaration; see the behavior notes above.
rows- Row count or signed row movement, according to the method.
resize(byColumns:rows:)
mutating func resize(byColumns columns: Int, rows: Int)Resizes an unexpanded window by terminal cells, subject to its minimum size.
Parameters (2)
byColumns- Argument type and any default are shown in the declaration; see the behavior notes above.
rows- Row count or signed row movement, according to the method.
handleMouse(_:)
@discardableResult mutating func handleMouse(_ mouse: MouseEvent) -> BoolHandles title dragging, lower-right border resizing, and expand/restore clicks.
Returns true only for window-chrome interactions; the caller handles body input.
Parameters (1)
mouse- Mouse action and terminal-cell position.
Returns Bool.
render(in:buffer:)
func render(in area: Rect, buffer: inout Buffer)Draws a thin square border and inset window controls.
Pass bounds as area so rendering and hit testing use the same cells.
Parameters (2)
in- Argument type and any default are shown in the declaration; see the behavior notes above.
buffer- Mutable destination cell grid.