Class: PPCurses::ResponderManager
- Defined in:
- lib/ppcurses/application.rb
Overview
Derived from methods defined in Cocoa NSWindow
Current link, which probably won’t be valid in the future …
Direct Known Subclasses
Instance Attribute Summary collapse
-
#first_responder ⇒ Object
The first responder is the first object in a responder chain to receive an event or action message.
Attributes inherited from Responder
Instance Method Summary collapse
- #accepts_first_responder ⇒ Object
-
#make_first_responder(responder) ⇒ Object
Attempts to make a given responder the first responder.
Methods inherited from Responder
#become_first_responder, isa, #key_down, #resign_first_responder
Instance Attribute Details
#first_responder ⇒ Object
The first responder is the first object in a responder chain to receive an event or action message.
72 73 74 |
# File 'lib/ppcurses/application.rb', line 72 def first_responder @first_responder end |
Instance Method Details
#accepts_first_responder ⇒ Object
74 75 76 |
# File 'lib/ppcurses/application.rb', line 74 def accepts_first_responder YES end |
#make_first_responder(responder) ⇒ Object
Attempts to make a given responder the first responder
If responder isn’t already the first responder, this method first sends a resign_first_responder message to the object that is the first responder. If that object refuses to resign, it remains the first responder, and this method immediately returns NO. If the current first responder resigns, this method sends a become_first_responder message to responder.
If responder does not accept first responder status, the ResponderManager becomes first responder; in this case, the method returns YES even if the responder refused first responder status.
If responder is nil, this method still sends resign_first_responder to the current first responder.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/ppcurses/application.rb', line 92 def make_first_responder( responder ) Responder.isa(responder) unless responder.nil? if responder != @first_responder will_resign = responder.resign_first_responder unless will_resign return NO end end @first_responder = nil accepted = NO will_accept = responder.accepts_first_responder if will_accept accepted = responder.become_first_responder end unless accepted @first_responder = self return YES end @first_responder = responder YES end |