Table of Contents

Class MouseEventArgs

Namespace
SharpConsoleUI.Events
Assembly
SharpConsoleUI.dll

Event arguments for mouse events

public class MouseEventArgs
Inheritance
MouseEventArgs
Inherited Members
Extension Methods

Constructors

MouseEventArgs(List<MouseFlags>, Point, Point, Point, Window?)

Creates a new MouseEventArgs instance

public MouseEventArgs(List<MouseFlags> flags, Point position, Point absolutePosition, Point windowPosition, Window? sourceWindow = null)

Parameters

flags List<MouseFlags>
position Point
absolutePosition Point
windowPosition Point
sourceWindow Window

Properties

AbsolutePosition

Absolute position in desktop coordinates

public Point AbsolutePosition { get; set; }

Property Value

Point

Flags

Mouse flags indicating the type of mouse event

public List<MouseFlags> Flags { get; set; }

Property Value

List<MouseFlags>

Handled

Whether this event has been handled and should not propagate further

public bool Handled { get; set; }

Property Value

bool

Position

Position relative to the control receiving the event

public Point Position { get; set; }

Property Value

Point

SourceWindow

The window that received the mouse event

public Window? SourceWindow { get; set; }

Property Value

Window

WindowPosition

Position relative to the window containing the control

public Point WindowPosition { get; set; }

Property Value

Point

Methods

HasAnyFlag(params MouseFlags[])

Convenience method to check if any of the specified flags are present. Uses bitwise checking to support both separate list entries (X10) and combined flag values (SGR).

public bool HasAnyFlag(params MouseFlags[] flags)

Parameters

flags MouseFlags[]

Returns

bool

HasFlag(MouseFlags)

Convenience method to check if specific mouse flags are present. Uses bitwise checking to support both separate list entries (X10) and combined flag values (SGR).

public bool HasFlag(MouseFlags flag)

Parameters

flag MouseFlags

Returns

bool

WithFlags(params MouseFlags[])

Creates a copy of this event args with additional flags

public MouseEventArgs WithFlags(params MouseFlags[] additionalFlags)

Parameters

additionalFlags MouseFlags[]

Returns

MouseEventArgs

WithPosition(Point)

Creates a copy of this event args with a new position (for coordinate translation)

public MouseEventArgs WithPosition(Point newPosition)

Parameters

newPosition Point

Returns

MouseEventArgs

WithReplacedFlags(params MouseFlags[])

Creates a copy of this event args with flags replaced

public MouseEventArgs WithReplacedFlags(params MouseFlags[] replacementFlags)

Parameters

replacementFlags MouseFlags[]

Returns

MouseEventArgs