Class: Mac::EventMonitor::KeyboardEvent
- Defined in:
- lib/mac-event-monitor/event/keyboard_event.rb
Instance Attribute Summary collapse
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
-
#keycode ⇒ Object
readonly
Returns the value of attribute keycode.
Attributes inherited from Event
Instance Method Summary collapse
- #alt_key? ⇒ Boolean
- #command_key? ⇒ Boolean
- #ctrl_key? ⇒ Boolean
- #function_key? ⇒ Boolean
- #help_key? ⇒ Boolean
-
#initialize(type, keycode, flags) ⇒ KeyboardEvent
constructor
A new instance of KeyboardEvent.
- #num_pad_key? ⇒ Boolean
- #shift_key? ⇒ Boolean
Methods inherited from Event
Constructor Details
#initialize(type, keycode, flags) ⇒ KeyboardEvent
Returns a new instance of KeyboardEvent.
6 7 8 9 10 11 |
# File 'lib/mac-event-monitor/event/keyboard_event.rb', line 6 def initialize(type, keycode, flags) super(type) @keycode = keycode.to_i @flags = flags.to_i(16) end |
Instance Attribute Details
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
4 5 6 |
# File 'lib/mac-event-monitor/event/keyboard_event.rb', line 4 def flags @flags end |
#keycode ⇒ Object (readonly)
Returns the value of attribute keycode.
4 5 6 |
# File 'lib/mac-event-monitor/event/keyboard_event.rb', line 4 def keycode @keycode end |
Instance Method Details
#alt_key? ⇒ Boolean
21 22 23 |
# File 'lib/mac-event-monitor/event/keyboard_event.rb', line 21 def alt_key? check_flag(19) end |
#command_key? ⇒ Boolean
25 26 27 |
# File 'lib/mac-event-monitor/event/keyboard_event.rb', line 25 def command_key? check_flag(20) end |
#ctrl_key? ⇒ Boolean
17 18 19 |
# File 'lib/mac-event-monitor/event/keyboard_event.rb', line 17 def ctrl_key? check_flag(18) end |
#function_key? ⇒ Boolean
37 38 39 |
# File 'lib/mac-event-monitor/event/keyboard_event.rb', line 37 def function_key? check_flag(23) end |
#help_key? ⇒ Boolean
33 34 35 |
# File 'lib/mac-event-monitor/event/keyboard_event.rb', line 33 def help_key? check_flag(22) end |
#num_pad_key? ⇒ Boolean
29 30 31 |
# File 'lib/mac-event-monitor/event/keyboard_event.rb', line 29 def num_pad_key? check_flag(21) end |
#shift_key? ⇒ Boolean
13 14 15 |
# File 'lib/mac-event-monitor/event/keyboard_event.rb', line 13 def shift_key? check_flag(16) || check_flag(17) end |