Search Results for

    Show / Hide Table of Contents

    Class ConsoleDriver

    ConsoleDriver is an abstract class that defines the requirements for a console driver. There are currently three implementations: Terminal.Gui.CursesDriver (for Unix and Mac), Terminal.Gui.WindowsDriver, and Terminal.Gui.NetDriver that uses the .NET Console API.
    Inheritance
    System.Object
    ConsoleDriver
    FakeDriver
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Terminal.Gui
    Assembly: Terminal.Gui.dll
    Syntax
    public abstract class ConsoleDriver

    Fields

    BlocksMeterSegment

    Blocks Segment indicator for meter views (e.g. ProgressBar.
    Declaration
    public Rune BlocksMeterSegment
    Field Value
    Type Description
    System.Rune

    BottomTee

    The bottom tee.
    Declaration
    public Rune BottomTee
    Field Value
    Type Description
    System.Rune

    Checked

    Checkmark.
    Declaration
    public Rune Checked
    Field Value
    Type Description
    System.Rune

    ContinuousMeterSegment

    Continuous Segment indicator for meter views (e.g. ProgressBar.
    Declaration
    public Rune ContinuousMeterSegment
    Field Value
    Type Description
    System.Rune

    Diamond

    Diamond character
    Declaration
    public Rune Diamond
    Field Value
    Type Description
    System.Rune

    DownArrow

    Down Arrow.
    Declaration
    public Rune DownArrow
    Field Value
    Type Description
    System.Rune

    HDLine

    Horizontal double line character.
    Declaration
    public Rune HDLine
    Field Value
    Type Description
    System.Rune

    HLine

    Horizontal line character.
    Declaration
    public Rune HLine
    Field Value
    Type Description
    System.Rune

    HRLine

    Horizontal line character for rounded corners.
    Declaration
    public Rune HRLine
    Field Value
    Type Description
    System.Rune

    LeftArrow

    Left Arrow.
    Declaration
    public Rune LeftArrow
    Field Value
    Type Description
    System.Rune

    LeftBracket

    Left frame/bracket (e.g. '[' for Button).
    Declaration
    public Rune LeftBracket
    Field Value
    Type Description
    System.Rune

    LeftDefaultIndicator

    Left indicator for default action (e.g. for Button).
    Declaration
    public Rune LeftDefaultIndicator
    Field Value
    Type Description
    System.Rune

    LeftTee

    Left tee
    Declaration
    public Rune LeftTee
    Field Value
    Type Description
    System.Rune

    LLCorner

    Lower left corner
    Declaration
    public Rune LLCorner
    Field Value
    Type Description
    System.Rune

    LLDCorner

    Lower left double corner
    Declaration
    public Rune LLDCorner
    Field Value
    Type Description
    System.Rune

    LLRCorner

    Lower left rounded corner
    Declaration
    public Rune LLRCorner
    Field Value
    Type Description
    System.Rune

    LRCorner

    Lower right corner
    Declaration
    public Rune LRCorner
    Field Value
    Type Description
    System.Rune

    LRDCorner

    Lower right double corner
    Declaration
    public Rune LRDCorner
    Field Value
    Type Description
    System.Rune

    LRRCorner

    Lower right rounded corner
    Declaration
    public Rune LRRCorner
    Field Value
    Type Description
    System.Rune

    RightArrow

    Right Arrow.
    Declaration
    public Rune RightArrow
    Field Value
    Type Description
    System.Rune

    RightBracket

    Right frame/bracket (e.g. ']' for Button).
    Declaration
    public Rune RightBracket
    Field Value
    Type Description
    System.Rune

    RightDefaultIndicator

    Right indicator for default action (e.g. for Button).
    Declaration
    public Rune RightDefaultIndicator
    Field Value
    Type Description
    System.Rune

    RightTee

    Right tee
    Declaration
    public Rune RightTee
    Field Value
    Type Description
    System.Rune

    Selected

    Selected mark.
    Declaration
    public Rune Selected
    Field Value
    Type Description
    System.Rune

    Stipple

    Stipple pattern
    Declaration
    public Rune Stipple
    Field Value
    Type Description
    System.Rune

    TerminalResized

    The handler fired when the terminal is resized.
    Declaration
    protected Action TerminalResized
    Field Value
    Type Description
    System.Action

    TopTee

    Top tee
    Declaration
    public Rune TopTee
    Field Value
    Type Description
    System.Rune

    ULCorner

    Upper left corner
    Declaration
    public Rune ULCorner
    Field Value
    Type Description
    System.Rune

    ULDCorner

    Upper left double corner
    Declaration
    public Rune ULDCorner
    Field Value
    Type Description
    System.Rune

    ULRCorner

    Upper left rounded corner
    Declaration
    public Rune ULRCorner
    Field Value
    Type Description
    System.Rune

    UnChecked

    Un-checked checkmark.
    Declaration
    public Rune UnChecked
    Field Value
    Type Description
    System.Rune

    UnSelected

    Un-selected selected mark.
    Declaration
    public Rune UnSelected
    Field Value
    Type Description
    System.Rune

    UpArrow

    Up Arrow.
    Declaration
    public Rune UpArrow
    Field Value
    Type Description
    System.Rune

    URCorner

    Upper right corner
    Declaration
    public Rune URCorner
    Field Value
    Type Description
    System.Rune

    URDCorner

    Upper right double corner
    Declaration
    public Rune URDCorner
    Field Value
    Type Description
    System.Rune

    URRCorner

    Upper right rounded corner
    Declaration
    public Rune URRCorner
    Field Value
    Type Description
    System.Rune

    VDLine

    Vertical double line character.
    Declaration
    public Rune VDLine
    Field Value
    Type Description
    System.Rune

    VLine

    Vertical line character.
    Declaration
    public Rune VLine
    Field Value
    Type Description
    System.Rune

    VRLine

    Vertical line character for rounded corners.
    Declaration
    public Rune VRLine
    Field Value
    Type Description
    System.Rune

    Properties

    Clip

    Controls the current clipping region that AddRune/AddStr is subject to.
    Declaration
    public Rect Clip { get; set; }
    Property Value
    Type Description
    Rect The clip.

    Clipboard

    Get the operation system clipboard.
    Declaration
    public abstract IClipboard Clipboard { get; }
    Property Value
    Type Description
    IClipboard

    Cols

    The current number of columns in the terminal.
    Declaration
    public abstract int Cols { get; }
    Property Value
    Type Description
    System.Int32

    Diagnostics

    Set flags to enable/disable ConsoleDriver diagnostics.
    Declaration
    public static ConsoleDriver.DiagnosticFlags Diagnostics { get; set; }
    Property Value
    Type Description
    ConsoleDriver.DiagnosticFlags

    HeightAsBuffer

    If false height is measured by the window height and thus no scrolling. If true then height is measured by the buffer height, enabling scrolling.
    Declaration
    public abstract bool HeightAsBuffer { get; set; }
    Property Value
    Type Description
    System.Boolean

    Left

    The current left in the terminal.
    Declaration
    public abstract int Left { get; }
    Property Value
    Type Description
    System.Int32

    Rows

    The current number of rows in the terminal.
    Declaration
    public abstract int Rows { get; }
    Property Value
    Type Description
    System.Int32

    Top

    The current top in the terminal.
    Declaration
    public abstract int Top { get; }
    Property Value
    Type Description
    System.Int32

    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(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(Rect region, int padding, bool fill)
    Parameters
    Type Name Description
    Rect region Screen relative 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.
    Remarks
    This API has been superseded by DrawWindowFrame(Rect, Int32, Int32, Int32, Int32, Boolean, Boolean, Border).

    DrawWindowFrame(Rect, Int32, Int32, Int32, Int32, Boolean, Boolean, Border)

    Draws a frame for a window with padding and an optional visible border inside the padding.
    Declaration
    public virtual void DrawWindowFrame(Rect region, int paddingLeft = 0, int paddingTop = 0, int paddingRight = 0, int paddingBottom = 0, bool border = true, bool fill = false, Border borderContent = null)
    Parameters
    Type Name Description
    Rect region Screen relative region where the frame will be drawn.
    System.Int32 paddingLeft Number of columns to pad on the left (if 0 the border will not appear on the left).
    System.Int32 paddingTop Number of rows to pad on the top (if 0 the border and title will not appear on the top).
    System.Int32 paddingRight Number of columns to pad on the right (if 0 the border will not appear on the right).
    System.Int32 paddingBottom Number of rows to pad on the bottom (if 0 the border will not appear on the bottom).
    System.Boolean border If set to true and any padding dimension is > 0 the border will be drawn.
    System.Boolean fill If set to true it will clear the content area (the area inside the padding) with the current color, otherwise the content area will be left untouched.
    Border borderContent The Border to be used if defined.

    DrawWindowTitle(Rect, ustring, Int32, Int32, Int32, Int32, TextAlignment)

    Draws the title for a Window-style view incorporating padding.
    Declaration
    public virtual void DrawWindowTitle(Rect region, ustring title, int paddingLeft, int paddingTop, int paddingRight, int paddingBottom, TextAlignment textAlignment = TextAlignment.Left)
    Parameters
    Type Name Description
    Rect region Screen relative region where the frame will be drawn.
    NStack.ustring title The title for the window. The title will only be drawn if title is not null or empty and paddingTop is greater than 0.
    System.Int32 paddingLeft Number of columns to pad on the left (if 0 the border will not appear on the left).
    System.Int32 paddingTop Number of rows to pad on the top (if 0 the border and title will not appear on the top).
    System.Int32 paddingRight Number of columns to pad on the right (if 0 the border will not appear on the right).
    System.Int32 paddingBottom Number of rows to pad on the bottom (if 0 the border will not appear on the bottom).
    TextAlignment textAlignment Not yet implemented.

    End()

    Ends the execution of the console driver.
    Declaration
    public abstract void End()

    EnsureCursorVisibility()

    Ensure the cursor visibility
    Declaration
    public abstract bool EnsureCursorVisibility()
    Returns
    Type Description
    System.Boolean true upon success

    GetAttribute()

    Gets the current Attribute.
    Declaration
    public abstract Attribute GetAttribute()
    Returns
    Type Description
    Attribute The current attribute.

    GetColors(Int32, out Color, out Color)

    Gets the foreground and background colors based on the value.
    Declaration
    public abstract bool GetColors(int value, out Color foreground, out Color background)
    Parameters
    Type Name Description
    System.Int32 value The value.
    Color foreground The foreground.
    Color background The background.
    Returns
    Type Description
    System.Boolean

    GetCursorVisibility(out CursorVisibility)

    Retreive the cursor caret visibility
    Declaration
    public abstract bool GetCursorVisibility(out CursorVisibility visibility)
    Parameters
    Type Name Description
    CursorVisibility visibility The current CursorVisibility
    Returns
    Type Description
    System.Boolean true upon success

    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)

    Make the attribute for the foreground and background colors.
    Declaration
    public abstract Attribute MakeAttribute(Color fore, Color back)
    Parameters
    Type Name Description
    Color fore Foreground.
    Color back Background.
    Returns
    Type Description
    Attribute

    MakePrintable(Rune)

    Ensures a Rune is not a control character and can be displayed by translating characters below 0x20 to equivalent, printable, Unicode chars.
    Declaration
    public static Rune MakePrintable(Rune c)
    Parameters
    Type Name Description
    System.Rune c Rune to translate
    Returns
    Type Description
    System.Rune

    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<KeyEvent>, Action<KeyEvent>, Action<MouseEvent>)

    Prepare the driver and set the key and mouse events handlers.
    Declaration
    public abstract void PrepareToRun(MainLoop mainLoop, Action<KeyEvent> keyHandler, Action<KeyEvent> keyDownHandler, Action<KeyEvent> keyUpHandler, Action<MouseEvent> mouseHandler)
    Parameters
    Type Name Description
    MainLoop mainLoop The main loop.
    System.Action<KeyEvent> keyHandler The handler for ProcessKey
    System.Action<KeyEvent> keyDownHandler The handler for key down events
    System.Action<KeyEvent> keyUpHandler The handler for key up events
    System.Action<MouseEvent> mouseHandler The handler for mouse events

    Refresh()

    Updates the screen to reflect all the changes that have been done to the display buffer
    Declaration
    public abstract void Refresh()

    SendKeys(Char, ConsoleKey, Boolean, Boolean, Boolean)

    Allows sending keys without typing on a keyboard.
    Declaration
    public abstract void SendKeys(char keyChar, ConsoleKey key, bool shift, bool alt, bool control)
    Parameters
    Type Name Description
    System.Char keyChar The character key.
    System.ConsoleKey key The key.
    System.Boolean shift If shift key is sending.
    System.Boolean alt If alt key is sending.
    System.Boolean control If control key is sending.

    SetAttribute(Attribute)

    Selects the specified attribute as the attribute to use for future calls to AddRune, AddString.
    Declaration
    public abstract void SetAttribute(Attribute c)
    Parameters
    Type Name Description
    Attribute c C.

    SetColors(ConsoleColor, ConsoleColor)

    Set Colors from limit sets of colors.
    Declaration
    public abstract void SetColors(ConsoleColor foreground, ConsoleColor background)
    Parameters
    Type Name Description
    System.ConsoleColor foreground Foreground.
    System.ConsoleColor background Background.

    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.

    SetCursorVisibility(CursorVisibility)

    Change the cursor caret visibility
    Declaration
    public abstract bool SetCursorVisibility(CursorVisibility visibility)
    Parameters
    Type Name Description
    CursorVisibility visibility The wished CursorVisibility
    Returns
    Type Description
    System.Boolean true upon success

    SetTerminalResized(Action)

    Set the handler when the terminal is resized.
    Declaration
    public void SetTerminalResized(Action terminalResized)
    Parameters
    Type Name Description
    System.Action terminalResized

    StartReportingMouseMoves()

    Start of mouse moves.
    Declaration
    public abstract void StartReportingMouseMoves()

    StopReportingMouseMoves()

    Stop reporting mouses moves.
    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()
    In This Article
    Back to top Generated by DocFX