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 [Symbol, String] logical key name (:escape, :enter, "a", "s", etc.)([Symbol, String](: escape, :enter, "a", "s", 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 [Symbol, String, nil] key with modifiers applied([Symbol, String, nil]) ⇒ 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 [Symbol, String, nil] hardware scan code name([Symbol, 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.
-
#window_id ⇒ Object
readonly
Returns the value of attribute window_id.
-
#window_id [String, nil] window that was focused when the event fired([String, nil]) ⇒ 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, window_id: nil) ⇒ 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, window_id: nil) ⇒ Key
Returns a new instance of Key.
110 111 112 113 114 |
# File 'lib/plushie/event.rb', line 110 def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false, window_id: nil) super end |
Instance Attribute Details
#captured ⇒ Object (readonly)
Returns the value of attribute captured
108 109 110 |
# File 'lib/plushie/event.rb', line 108 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.
108 109 110 111 112 113 114 115 |
# File 'lib/plushie/event.rb', line 108 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured, :window_id) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false, window_id: nil) super end end |
#key ⇒ Object (readonly)
Returns the value of attribute key
108 109 110 |
# File 'lib/plushie/event.rb', line 108 def key @key end |
#key [Symbol, String] logical key name (:escape, :enter, "a", "s", etc.)([Symbol, String](: escape, :enter, "a", "s", 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.
108 109 110 111 112 113 114 115 |
# File 'lib/plushie/event.rb', line 108 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured, :window_id) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false, window_id: nil) super end end |
#location ⇒ Object (readonly)
Returns the value of attribute location
108 109 110 |
# File 'lib/plushie/event.rb', line 108 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.
108 109 110 111 112 113 114 115 |
# File 'lib/plushie/event.rb', line 108 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured, :window_id) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false, window_id: nil) super end end |
#modified_key ⇒ Object (readonly)
Returns the value of attribute modified_key
108 109 110 |
# File 'lib/plushie/event.rb', line 108 def modified_key @modified_key end |
#modified_key [Symbol, String, nil] key with modifiers applied([Symbol, 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.
108 109 110 111 112 113 114 115 |
# File 'lib/plushie/event.rb', line 108 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured, :window_id) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false, window_id: nil) super end end |
#modifiers ⇒ Object (readonly)
Returns the value of attribute modifiers
108 109 110 |
# File 'lib/plushie/event.rb', line 108 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.
108 109 110 111 112 113 114 115 |
# File 'lib/plushie/event.rb', line 108 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured, :window_id) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false, window_id: nil) super end end |
#physical_key ⇒ Object (readonly)
Returns the value of attribute physical_key
108 109 110 |
# File 'lib/plushie/event.rb', line 108 def physical_key @physical_key end |
#physical_key [Symbol, String, nil] hardware scan code name([Symbol, 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.
108 109 110 111 112 113 114 115 |
# File 'lib/plushie/event.rb', line 108 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured, :window_id) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false, window_id: nil) super end end |
#repeat ⇒ Object (readonly)
Returns the value of attribute repeat
108 109 110 |
# File 'lib/plushie/event.rb', line 108 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.
108 109 110 111 112 113 114 115 |
# File 'lib/plushie/event.rb', line 108 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured, :window_id) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false, window_id: nil) super end end |
#text ⇒ Object (readonly)
Returns the value of attribute text
108 109 110 |
# File 'lib/plushie/event.rb', line 108 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.
108 109 110 111 112 113 114 115 |
# File 'lib/plushie/event.rb', line 108 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured, :window_id) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false, window_id: nil) super end end |
#type ⇒ Object (readonly)
Returns the value of attribute type
108 109 110 |
# File 'lib/plushie/event.rb', line 108 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.
108 109 110 111 112 113 114 115 |
# File 'lib/plushie/event.rb', line 108 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured, :window_id) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false, window_id: nil) super end end |
#window_id ⇒ Object (readonly)
Returns the value of attribute window_id
108 109 110 |
# File 'lib/plushie/event.rb', line 108 def window_id @window_id end |
#window_id [String, nil] window that was focused when the event fired([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.
108 109 110 111 112 113 114 115 |
# File 'lib/plushie/event.rb', line 108 Key = Data.define(:type, :key, :modified_key, :physical_key, :location, :modifiers, :text, :repeat, :captured, :window_id) do def initialize(type:, key:, modified_key: nil, physical_key: nil, location: :standard, modifiers: {}, text: nil, repeat: false, captured: false, window_id: nil) super end end |