Module: FFI::NCurses::Mouse

Included in:
FFI::NCurses, Ncurses
Defined in:
lib/ffi-ncurses/mouse.rb

Defined Under Namespace

Classes: MEVENT

Constant Summary collapse

NCURSES_MOUSE_VERSION =
1
NCURSES_BUTTON_RELEASED =
001
NCURSES_BUTTON_PRESSED =
002
NCURSES_BUTTON_CLICKED =
004
NCURSES_DOUBLE_CLICKED =
010
NCURSES_TRIPLE_CLICKED =
020
NCURSES_RESERVED_EVENT =
040
BUTTON1_RELEASED =

event masks

NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED)
BUTTON1_PRESSED =
NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED)
BUTTON1_CLICKED =
NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED)
BUTTON1_DOUBLE_CLICKED =
NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED)
BUTTON1_TRIPLE_CLICKED =
NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED)
BUTTON2_RELEASED =
NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED)
BUTTON2_PRESSED =
NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED)
BUTTON2_CLICKED =
NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED)
BUTTON2_DOUBLE_CLICKED =
NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED)
BUTTON2_TRIPLE_CLICKED =
NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED)
BUTTON3_RELEASED =
NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED)
BUTTON3_PRESSED =
NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED)
BUTTON3_CLICKED =
NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED)
BUTTON3_DOUBLE_CLICKED =
NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED)
BUTTON3_TRIPLE_CLICKED =
NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED)
BUTTON4_RELEASED =
NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED)
BUTTON4_PRESSED =
NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED)
BUTTON4_CLICKED =
NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED)
BUTTON4_DOUBLE_CLICKED =
NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED)
BUTTON4_TRIPLE_CLICKED =
NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED)
BUTTON5_RELEASED =
NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED)
BUTTON5_PRESSED =
NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED)
BUTTON5_CLICKED =
NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED)
BUTTON5_DOUBLE_CLICKED =
NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED)
BUTTON5_TRIPLE_CLICKED =
NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED)
BUTTON_CTRL =
NCURSES_MOUSE_MASK(5, 0001)
BUTTON_SHIFT =
NCURSES_MOUSE_MASK(5, 0002)
BUTTON_ALT =
NCURSES_MOUSE_MASK(5, 0004)
REPORT_MOUSE_POSITION =
NCURSES_MOUSE_MASK(5, 0010)
BUTTON1_RESERVED_EVENT =
NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT)
BUTTON2_RESERVED_EVENT =
NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT)
BUTTON3_RESERVED_EVENT =
NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT)
BUTTON4_RESERVED_EVENT =
NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT)
ALL_MOUSE_EVENTS =
(REPORT_MOUSE_POSITION - 1)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.NCURSES_MOUSE_MASK(b, m) ⇒ Object



10
11
12
# File 'lib/ffi-ncurses/mouse.rb', line 10

def self.NCURSES_MOUSE_MASK(b,m)
  ((m) << (((b) - 1) * 5))
end

Instance Method Details

#BUTTON_CLICK(e, x) ⇒ Object



92
93
94
# File 'lib/ffi-ncurses/mouse.rb', line 92

def BUTTON_CLICK(e, x)
  ((e) & (004 << (6 * ((x) - 1))))
end

#BUTTON_DOUBLE_CLICK(e, x) ⇒ Object



95
96
97
# File 'lib/ffi-ncurses/mouse.rb', line 95

def BUTTON_DOUBLE_CLICK(e, x)
  ((e) & (010 << (6 * ((x) - 1))))
end

#BUTTON_PRESS(e, x) ⇒ Object



89
90
91
# File 'lib/ffi-ncurses/mouse.rb', line 89

def BUTTON_PRESS(e, x)
  ((e) & (002 << (6 * ((x) - 1))))
end

#BUTTON_RELEASE(e, x) ⇒ Object

macros to extract single event-bits from masks



86
87
88
# File 'lib/ffi-ncurses/mouse.rb', line 86

def BUTTON_RELEASE(e, x)
  ((e) & (001 << (6 * ((x) - 1))))
end

#BUTTON_RESERVED_EVENT(e, x) ⇒ Object



101
102
103
# File 'lib/ffi-ncurses/mouse.rb', line 101

def BUTTON_RESERVED_EVENT(e, x)
  ((e) & (040 << (6 * ((x) - 1))))
end

#BUTTON_TRIPLE_CLICK(e, x) ⇒ Object



98
99
100
# File 'lib/ffi-ncurses/mouse.rb', line 98

def BUTTON_TRIPLE_CLICK(e, x)
  ((e) & (020 << (6 * ((x) - 1))))
end