Table of Contents

Class ConsoleDriver

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

Base class for Terminal.Gui ConsoleDriver implementations.

public abstract class ConsoleDriver
Inheritance
ConsoleDriver
Derived
Inherited Members

Remarks

There are currently four implementations: - CursesDriver (for Unix and Mac) - WindowsDriver - NetDriver that uses the .NET Console API - FakeConsole for unit testing.

Properties

Clip

Gets or sets the clip rectangle that AddRune(Rune) and AddStr(string) are subject to.

Clipboard

Get the operating system clipboard.

Col

Gets the column last set by Move(int, int). Col and Row are used by AddRune(Rune) and AddStr(string) to determine where to add content.

Cols

The number of columns visible in the terminal.

Contents

The contents of the application output. The driver outputs this buffer to the terminal when UpdateScreen() is called. The format of the array is rows, columns. The first index is the row, the second index is the column.

CurrentAttribute

The Attribute that will be used for the next AddRune(Rune) or AddStr(string) call.

Left

The leftmost column in the terminal.

Row

Gets the row last set by Move(int, int). Col and Row are used by AddRune(Rune) and AddStr(string) to determine where to add content.

Rows

The number of rows visible in the terminal.

Screen

Gets the location and size of the terminal screen.

SupportsTrueColor

Gets whether the ConsoleDriver supports TrueColor output.

Top

The topmost row in the terminal.

Methods

AddRune(char)

Adds the specified char to the display at the current cursor position. This method is a convenience method that calls AddRune(Rune) with the Rune constructor.

AddRune(Rune)

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

AddStr(string)

Adds the str to the display at the cursor position.

ClearContents()

Clears the Contents of the driver.

EnsureCursorVisibility()

Determines if the terminal cursor should be visible or not and sets it accordingly.

FillRect(Rectangle, char)

Fills the specified rectangle with the specified char. This method is a convenience method that calls FillRect(Rectangle, Rune).

FillRect(Rectangle, Rune)

Fills the specified rectangle with the specified rune, using CurrentAttribute

GetAttribute()

Gets the current Attribute.

GetCursorVisibility(out CursorVisibility)

Gets the terminal cursor visibility.

GetVersionInfo()

Returns the name of the driver and relevant library version information.

IsRuneSupported(Rune)

Tests if the specified rune is supported by the driver.

IsValidLocation(int, int)

Tests whether the specified coordinate are valid for drawing.

MakeColor(in Color, in Color)

Makes an Attribute.

Move(int, int)

Updates Col and Row to the specified column and row in Contents. Used by AddRune(Rune) and AddStr(string) to determine where to add content.

OnKeyDown(Key)

Called when a key is pressed down. Fires the KeyDown event. This is a precursor to OnKeyUp(Key).

OnKeyUp(Key)

Called when a key is released. Fires the KeyUp event.

OnMouseEvent(MouseEvent)

Called when a mouse event occurs. Fires the MouseEvent event.

OnSizeChanged(SizeChangedEventArgs)

Called when the terminal size changes. Fires the SizeChanged event.

Refresh()

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

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

Simulates a key press.

SetAttribute(Attribute)

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

SetCursorVisibility(CursorVisibility)

Sets the terminal cursor visibility.

Suspend()

Suspends the application (e.g. on Linux via SIGTSTP) and upon resume, resets the console driver.

UpdateCursor()

Sets the position of the terminal cursor to Col and Row.

UpdateScreen()

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

Events

KeyDown

Event fired when a key is pressed down. This is a precursor to KeyUp.

KeyUp

Event fired when a key is released.

MouseEvent

Event fired when a mouse event occurs.

SizeChanged

The event fired when the terminal is resized.