class PPCurses::Responder

Based on the Cocoa NSResponder

Current link, which probably won't be valid in the future …

developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSResponder_Class/index.html#//apple_ref/occ/instp/NSResponder/menu

Attributes

next_responder[RW]

Public Class Methods

isa( obj ) click to toggle source
# File lib/ppcurses/application.rb, line 55
def Responder.isa( obj )
  PPCurses.implements_protocol( obj, %w(accepts_first_responder become_first_responder resign_first_responder key_down))
end

Public Instance Methods

accepts_first_responder() click to toggle source

Whether the responder accepts first responder status.

As first responder, the receiver is the first object in the responder chain to be sent key events and action messages. By default, this property is NO. Subclasses set this property to YES if the receiver accepts first responder status.

# File lib/ppcurses/application.rb, line 20
def accepts_first_responder
  NO
end
become_first_responder() click to toggle source

Notifies the receiver that it’s about to become first responder

The default implementation returns YES, accepting first responder status. Subclasses can override this method to update state or perform some action such as highlighting the selection, or to return NO, refusing first responder status.

# File lib/ppcurses/application.rb, line 31
def become_first_responder
  YES
end
key_down( key ) click to toggle source

Informs the receiver that the user has pressed a key.

The default implementation simply passes this message to the next responder.

# File lib/ppcurses/application.rb, line 51
def key_down( key )
  @next_responder.key_down(key) unless @next_responder.nil?
end
resign_first_responder() click to toggle source

Notifies the receiver that it’s been asked to relinquish its status as first responder in its window.

The default implementation returns YES, resigning first responder status. Subclasses can override this method to update state or perform some action such as unhighlighting the selection, or to return NO, refusing to relinquish first responder status.

# File lib/ppcurses/application.rb, line 42
def resign_first_responder
  YES
end