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
isVisibleboolabsolutePositionPoint?logicalPositionPoint?ownerControlIWindowControlownerWindowWindowshapeCursorShape
Fields
Hidden
A hidden cursor state with no owner
public static readonly CursorState Hidden
Field Value
Properties
AbsolutePosition
Absolute screen position of the cursor
public Point AbsolutePosition { get; init; }
Property Value
IsVisible
Whether the cursor is currently visible
public bool IsVisible { get; init; }
Property Value
LogicalPosition
Logical position within the owner control's coordinate space (if any)
public Point? LogicalPosition { get; init; }
Property Value
OwnerControl
The control that currently owns the cursor (if any)
public IWindowControl? OwnerControl { get; init; }
Property Value
OwnerWindow
The window containing the cursor owner control (if any)
public Window? OwnerWindow { get; init; }
Property Value
Shape
The visual shape/style of the cursor
public CursorShape Shape { get; init; }
Property Value
UpdateTime
Timestamp when this state was created
public DateTime UpdateTime { get; init; }
Property Value
Methods
HasOwnerChanged(CursorState)
Returns true if cursor owner has changed compared to another state
public bool HasOwnerChanged(CursorState other)
Parameters
otherCursorState
Returns
HasPositionChanged(CursorState)
Returns true if cursor position has changed compared to another state
public bool HasPositionChanged(CursorState other)
Parameters
otherCursorState
Returns
HasVisibilityChanged(CursorState)
Returns true if cursor visibility has changed compared to another state
public bool HasVisibilityChanged(CursorState other)
Parameters
otherCursorState