Interface IDriver
Base interface for Terminal.Gui Driver implementations.
public interface IDriver : IDisposable
- Inherited Members
Remarks
There are currently four implementations: UnixDriver, WindowsDriver, DotNetDriver, and FakeDriver
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
Gets or sets the contents of the application output. The driver outputs this buffer to the terminal.
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.
- Force16Colors
Gets or sets whether the IDriver should use 16 colors instead of the default TrueColors.
- IsLegacyConsole
Gets whether the driver has detected the console requires legacy console API (Windows Console API without ANSI/VT support). Returns true for legacy consoles that don't support modern ANSI escape sequences (e.g. Windows conhost); false for modern terminals with ANSI/VT support.
- 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 IDriver 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
strto the display at the cursor position.
- ClearContents()
Clears the Contents of the driver.
- EnqueueKeyEvent(Key)
Enqueues a key input event to the driver. For unit tests.
- 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.
- GetInputProcessor()
Class responsible for processing native driver input objects e.g. ConsoleKeyInfo into Key events and detecting and processing ansi escape sequences.
- GetName()
Gets the name of the driver implementation.
- GetOutput()
Gets the output handler responsible for writing to the terminal.
- GetSixels()
Gets the queue of sixel images to write out to screen when updating. If the terminal does not support Sixel, adding to this queue has no effect.
- GetVersionInfo()
Returns the name of the driver and relevant library version information.
- Init()
Initializes the driver
- IsRuneSupported(Rune)
Tests if the specified rune is supported by the driver.
- IsValidLocation(string, int, int)
Tests whether the specified coordinate are valid for drawing the specified Text.
- 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.
- QueueAnsiRequest(AnsiEscapeSequenceRequest)
Queues the given
requestfor execution
- Refresh()
INTERNAL: Updates the terminal with the current output buffer. Should not be used by applications. Drawing occurs once each Application main loop iteration.
- 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.
- SetScreenSize(int, int)
Sets the screen size. Screen is the source of truth for screen dimensions.
- Suspend()
Suspends the application (e.g. on Linux via SIGTSTP) and upon resume, resets the console driver.
- ToAnsi()
Gets an ANSI escape sequence representation of Contents. This is the same output as would be written to the terminal to recreate the current screen contents.
- ToString()
Gets a string representation of Contents.
- WriteRaw(string)
Provide proper writing to send escape sequence recognized by the IDriver.
Events
- ClearedContents
Fills the specified rectangle with the specified rune, using CurrentAttribute
- KeyUp
Event fired when a key is released.
- MouseEvent
Event fired when a mouse event occurs.
- SizeChanged
The event fired when the screen changes (size, position, etc.). Screen is the source of truth for screen dimensions.