Skip to main content

PaneSize struct

Namespace: Arlecchino.Layout · Assembly: Arlecchino

How much of a region a branch gives to its first half: a share, a count of cells, or a count from the other end. The literal says which, since a double is a share and an int is a count.

Branch(Rows, 3, header, body); // three rows
Branch(Rows, 0.3, header, body); // three tenths of the height
Branch(Columns, 3, side, main); // three columns — a count follows the direction of the cut

public readonly struct PaneSize : IEquatable<PaneSize>

Implements IEquatable<T><PaneSize>

Methods

MemberSummary
Cells(int)A fixed number of cells, however big the region is.
CellsFromEnd(int)Everything except a fixed number of cells, which is how a one-row status bar at the bottom is written: the first half takes the rest, the second half takes what was reserved.
Fraction(double)A share of the space, between nothing and all of it.

Operators

MemberSummary
operator Implicit(double)
operator Implicit(int)

Methods in detail

Cells(int)

public static PaneSize Cells(int count);

A fixed number of cells, however big the region is.

Parameters

NameTypeDescription
countintColumns or rows, whichever way the split runs.

Returns PaneSize — The size.

CellsFromEnd(int)

public static PaneSize CellsFromEnd(int count);

Everything except a fixed number of cells, which is how a one-row status bar at the bottom is written: the first half takes the rest, the second half takes what was reserved.

Parameters

NameTypeDescription
countintColumns or rows to leave for the second half.

Returns PaneSize — The size.

Fraction(double)

public static PaneSize Fraction(double value);

A share of the space, between nothing and all of it.

Parameters

NameTypeDescription
valuedoubleThe share, clamped to 0..1.

Returns PaneSize — The size.

Operators in detail

operator Implicit(double)

public static PaneSize op_Implicit(double value);

Parameters

NameTypeDescription
valuedouble

Returns PaneSize

operator Implicit(int)

public static PaneSize op_Implicit(int count);

Parameters

NameTypeDescription
countint

Returns PaneSize

Example

1 is one row and 1.0 is all of them. A bare 0 is rejected by the compiler, so write PaneSize.Fraction or PaneSize.Cells where nothing is meant.