Class: Plushie::Event::Key
- Inherits:
-
Data
- Object
- Data
- Plushie::Event::Key
- Defined in:
- lib/plushie/event.rb
Overview
Keyboard events delivered when keys are pressed or released. Triggered by keyboard input while the window has focus. Subscribe via Subscription.on_key_press or Subscription.on_key_release.
Instance Attribute Summary collapse
-
#captured ⇒ Object
readonly
Returns the value of attribute captured.
-
#captured [Boolean] true if a widget consumed this event([Boolean]) ⇒ Object
readonly
Keyboard events delivered when keys are pressed or released.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#key [String] logical key name ("a", "Enter", "ArrowUp", etc.)([String]("a", "Enter", "ArrowUp", etc.)) ⇒ Object
readonly
Keyboard events delivered when keys are pressed or released.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#location [Symbol] key location (:standard, :left, :right, :numpad)([Symbol](: standard, :left, :right, :numpad)) ⇒ Object
readonly
Keyboard events delivered when keys are pressed or released.
-
#modified_key ⇒ Object
readonly
Returns the value of attribute modified_key.
-
#modified_key [String, nil] key with modifiers applied (e.g. "S" for shift+s)([String, nil](e.g. "S") ⇒ Object
readonly
Keyboard events delivered when keys are pressed or released.
-
#modifiers ⇒ Object
readonly
Returns the value of attribute modifiers.
-
#modifiers [Hash] active modifier state ({shift: true, command: false, ...})([Hash]({shift: true, command: false, ...})) ⇒ Object
readonly
Keyboard events delivered when keys are pressed or released.
-
#physical_key ⇒ Object
readonly
Returns the value of attribute physical_key.
-
#physical_key [String, nil] hardware scan code name([String, nil]) ⇒ Object
readonly
Keyboard events delivered when keys are pressed or released.
-
#repeat ⇒ Object
readonly
Returns the value of attribute repeat.
-
#repeat [Boolean] true if this is a key-repeat event([Boolean]) ⇒ Object
readonly
Keyboard events delivered when keys are pressed or released.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#text [String, nil] text produced by the key event (nil for non-printable keys)([String, nil](nil) ⇒ Object
readonly
Keyboard events delivered when keys are pressed or released.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#type [Symbol] :press or :release([Symbol]) ⇒ Object
readonly
Keyboard events delivered when keys are pressed or released.
Instance Method Summary collapse
-
#initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false) ⇒ Key
constructor
A new instance of Key.
Constructor Details
#initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false) ⇒ Key
Returns a new instance of Key.
56 57 58 59 |
# File 'lib/plushie/event.rb', line 56 def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false) super end |
Instance Attribute Details
#captured ⇒ Object (readonly)
Returns the value of attribute captured
54 55 56 |
# File 'lib/plushie/event.rb', line 54 def captured @captured end |
#captured [Boolean] true if a widget consumed this event([Boolean]) ⇒ Object (readonly)
Keyboard events delivered when keys are pressed or released. Triggered by keyboard input while the window has focus. Subscribe via Subscription.on_key_press or Subscription.on_key_release.
54 55 56 57 58 59 60 |
# File 'lib/plushie/event.rb', line 54 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false) super end end |
#key ⇒ Object (readonly)
Returns the value of attribute key
54 55 56 |
# File 'lib/plushie/event.rb', line 54 def key @key end |
#key [String] logical key name ("a", "Enter", "ArrowUp", etc.)([String]("a", "Enter", "ArrowUp", etc.)) ⇒ Object (readonly)
Keyboard events delivered when keys are pressed or released. Triggered by keyboard input while the window has focus. Subscribe via Subscription.on_key_press or Subscription.on_key_release.
54 55 56 57 58 59 60 |
# File 'lib/plushie/event.rb', line 54 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false) super end end |
#location ⇒ Object (readonly)
Returns the value of attribute location
54 55 56 |
# File 'lib/plushie/event.rb', line 54 def location @location end |
#location [Symbol] key location (:standard, :left, :right, :numpad)([Symbol](: standard, :left, :right, :numpad)) ⇒ Object (readonly)
Keyboard events delivered when keys are pressed or released. Triggered by keyboard input while the window has focus. Subscribe via Subscription.on_key_press or Subscription.on_key_release.
54 55 56 57 58 59 60 |
# File 'lib/plushie/event.rb', line 54 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false) super end end |
#modified_key ⇒ Object (readonly)
Returns the value of attribute modified_key
54 55 56 |
# File 'lib/plushie/event.rb', line 54 def modified_key @modified_key end |
#modified_key [String, nil] key with modifiers applied (e.g. "S" for shift+s)([String, nil](e.g. "S") ⇒ Object (readonly)
Keyboard events delivered when keys are pressed or released. Triggered by keyboard input while the window has focus. Subscribe via Subscription.on_key_press or Subscription.on_key_release.
54 55 56 57 58 59 60 |
# File 'lib/plushie/event.rb', line 54 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false) super end end |
#modifiers ⇒ Object (readonly)
Returns the value of attribute modifiers
54 55 56 |
# File 'lib/plushie/event.rb', line 54 def modifiers @modifiers end |
#modifiers [Hash] active modifier state ({shift: true, command: false, ...})([Hash]({shift: true, command: false, ...})) ⇒ Object (readonly)
Keyboard events delivered when keys are pressed or released. Triggered by keyboard input while the window has focus. Subscribe via Subscription.on_key_press or Subscription.on_key_release.
54 55 56 57 58 59 60 |
# File 'lib/plushie/event.rb', line 54 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false) super end end |
#physical_key ⇒ Object (readonly)
Returns the value of attribute physical_key
54 55 56 |
# File 'lib/plushie/event.rb', line 54 def physical_key @physical_key end |
#physical_key [String, nil] hardware scan code name([String, nil]) ⇒ Object (readonly)
Keyboard events delivered when keys are pressed or released. Triggered by keyboard input while the window has focus. Subscribe via Subscription.on_key_press or Subscription.on_key_release.
54 55 56 57 58 59 60 |
# File 'lib/plushie/event.rb', line 54 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false) super end end |
#repeat ⇒ Object (readonly)
Returns the value of attribute repeat
54 55 56 |
# File 'lib/plushie/event.rb', line 54 def repeat @repeat end |
#repeat [Boolean] true if this is a key-repeat event([Boolean]) ⇒ Object (readonly)
Keyboard events delivered when keys are pressed or released. Triggered by keyboard input while the window has focus. Subscribe via Subscription.on_key_press or Subscription.on_key_release.
54 55 56 57 58 59 60 |
# File 'lib/plushie/event.rb', line 54 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false) super end end |
#text ⇒ Object (readonly)
Returns the value of attribute text
54 55 56 |
# File 'lib/plushie/event.rb', line 54 def text @text end |
#text [String, nil] text produced by the key event (nil for non-printable keys)([String, nil](nil) ⇒ Object (readonly)
Keyboard events delivered when keys are pressed or released. Triggered by keyboard input while the window has focus. Subscribe via Subscription.on_key_press or Subscription.on_key_release.
54 55 56 57 58 59 60 |
# File 'lib/plushie/event.rb', line 54 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false) super end end |
#type ⇒ Object (readonly)
Returns the value of attribute type
54 55 56 |
# File 'lib/plushie/event.rb', line 54 def type @type end |
#type [Symbol] :press or :release([Symbol]) ⇒ Object (readonly)
Keyboard events delivered when keys are pressed or released. Triggered by keyboard input while the window has focus. Subscribe via Subscription.on_key_press or Subscription.on_key_release.
54 55 56 57 58 59 60 |
# File 'lib/plushie/event.rb', line 54 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false) super end end |