Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Rikitav/Terminality/llms.txt

Use this file to discover all available pages before exploring further.

Terminality’s layout engine is built on five plain structs — Point, Vector, Size, Thickness, and Rect — that live in the terminality namespace and are imported via terminality:Geometry. They carry no heap allocations and are passed by value throughout the framework. Understanding them is a prerequisite for implementing MeasureOverride, ArrangeOverride, and any rendering code that works with coordinates.

Point

A 2-D integer coordinate. Used for cursor positions, child origins, and hit-test queries.

Fields

FieldTypeDescription
Xint32_tColumn coordinate (0 = left edge).
Yint32_tRow coordinate (0 = top edge).

Constructors

Point(int32_t x = 0, int32_t y = 0);
Both parameters default to 0, so Point{} is equivalent to Point::Zero.

Static constants

ConstantValue
Point::ZeroPoint(0, 0)

Operators

bool operator==(const Point& other) const;
bool operator!=(const Point& other) const;

Vector

A directed segment between two Point values. Used internally to describe diagonal extents and is accepted by Size(Vector).

Fields

FieldTypeDescription
FromPointStart of the vector.
ToPointEnd of the vector.

Constructors

// Construct from two Point values
Vector(Point from = Point(), Point to = Point());

// Construct from four scalar coordinates
Vector(int32_t fromX, int32_t fromY, int32_t toX, int32_t toY);

Operators

bool operator==(const Vector& other) const;
bool operator!=(const Vector& other) const;

Size

Width/height dimensions returned from MeasureOverride and stored in layout constraints.

Fields

FieldTypeDescription
Widthint32_tHorizontal extent in columns.
Heightint32_tVertical extent in rows.

Constructors

// Explicit dimensions
Size(int32_t width = 0, int32_t height = 0);

// Derived from a Vector — width = max(0, To.X - From.X), height = max(0, To.Y - From.Y)
Size(Vector diagonal);

Static constants

ConstantDescription
Size::ZeroSize(0, 0) — empty size.
Size::AutoSentinel value meaning “measure to content”. The framework treats Width == -1 && Height == -1 as auto.

Operators

bool operator==(const Size& other) const;
bool operator!=(const Size& other) const;

Thickness

Four independent insets (left, top, right, bottom) used for Margin, Padding, and border widths.

Fields

FieldTypeDescription
Leftint32_tInset on the left edge.
Topint32_tInset on the top edge.
Rightint32_tInset on the right edge.
Bottomint32_tInset on the bottom edge.

Constructors

// All four sides set to the same value
Thickness(int32_t uniform = 0);

// Each side specified independently
Thickness(int32_t left, int32_t top, int32_t right, int32_t bottom);

Static constants

ConstantDescription
Thickness::ZeroAll sides 0.
Thickness::SingleAll sides 1. Useful for a one-cell border.

Methods

int32_t Horizontal() const;   // Left + Right
int32_t Vertical()   const;   // Top + Bottom
bool    IsUniform()  const;   // true when all four sides are equal
Horizontal() and Vertical() are the values you subtract from an available Size when computing inner content bounds:
Size innerSize(
    availableSize.Width  - margin.Horizontal(),
    availableSize.Height - margin.Vertical()
);

Operators

bool operator==(const Thickness& other) const;
bool operator!=(const Thickness& other) const;

Rect

An axis-aligned rectangle described by an origin (X, Y) and dimensions (Width, Height). Used in ArrangeOverride as finalRect and in render clipping.

Fields

FieldTypeDescription
Xint32_tLeft edge column.
Yint32_tTop edge row.
Widthint32_tHorizontal span in columns.
Heightint32_tVertical span in rows.

Constructor

Rect(int32_t x = 0, int32_t y = 0, int32_t width = 0, int32_t height = 0);

Instance methods

int32_t Right() const;
Returns X + Width. One column past the last occupied column.
int32_t Bottom() const;
Returns Y + Height. One row past the last occupied row.
Size AsSize() const;
Returns Size(Width, Height), discarding the origin. Useful when you need to pass dimensions to MeasureOverride.
bool IsEmpty() const;
Returns true when Width <= 0 || Height <= 0.
bool Contains(Point point) const;
Returns true when point falls within the rectangle (inclusive on all edges, exclusive at Right() and Bottom()).
bool Contains(Rect inner) const;
Returns true when inner is fully enclosed by this rectangle.
bool Intersects(Rect other) const;
Returns true when the two rectangles share at least one cell.

Static methods

static Rect Union(const Rect& a, const Rect& b);
Returns the smallest Rect that contains both a and b.
static Rect Enclose(const Rect& into, const Rect& rect);
Moves rect so that it fits inside into without resizing it. If rect is already contained, it is returned unchanged.
static Rect Clip(const Rect& into, const Rect& rect);
Returns the intersection of into and rect. If the two rectangles do not overlap, returns an empty Rect.

Operators

bool operator==(const Rect& other) const;
bool operator!=(const Rect& other) const;

Build docs developers (and LLMs) love