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.
Assembly: DarkEffekt.Terminal.UI
Section titled “Assembly: DarkEffekt.Terminal.UI”public abstract class ElementDerived:
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
Properties
Section titled “Properties”Parent
Section titled “Parent”public Element Parent { get; }A fixed width in cells. Null sizes to the content.
public int? Width { get; set; }Height
Section titled “Height”A fixed height in cells. Null sizes to the content.
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.
public int Grow { get; set; }Visible
Section titled “Visible”A hidden element takes no room and no input.
public bool Visible { get; set; }Enabled
Section titled “Enabled”A disabled element draws dimmed and takes no input.
public bool Enabled { get; set; }Foreground
Section titled “Foreground”The text color. Null takes the parent’s.
public TermColor? Foreground { get; set; }Background
Section titled “Background”The background color. Null takes the parent’s.
public TermColor? Background { get; set; }Desired
Section titled “Desired”What the last Measure asked for.
public CellSize Desired { get; }Bounds
Section titled “Bounds”The cells the last Arrange gave this element.
public CellRect Bounds { get; }Focusable
Section titled “Focusable”True for an element that takes keyboard focus.
public virtual bool Focusable { get; }Focused
Section titled “Focused”True while this element has keyboard focus.
public bool Focused { get; }The interface this element is in, or null.
public TerminalUI Owner { get; }ChildCount
Section titled “ChildCount”public virtual int ChildCount { get; }Colors
Section titled “Colors”protected UIColors Colors { get; }The text color in effect: this element’s, or the nearest ancestor’s.
protected TermColor Fg { get; }The background color in effect: this element’s, or the nearest ancestor’s.
protected TermColor Bg { get; }Methods
Section titled “Methods”GetChild(int)
Section titled “GetChild(int)”public virtual Element GetChild(int index)Returns
Section titled “Returns”DarkEffekt.Terminal.UI.Element
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
System.Int32 |
index |
Measure(CellSize)
Section titled “Measure(CellSize)”public CellSize Measure(CellSize available)Returns
Section titled “Returns”DarkEffekt.Terminal.UI.CellSize
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
| DarkEffekt.Terminal.UI.CellSize | available |
Arrange(CellRect)
Section titled “Arrange(CellRect)”public void Arrange(CellRect rect)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
| DarkEffekt.Terminal.UI.CellRect | rect |
MeasureCore(CellSize)
Section titled “MeasureCore(CellSize)”The size this element wants, within the room given.
protected abstract CellSize MeasureCore(CellSize available)Returns
Section titled “Returns”DarkEffekt.Terminal.UI.CellSize
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
| DarkEffekt.Terminal.UI.CellSize | available |
ArrangeCore(CellRect)
Section titled “ArrangeCore(CellRect)”Places the children inside this element’s rectangle.
protected virtual void ArrangeCore(CellRect rect)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
| DarkEffekt.Terminal.UI.CellRect | rect |
Render(CellCanvas)
Section titled “Render(CellCanvas)”Draws the element, then its children. The canvas is clipped by the ancestors.
public void Render(CellCanvas canvas)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
| DarkEffekt.Terminal.UI.CellCanvas | canvas |
RenderCore(CellCanvas)
Section titled “RenderCore(CellCanvas)”protected virtual void RenderCore(CellCanvas canvas)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
| DarkEffekt.Terminal.UI.CellCanvas | canvas |
OnKey(in TermKeyEvent)
Section titled “OnKey(in TermKeyEvent)”A key for this element. Return true when it was used; false passes it to the parent.
public virtual bool OnKey(in TermKeyEvent e)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
| DarkEffekt.Terminal.TermKeyEvent | e |
OnChar(char, TermModifiers)
Section titled “OnChar(char, TermModifiers)”A typed character for this element. Return true when it was used.
public virtual bool OnChar(char c, TermModifiers modifiers)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
System.Char |
c |
| DarkEffekt.Terminal.TermModifiers | modifiers |
OnMouse(in TermMouseEvent)
Section titled “OnMouse(in TermMouseEvent)”A pointer event on this element. Return true when it was used.
public virtual bool OnMouse(in TermMouseEvent e)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
| DarkEffekt.Terminal.TermMouseEvent | e |
OnPaste(string)
Section titled “OnPaste(string)”public virtual void OnPaste(string text)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
System.String |
text |
Invalidate()
Section titled “Invalidate()”Asks for a redraw. Property setters call it.
public void Invalidate()Set<T>(ref T, T)
Section titled “Set<T>(ref T, T)”protected void Set<T>(ref T field, T value)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
<T> |
field |
<T> |
value |
Type Parameters
Section titled “Type Parameters”T