Skip to content
FutureBlitz

    Install

    Import std.term.region

    Region

    std.term.region

    struct

    Public Struct Region Implements Hashable, Printable

    A rectangle of a screen's cells: its top-left Column and Row, from 0, and its Width and Height.

    Examples

    Local screen = Region(0, 0, 80, 24)
    Local rows = screen.SplitRows(Constraint.Fixed(1), Constraint.Fill(), Constraint.Fixed(1))
    Expect(rows[0].Height == 1 && rows[1].Height == 22 && rows[2].Row == 23)
    Local columns = rows[1].SplitColumns(Constraint.Percent(25), Constraint.Fill())
    Expect(columns[0].Width == 20 && columns[1].Column == 20)

    std/term/region.fb, line 21

    • Public Field Column: Int field #

      Its left column, from 0.

    • Public Field Row: Int field #

      Its top row, from 0.

    • Public Field Width: Int field #

      How many columns wide it is.

    • Public Field Height: Int field #

      How many rows high it is.

    • Public Property Right: Int property #

      The column just past its right edge, and the row just past its bottom.

    • Public Property Bottom: Int property #

      The row just past its bottom.

    • Public Property IsEmpty: Bool property #

      Whether it has no cells.

    • Public Method Contains(column: Int, row: Int): Bool method #

      Whether the cell at column and row is in it.

    • Public Method Inner(margin: Int = 1): Region method #

      It without margin cells on each side, or empty where there aren't that many.

    • Public Method Inner(horizontal: Int, vertical: Int): Region method #

      It without horizontal cells on its left and right, and vertical ones on its top and bottom.

    • Public Method Intersect(other: Region): Region method #

      The cells it has in common with other, which may be none.

    • Public Method SplitRows(sizes: Constraint...): Region[] method #

      Its rows, top to bottom, as the sizes say, each its whole width.

    • Public Method SplitColumns(sizes: Constraint...): Region[] method #

      Its columns, left to right, as the sizes say, each its whole height.

    • Public Method ToString(): String method #

      Like "(3, 4) 20x10".

    Report an issue with this page or with FutureBlitz on GitHub.