Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions docs/source/enable/mouse_events.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Enable Mouse Events
===================

Enable mouse events are represented by the :class:`~.MouseEvent` type and their
event names (which are the suffixes used by
:py:meth:`enable.interactor.Interactor.dispatch`) can be divided into two
groups: mouse clicks and mouse movements. The mouse click events have names
ending in ``_down``, ``_up``, or ``_dclick`` and names beginning with ``left``,
``right``, or ``middle``. This means that Enable only supports three mouse
buttons (plus wheel events).

Event types
-----------

\*_down
~~~~~~~
A mouse button was pressed. Dispatched as ``left_down``, ``right_down``, or
``middle_down``.

\*_up
~~~~~
A mouse button was released. Dispatched as ``left_up``, ``right_up``, or
``middle_up``.

\*_dclick
~~~~~~~~~
A mouse button was double-clicked. Dispatched as ``left_dclick``,
``right_dclick``, or ``middle_dclick``.

move
~~~~
The mouse moved within a component.

enter
~~~~~
The mouse moved into a component's bounds.

leave
~~~~~
The mouse moved out of a component's bounds.

wheel
~~~~~
The mouse wheel moved.

MouseEvent
----------
Below is a listing of the traits on a `MouseEvent` instance.

.. autoclass:: enable.events.MouseEvent
:members: alt_down, control_down, shift_down, left_down, middle_down, right_down, mouse_wheel, mouse_wheel_axis, mouse_wheel_delta
:noindex:

1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Enable Documentation
enable/abstract_window
enable/constraints_layout
enable/key_events
enable/mouse_events
enable/basic_tools
enable/drag_and_drop
enable/undo_redo
Expand Down
11 changes: 11 additions & 0 deletions enable/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,25 @@ def __repr__(self):


class MouseEvent(BasicEvent):
""" A mouse event.
"""
#: If True, the ALT key is pressed on the keyboard
alt_down = ReadOnly
#: If True, the CTRL key is pressed on the keyboard
control_down = ReadOnly
#: If True, a SHIFT key is pressed on the keyboard
shift_down = ReadOnly
#: If True, the left button is pressed on the mouse
left_down = ReadOnly
#: If True, the middle button is pressed on the mouse
middle_down = ReadOnly
#: If True, the right button is pressed on the mouse
right_down = ReadOnly
#: If a wheel event, holds number of units moved by the wheel
mouse_wheel = ReadOnly
#: If a wheel event, contains either "horizontal" or "vertical"
mouse_wheel_axis = ReadOnly
#: If a wheel event, contains a 2D movement vector as a tuple
mouse_wheel_delta = ReadOnly


Expand Down