This repository has been archived on 2024-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
Bebop/bebop/mouse.py

31 lines
855 B
Python
Raw Normal View History

2021-03-11 19:16:15 +01:00
"""Mouse support utilities."""
2021-02-12 19:01:42 +01:00
from enum import IntEnum
class ButtonState(IntEnum):
"""Most common flags from curses.getmouse()'s bstate.
Could not find a clear reference for that and released/pressed seem inverted
compared to snippets on the Web, so take portability with a grain of salt.
"""
LEFT_RELEASED = 1 << 0
LEFT_PRESSED = 1 << 1
LEFT_CLICKED = 1 << 2
LEFT_DCLICKED = 1 << 3
LEFT_TCLICKED = 1 << 4
MIDDLE_RELEASED = 1 << 5
MIDDLE_PRESSED = 1 << 6
MIDDLE_CLICKED = 1 << 7
MIDDLE_DCLICKED = 1 << 8
MIDDLE_TCLICKED = 1 << 9
RIGHT_RELEASED = 1 << 10
RIGHT_PRESSED = 1 << 11
RIGHT_CLICKED = 1 << 12
RIGHT_DCLICKED = 1 << 13
RIGHT_TCLICKED = 1 << 14
SCROLL_UP = 1 << 16
SCROLL_DOWN = 1 << 21
SHIFT = 1 << 25
CTRL = 1 << 26