Skip to content

Class Element

The base of everything in an interface. Layout runs in two passes over whole cells: Measure asks an element how much room it wants within what is available, and Arrange gives it its rectangle. Render then draws it.

Declaration
public abstract class Element

Derived:

Expand

DarkEffekt.Terminal.UI.BigText, DarkEffekt.Terminal.UI.Border, DarkEffekt.Terminal.UI.Button, DarkEffekt.Terminal.UI.CheckBox, DarkEffekt.Terminal.UI.Container, DarkEffekt.Terminal.UI.Label, DarkEffekt.Terminal.UI.ListView, DarkEffekt.Terminal.UI.LogView, DarkEffekt.Terminal.UI.Paint, DarkEffekt.Terminal.UI.ProgressBar, DarkEffekt.Terminal.UI.ScrollBar, DarkEffekt.Terminal.UI.ScrollView, DarkEffekt.Terminal.UI.Spacer, DarkEffekt.Terminal.UI.Sparkline, DarkEffekt.Terminal.UI.TextInput, DarkEffekt.Terminal.UI.TextureView

Declaration
public Element Parent { get; }

A fixed width in cells. Null sizes to the content.

Declaration
public int? Width { get; set; }

A fixed height in cells. Null sizes to the content.

Declaration
public int? Height { get; set; }

This element’s share of the room a DarkEffekt.Terminal.UI.Stack has left after its other children. Zero keeps the content size.

Declaration
public int Grow { get; set; }

A hidden element takes no room and no input.

Declaration
public bool Visible { get; set; }

A disabled element draws dimmed and takes no input.

Declaration
public bool Enabled { get; set; }

The text color. Null takes the parent’s.

Declaration
public TermColor? Foreground { get; set; }

The background color. Null takes the parent’s.

Declaration
public TermColor? Background { get; set; }

What the last Measure asked for.

Declaration
public CellSize Desired { get; }

The cells the last Arrange gave this element.

Declaration
public CellRect Bounds { get; }

True for an element that takes keyboard focus.

Declaration
public virtual bool Focusable { get; }

True while this element has keyboard focus.

Declaration
public bool Focused { get; }

The interface this element is in, or null.

Declaration
public TerminalUI Owner { get; }
Declaration
public virtual int ChildCount { get; }
Declaration
protected UIColors Colors { get; }

The text color in effect: this element’s, or the nearest ancestor’s.

Declaration
protected TermColor Fg { get; }

The background color in effect: this element’s, or the nearest ancestor’s.

Declaration
protected TermColor Bg { get; }
Declaration
public virtual Element GetChild(int index)

DarkEffekt.Terminal.UI.Element

Type Name
System.Int32 index
Declaration
public CellSize Measure(CellSize available)

DarkEffekt.Terminal.UI.CellSize

Type Name
DarkEffekt.Terminal.UI.CellSize available
Declaration
public void Arrange(CellRect rect)
Type Name
DarkEffekt.Terminal.UI.CellRect rect

The size this element wants, within the room given.

Declaration
protected abstract CellSize MeasureCore(CellSize available)

DarkEffekt.Terminal.UI.CellSize

Type Name
DarkEffekt.Terminal.UI.CellSize available

Places the children inside this element’s rectangle.

Declaration
protected virtual void ArrangeCore(CellRect rect)
Type Name
DarkEffekt.Terminal.UI.CellRect rect

Draws the element, then its children. The canvas is clipped by the ancestors.

Declaration
public void Render(CellCanvas canvas)
Type Name
DarkEffekt.Terminal.UI.CellCanvas canvas
Declaration
protected virtual void RenderCore(CellCanvas canvas)
Type Name
DarkEffekt.Terminal.UI.CellCanvas canvas

A key for this element. Return true when it was used; false passes it to the parent.

Declaration
public virtual bool OnKey(in TermKeyEvent e)

System.Boolean

Type Name
DarkEffekt.Terminal.TermKeyEvent e

A typed character for this element. Return true when it was used.

Declaration
public virtual bool OnChar(char c, TermModifiers modifiers)

System.Boolean

Type Name
System.Char c
DarkEffekt.Terminal.TermModifiers modifiers

A pointer event on this element. Return true when it was used.

Declaration
public virtual bool OnMouse(in TermMouseEvent e)

System.Boolean

Type Name
DarkEffekt.Terminal.TermMouseEvent e
Declaration
public virtual void OnPaste(string text)
Type Name
System.String text

Asks for a redraw. Property setters call it.

Declaration
public void Invalidate()
Declaration
protected void Set<T>(ref T field, T value)
Type Name
<T> field
<T> value
  • T