Class TerminalUI
An interface: a tree of elements, the element with keyboard focus, and the routing of input to them. It draws into a DarkEffekt.Terminal.CellSurface and takes input as events, so it runs unchanged as a surface program (DarkEffekt.Terminal.UI.UISurfaceProgram) or over escape sequences (DarkEffekt.Terminal.UI.UIAnsiProgram).
Tab and Shift+Tab move focus. A key goes to the focused element and then up through its ancestors until one uses it; a pointer event goes to the element under it the same way.
Assembly: DarkEffekt.Terminal.UI
Section titled “Assembly: DarkEffekt.Terminal.UI”public sealed class TerminalUI : ITerminalInputImplements:
DarkEffekt.Terminal.ITerminalInput
Properties
Section titled “Properties”Colors
Section titled “Colors”public UIColors Colors { get; set; }ScrollBarStyle
Section titled “ScrollBarStyle”The glyphs every scroll bar draws unless it sets its own.
public ScrollBarStyle ScrollBarStyle { get; set; }public Element Root { get; set; }The element with keyboard focus, or null.
public Element Focus { get; }NeedsRender
Section titled “NeedsRender”True when something changed since the last Render.
public bool NeedsRender { get; }UnhandledKey
Section titled “UnhandledKey”A key no element used. Return true to stop the default Tab handling.
public Func<TermKeyEvent, bool> UnhandledKey { get; set; }CloseOnEscape
Section titled “CloseOnEscape”Close the interface on Esc, when no element and no UnhandledKey has used the key.
public bool CloseOnEscape { get; set; }Methods
Section titled “Methods”Invalidate()
Section titled “Invalidate()”public void Invalidate()Close()
Section titled “Close()”Asks the host to end the program.
public void Close()Update(float)
Section titled “Update(float)”public void Update(float deltaSeconds)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
System.Single |
deltaSeconds |
SetFocus(Element)
Section titled “SetFocus(Element)”Gives an element keyboard focus. Null clears it.
public void SetFocus(Element element)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
| DarkEffekt.Terminal.UI.Element | element |
Render(CellSurface)
Section titled “Render(CellSurface)”Lays the tree out for a grid of this size and draws it.
public void Render(CellSurface surface)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
| DarkEffekt.Terminal.CellSurface | surface |
GetSlots(List<SurfaceSlot>)
Section titled “GetSlots(List<SurfaceSlot>)”Adds the rectangle of every visible DarkEffekt.Terminal.UI.TextureView to the list.
public void GetSlots(List<SurfaceSlot> into)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
System.Collections.Generic.List<DarkEffekt.Terminal.SurfaceSlot> |
into |
SetSlotBound(string, bool)
Section titled “SetSlotBound(string, bool)”Records that the host shows a texture in the slot of this name, so the view there draws no caption.
public void SetSlotBound(string name, bool bound)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
System.String |
name |
System.Boolean |
bound |
IsSlotBound(string)
Section titled “IsSlotBound(string)”public bool IsSlotBound(string name)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
System.String |
name |
FocusNext(int)
Section titled “FocusNext(int)”Moves focus forward (1) or back (-1) through the focusable elements, in tree order.
public void FocusNext(int direction)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
System.Int32 |
direction |
OnKey(in TermKeyEvent)
Section titled “OnKey(in TermKeyEvent)”A non-text key: arrows, function keys, Enter, Tab, and the rest of DarkEffekt.Terminal.TermKey.
public void OnKey(in TermKeyEvent e)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
| DarkEffekt.Terminal.TermKeyEvent | e |
OnChar(char, TermModifiers)
Section titled “OnChar(char, TermModifiers)”A typed character, or a letter held with Ctrl or Alt.
public void OnChar(char c, TermModifiers modifiers)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
System.Char |
c |
| DarkEffekt.Terminal.TermModifiers | modifiers |
OnPaste(string)
Section titled “OnPaste(string)”Text pasted from the clipboard.
public void OnPaste(string text)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
System.String |
text |
OnFocus(bool)
Section titled “OnFocus(bool)”The terminal gained or lost keyboard focus.
public void OnFocus(bool focused)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
System.Boolean |
focused |
OnMouse(in TermMouseEvent)
Section titled “OnMouse(in TermMouseEvent)”public void OnMouse(in TermMouseEvent e)Parameters
Section titled “Parameters”| Type | Name |
|---|---|
| DarkEffekt.Terminal.TermMouseEvent | e |
Events
Section titled “Events”Called every frame with the seconds since the last, before drawing. Animate here.
public event Action<float> TickEvent Type
Section titled “Event Type”System.Action<System.Single>
Closed
Section titled “Closed”Raised by DarkEffekt.Terminal.UI.TerminalUI.Close(), for the program hosting the interface to end.
public event Action ClosedEvent Type
Section titled “Event Type”System.Action