Table of Contents

Class ConsoleDriver

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

ConsoleDriver is an abstract class that defines the requirements for a console driver.
There are currently three implementations: CursesDriver (for Unix and Mac), WindowsDriver, and NetDriver that uses the .NET Console API.

public abstract class ConsoleDriver
Inheritance
ConsoleDriver
Derived
Inherited Members

Fields

BlocksMeterSegment

Blocks Segment indicator for meter views (e.g. ProgressBar.

BottomTee

The bottom tee.

Checked

Checkmark.

ContinuousMeterSegment

Continuous Segment indicator for meter views (e.g. ProgressBar.

Diamond

Diamond character

DownArrow

Down Arrow.

HDLine

Horizontal double line character.

HLine

Horizontal line character.

HRLine

Horizontal line character for rounded corners.

LLCorner

Lower left corner

LLDCorner

Lower left double corner

LLRCorner

Lower left rounded corner

LRCorner

Lower right corner

LRDCorner

Lower right double corner

LRRCorner

Lower right rounded corner

LeftArrow

Left Arrow.

LeftBracket

Left frame/bracket (e.g. '[' for Button).

LeftDefaultIndicator

Left indicator for default action (e.g. for Button).

LeftTee

Left tee

RightArrow

Right Arrow.

RightBracket

Right frame/bracket (e.g. ']' for Button).

RightDefaultIndicator

Right indicator for default action (e.g. for Button).

RightTee

Right tee

Selected

Selected mark.

Stipple

Stipple pattern

TerminalResized

The handler fired when the terminal is resized.

TopTee

Top tee

ULCorner

Upper left corner

ULDCorner

Upper left double corner

ULRCorner

Upper left rounded corner

URCorner

Upper right corner

URDCorner

Upper right double corner

URRCorner

Upper right rounded corner

UnChecked

Un-checked checkmark.

UnSelected

Un-selected selected mark.

UpArrow

Up Arrow.

VDLine

Vertical double line character.

VLine

Vertical line character.

VRLine

Vertical line character for rounded corners.

Properties

Clip

Controls the current clipping region that AddRune/AddStr is subject to.

Clipboard

Get the operation system clipboard.

Cols

The current number of columns in the terminal.

Contents

The format is rows, columns and 3 values on the last column: Rune, Attribute and Dirty Flag

CurrentAttribute

The current attribute the driver is using.

Diagnostics

Set flags to enable/disable ConsoleDriver diagnostics.

EnableConsoleScrolling

If false (the default) the height of the Terminal.Gui application (Rows) tracks to the height of the visible console view when the console is resized. In this case scrolling in the console will be disabled and all Rows will remain visible.

If true then height of the Terminal.Gui application Rows only tracks the height of the visible console view when the console is made larger (the application will only grow in height, never shrink). In this case console scrolling is enabled and the contents (Rows high) will scroll as the console scrolls.

HeightAsBuffer

This API is deprecated and has no impact when enabled.

Left

The current left in the terminal.

Rows

The current number of rows in the terminal.

Top

The current top in the terminal.

Methods

AddRune(Rune)

Adds the specified rune to the display at the current cursor position.

AddStr(ustring)

Adds the str to the display at the cursor position.

CookMouse()

Enables the cooked event processing from the mouse driver. Not implemented by any driver: See Issue #2300.

DrawFrame(Rect, int, bool)

Draws a frame on the specified region with the specified padding around the frame.

DrawWindowFrame(Rect, int, int, int, int, bool, bool, Border)

Draws a frame for a window with padding and an optional visible border inside the padding.

DrawWindowTitle(Rect, ustring, int, int, int, int, TextAlignment)

Draws the title for a Window-style view incorporating padding.

End()

Ends the execution of the console driver.

EnsureCursorVisibility()

Ensure the cursor visibility

GetAttribute()

Gets the current Attribute.

GetColors(int, out Color, out Color)

Gets the foreground and background colors based on the value.

GetCursorVisibility(out CursorVisibility)

Retreive the cursor caret visibility

Init(Action)

Initializes the driver

InitalizeColorSchemes(bool)

Ensures all Attributes in ColorSchemes are correctly initialized by the driver.

IsValidContent(int, int, Rect)

Ensures that the column and line are in a valid range from the size of the driver.

MakeAttribute(Color, Color)

Make the attribute for the foreground and background colors.

MakeColor(Color, Color)

Make the Colors for the ColorScheme.

MakePrintable(Rune)

Ensures a Rune is not a control character and can be displayed by translating characters below 0x20 to equivalent, printable, Unicode chars.

Move(int, int)

Moves the cursor to the specified column and row.

PrepareToRun(MainLoop, Action<KeyEvent>, Action<KeyEvent>, Action<KeyEvent>, Action<MouseEvent>)

Prepare the driver and set the key and mouse events handlers.

Refresh()

Updates the screen to reflect all the changes that have been done to the display buffer

ResizeScreen()

Resizes the clip area when the screen is resized.

SendKeys(char, ConsoleKey, bool, bool, bool)

Allows sending keys without typing on a keyboard.

SetAttribute(Attribute)

Selects the specified attribute as the attribute to use for future calls to AddRune and AddString.

SetColors(ConsoleColor, ConsoleColor)

Set Colors from limit sets of colors. Not implemented by any driver: See Issue #2300.

SetColors(short, short)

Advanced uses - set colors to any pre-set pairs, you would need to init_color that independently with the R, G, B values. Not implemented by any driver: See Issue #2300.

SetCursorVisibility(CursorVisibility)

Change the cursor caret visibility

SetTerminalResized(Action)

Set the handler when the terminal is resized.

StartReportingMouseMoves()

Start of mouse moves.

StopReportingMouseMoves()

Stop reporting mouses moves.

Suspend()

Suspend the application, typically needs to save the state, suspend the app and upon return, reset the console driver.

UncookMouse()

Disables the cooked event processing from the mouse driver. At startup, it is assumed mouse events are cooked. Not implemented by any driver: See Issue #2300.

UpdateCursor()

Updates the location of the cursor position

UpdateOffScreen()

Reset and recreate the contents and the driver buffer.

UpdateScreen()

Redraws the physical screen with the contents that have been queued up via any of the printing commands.