wijjit.core.events.MouseEvent

class wijjit.core.events.MouseEvent(event_type=None, timestamp=<factory>, cancelled=False, mouse_event=None, element_id=None)[source]

Mouse input event.

Fired when a mouse event occurs (click, move, scroll, etc.). Wraps the terminal layer’s MouseEvent to integrate with the core event system.

Parameters:
  • mouse_event (TerminalMouseEvent) – The underlying terminal mouse event

  • element_id (str or None) – ID of the element at the mouse position (if any)

  • event_type (EventType | None)

  • timestamp (datetime)

  • cancelled (bool)

Variables:
  • mouse_event (TerminalMouseEvent) – The underlying terminal mouse event

  • element_id (str or None) – ID of the element at the mouse position

  • x (int) – Column position (0-based)

  • y (int) – Row position (0-based)

  • button (MouseButton) – Button that triggered the event

  • mouse_type (MouseEventType) – Type of mouse event (CLICK, PRESS, MOVE, etc.)

  • shift (bool) – Whether Shift key was pressed

  • alt (bool) – Whether Alt key was pressed

  • ctrl (bool) – Whether Ctrl key was pressed

  • click_count (int) – Number of clicks (1=single, 2=double)

__init__(event_type=None, timestamp=<factory>, cancelled=False, mouse_event=None, element_id=None)
Parameters:
Return type:

None

Methods

__init__([event_type, timestamp, cancelled, ...])

cancel()

Cancel the event.

Attributes

alt

Get alt modifier state.

button

Get button from mouse event.

cancelled

click_count

Get click count.

ctrl

Get ctrl modifier state.

element_id

event_type

mouse_event

mouse_type

Get mouse event type.

shift

Get shift modifier state.

x

Get x coordinate from mouse event.

y

Get y coordinate from mouse event.

timestamp

mouse_event: MouseEvent | None = None
element_id: str | None = None
__post_init__()[source]

Initialize event type and convenience attributes.

Return type:

None

property x: int

Get x coordinate from mouse event.

property y: int

Get y coordinate from mouse event.

property button: MouseButton

Get button from mouse event.

property mouse_type: MouseEventType

Get mouse event type.

property shift: bool

Get shift modifier state.

property alt: bool

Get alt modifier state.

property ctrl: bool

Get ctrl modifier state.

property click_count: int

Get click count.