Table of Contents

Class CursorState

Namespace
SharpConsoleUI.Core
Assembly
SharpConsoleUI.dll

Immutable record representing the current state of the cursor. Provides a single source of truth for cursor visibility, position, and ownership.

public record CursorState : IEquatable<CursorState>
Inheritance
CursorState
Implements
Inherited Members

Constructors

CursorState(bool, Point?, Point?, IWindowControl?, Window?, CursorShape)

Creates a new cursor state

public CursorState(bool isVisible = false, Point? absolutePosition = null, Point? logicalPosition = null, IWindowControl? ownerControl = null, Window? ownerWindow = null, CursorShape shape = CursorShape.Block)

Parameters

isVisible bool
absolutePosition Point?
logicalPosition Point?
ownerControl IWindowControl
ownerWindow Window
shape CursorShape

Fields

Hidden

A hidden cursor state with no owner

public static readonly CursorState Hidden

Field Value

CursorState

Properties

AbsolutePosition

Absolute screen position of the cursor

public Point AbsolutePosition { get; init; }

Property Value

Point

IsVisible

Whether the cursor is currently visible

public bool IsVisible { get; init; }

Property Value

bool

LogicalPosition

Logical position within the owner control's coordinate space (if any)

public Point? LogicalPosition { get; init; }

Property Value

Point?

OwnerControl

The control that currently owns the cursor (if any)

public IWindowControl? OwnerControl { get; init; }

Property Value

IWindowControl

OwnerWindow

The window containing the cursor owner control (if any)

public Window? OwnerWindow { get; init; }

Property Value

Window

Shape

The visual shape/style of the cursor

public CursorShape Shape { get; init; }

Property Value

CursorShape

UpdateTime

Timestamp when this state was created

public DateTime UpdateTime { get; init; }

Property Value

DateTime

Methods

HasOwnerChanged(CursorState)

Returns true if cursor owner has changed compared to another state

public bool HasOwnerChanged(CursorState other)

Parameters

other CursorState

Returns

bool

HasPositionChanged(CursorState)

Returns true if cursor position has changed compared to another state

public bool HasPositionChanged(CursorState other)

Parameters

other CursorState

Returns

bool

HasVisibilityChanged(CursorState)

Returns true if cursor visibility has changed compared to another state

public bool HasVisibilityChanged(CursorState other)

Parameters

other CursorState

Returns

bool