Show / Hide Table of Contents

# Class ConsoleDriver

ConsoleDriver is an abstract class that defines the requirements for a console driver. One implementation if the CursesDriver, and another one uses the .NET Console one.

##### Inheritance

System.Object
ConsoleDriver
CursesDriver

###### Namespace: Terminal.Gui

###### Assembly: Terminal.Gui.dll

##### Syntax

    public abstract class ConsoleDriver

### Constructors

#### ConsoleDriver()

##### Declaration

    protected ConsoleDriver ();

### Fields

#### BottomTee

The bottom tee.

##### Declaration

    public Rune BottomTee;

##### Field Value

Type | Description
--- | ---
System.Rune | To be added.

#### Diamond

Diamond character

##### Declaration

    public Rune Diamond;

##### Field Value

Type | Description
--- | ---
System.Rune | To be added.

#### HLine

Horizontal line character.

##### Declaration

    public Rune HLine;

##### Field Value

Type | Description
--- | ---
System.Rune | To be added.

#### LeftTee

Left tee

##### Declaration

    public Rune LeftTee;

##### Field Value

Type | Description
--- | ---
System.Rune | To be added.

#### LLCorner

Lower left corner

##### Declaration

    public Rune LLCorner;

##### Field Value

Type | Description
--- | ---
System.Rune | To be added.

#### LRCorner

Lower right corner

##### Declaration

    public Rune LRCorner;

##### Field Value

Type | Description
--- | ---
System.Rune | To be added.

#### RightTee

Right tee

##### Declaration

    public Rune RightTee;

##### Field Value

Type | Description
--- | ---
System.Rune | To be added.

#### Stipple

Stipple pattern

##### Declaration

    public Rune Stipple;

##### Field Value

Type | Description
--- | ---
System.Rune | To be added.

#### TopTee

Top tee

##### Declaration

    public Rune TopTee;

##### Field Value

Type | Description
--- | ---
System.Rune | To be added.

#### ULCorner

Upper left corner

##### Declaration

    public Rune ULCorner;

##### Field Value

Type | Description
--- | ---
System.Rune | To be added.

#### URCorner

Upper right corner

##### Declaration

    public Rune URCorner;

##### Field Value

Type | Description
--- | ---
System.Rune | To be added.

#### VLine

Vertical line character.

##### Declaration

    public Rune VLine;

##### Field Value

Type | Description
--- | ---
System.Rune | To be added.

### Properties

#### Clip

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

##### Declaration

    public Terminal.Gui.Rect Clip { get; set; }

##### Property Value

Type | Description
--- | ---
Rect | The clip.

#### Cols

The current number of columns in the terminal.

##### Declaration

    public abstract int Cols { get; }

##### Property Value

Type | Description
--- | ---
System.Int32 | To be added.

#### Rows

The current number of rows in the terminal.

##### Declaration

    public abstract int Rows { get; }

##### Property Value

Type | Description
--- | ---
System.Int32 | To be added.

### Methods

#### AddRune(Rune)

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

##### Declaration

    public abstract void AddRune (Rune rune);

##### Parameters

Type | Name | Description
--- | --- | ---
System.Rune | rune | Rune to add.

#### AddStr(ustring)

Adds the specified

##### Declaration

    public abstract void AddStr (NStack.ustring str);

##### Parameters

Type | Name | Description
--- | --- | ---
NStack.ustring | str | String.

#### CookMouse()

Enables the cooked event processing from the mouse driver

##### Declaration

    public abstract void CookMouse ();

#### DrawFrame(Rect, Int32, Boolean)

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

##### Declaration

    public virtual void DrawFrame (Terminal.Gui.Rect region, int padding, bool fill);

##### Parameters

Type | Name | Description
--- | --- | ---
Rect | region | Region where the frame will be drawn..
System.Int32 | padding | Padding to add on the sides.
System.Boolean | fill | If set to `true` it will clear the contents with the current color, otherwise the contents will be left untouched.

#### End()

Ends the execution of the console driver.

##### Declaration

    public abstract void End ();

#### Init(Action)

Initializes the driver

##### Declaration

    public abstract void Init (Action terminalResized);

##### Parameters

Type | Name | Description
--- | --- | ---
System.Action | terminalResized | Method to invoke when the terminal is resized.

#### MakeAttribute(Color, Color)

##### Declaration

    public abstract Terminal.Gui.Attribute MakeAttribute (Terminal.Gui.Color fore, Terminal.Gui.Color back);

##### Parameters

Type | Name | Description
--- | --- | ---
Color | fore | To be added.
Color | back | To be added.

##### Returns

Type | Description
--- | ---
Attribute | To be added.

#### Move(Int32, Int32)

Moves the cursor to the specified column and row.

##### Declaration

    public abstract void Move (int col, int row);

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32 | col | Column to move the cursor to.
System.Int32 | row | Row to move the cursor to.

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

##### Declaration

    public abstract void PrepareToRun (Mono.Terminal.MainLoop mainLoop, Action<Terminal.Gui.KeyEvent> keyHandler, Action<Terminal.Gui.MouseEvent> mouseHandler);

##### Parameters

Type | Name | Description
--- | --- | ---
MainLoop | mainLoop | To be added.
System.Action<KeyEvent> | keyHandler | To be added.
System.Action<MouseEvent> | mouseHandler | To be added.

#### Refresh()

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

##### Declaration

    public abstract void Refresh ();

#### SetAttribute(Attribute)

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

##### Declaration

    public abstract void SetAttribute (Terminal.Gui.Attribute c);

##### Parameters

Type | Name | Description
--- | --- | ---
Attribute | c | C.

#### SetColors(ConsoleColor, ConsoleColor)

##### Declaration

    public abstract void SetColors (ConsoleColor foreground, ConsoleColor background);

##### Parameters

Type | Name | Description
--- | --- | ---
System.ConsoleColor | foreground | To be added.
System.ConsoleColor | background | To be added.

#### SetColors(Int16, Int16)

Advanced uses - set colors to any pre-set pairs, you would need to init_color that independently with the R, G, B values.

##### Declaration

    public abstract void SetColors (short foregroundColorId, short backgroundColorId);

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int16 | foregroundColorId | Foreground color identifier.
System.Int16 | backgroundColorId | Background color identifier.

#### StartReportingMouseMoves()

##### Declaration

    public abstract void StartReportingMouseMoves ();

#### StopReportingMouseMoves()

##### Declaration

    public abstract void StopReportingMouseMoves ();

#### Suspend()

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

##### Declaration

    public abstract void Suspend ();

#### UncookMouse()

Disables the cooked event processing from the mouse driver. At startup, it is assumed mouse events are cooked.

##### Declaration

    public abstract void UncookMouse ();

#### UpdateCursor()

Updates the location of the cursor position

##### Declaration

    public abstract void UpdateCursor ();

#### UpdateScreen()

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

##### Declaration

    public abstract void UpdateScreen ();