Module: WindowBlessing::Window::KeyboardFocus
- Included in:
- WindowBlessing::Window
- Defined in:
- lib/window_blessing/window.rb
Instance Attribute Summary collapse
-
#focused ⇒ Object
readonly
keyboard focusing.
-
#focused_child ⇒ Object
keyboard focusing.
Instance Method Summary collapse
- #blur ⇒ Object
- #blurred? ⇒ Boolean
- #focus ⇒ Object
- #focused? ⇒ Boolean
- #route_keyboard_event(event) ⇒ Object
Instance Attribute Details
#focused ⇒ Object (readonly)
keyboard focusing
60 61 62 |
# File 'lib/window_blessing/window.rb', line 60 def focused @focused end |
#focused_child ⇒ Object
keyboard focusing
60 61 62 |
# File 'lib/window_blessing/window.rb', line 60 def focused_child @focused_child end |
Instance Method Details
#blur ⇒ Object
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/window_blessing/window.rb', line 80 def blur return if if focused_child focused_child.blur @focused_child = nil end @focused = false handle_event :type => :blur end |
#blurred? ⇒ Boolean
91 |
# File 'lib/window_blessing/window.rb', line 91 def ; !@focused end |
#focus ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/window_blessing/window.rb', line 67 def focus return if focused? if parent parent.focus parent_focused_child = parent.focused_child parent_focused_child.blur if parent_focused_child parent.focused_child = self end @focused = true handle_event :type => :focus end |
#focused? ⇒ Boolean
92 |
# File 'lib/window_blessing/window.rb', line 92 def focused?; !!@focused end |
#route_keyboard_event(event) ⇒ Object
94 95 96 97 98 99 |
# File 'lib/window_blessing/window.rb', line 94 def route_keyboard_event(event) if focused_child focused_child.route_keyboard_event event end handle_event event end |