# IMFResponder Struct Reference
[MCFrame]

Inheritance diagram for IMFResponder:

List of all members.

## Public Member Functions
virtual void MCCOMAPI | AddIMFResponderListener (IMFResponder *inListener)=0
virtual void MCCOMAPI | RemoveIMFResponderListener (IMFResponder *inListener)=0
virtual IDType MCCOMAPI | GetInstanceID () const =0
virtual void MCCOMAPI | SetNextIMFResponder (IMFResponder *inNewResponder)=0
virtual void MCCOMAPI | SetWantsToBeFirstResponder (boolean inWantsTo)=0
virtual void MCCOMAPI | BecameFirstResponder (boolean on)=0
virtual boolean MCCOMAPI | Receive (MessageID message, IMFResponder *source, void *data)=0
virtual void MCCOMAPI | BroadcastMessageUp (MessageID message, IMFResponder *source, void *data)=0
virtual void MCCOMAPI | BroadcastMessageToListeners (MessageID message, IMFResponder *source, void *data)=0
virtual void MCCOMAPI | BroadcastMessageDown (MessageID message, IMFResponder *source, void *data)=0
virtual boolean MCCOMAPI | BecomeFirstResponder ()=0
virtual boolean MCCOMAPI | GetIsFirstResponder ()=0

## Detailed Description

The IMFResponder interface is for objects that need to be able to respond to broadcast messages. This is extensively used among Parts in the user interface, for example to broadcast notification that Part values changed, or that bounds have changed.

When an event happens, the first Responder is offered the chance to handle it. Should it not handle the event, it's passed along the chain of Responders until handled and told to stop. Each responder, on receiving the event, passes it on to the next Responder. For example, if the user types in an Edit Text Part, the edit text will generally want to be first Responder, and so will receive the keystroke events. Should the user do something other than type, though, like right-clicking in the edit text, the Edit Text Part would send the event on to its next Responder, and on upwards until something handles the click.

## Member Function Documentation

virtual void MCCOMAPI IMFResponder::AddIMFResponderListener | ( | IMFResponder * | inListener | ) | `[pure virtual]`

Adds a new Responder to this Responder's list of listeners, which is used by BroadcastMessageToListeners()

Parameters:

  | inListener | Pointer to the Responder to add to the list

virtual void MCCOMAPI IMFResponder::BecameFirstResponder | ( | boolean | on | ) | `[pure virtual]`

Called when this Responder becomes first Responder.

Parameters:

  | on | If true, this Part became first responder.

virtual boolean MCCOMAPI IMFResponder::BecomeFirstResponder | ( |  | ) | `[pure virtual]`

Causes this part to become the first Responder. In the process, makes the former first Responder resign.

Returns:
  True if the former first Responder resigned and this Responder became first.

virtual void MCCOMAPI IMFResponder::BroadcastMessageDown | ( | MessageID | message,
|  | IMFResponder * | source,
|  | void * | data |
| ) |  |  | `[pure virtual]`

Broadcasts a message down to the children of a given object. Generally only used between Parts in the UI.

Parameters:

  | message | The message being passed
  | source | The Responder originating the message
  | data | Data associated with a message. Optional.

virtual void MCCOMAPI IMFResponder::BroadcastMessageToListeners | ( | MessageID | message,
|  | IMFResponder * | source,
|  | void * | data |
| ) |  |  | `[pure virtual]`

Passes a message to the list of this Responder's listeners.

See also:
  Receive

Parameters:

  | message | The message being passed
  | source | The Responder originating the message
  | data | Data associated with a message. Optional.

virtual void MCCOMAPI IMFResponder::BroadcastMessageUp | ( | MessageID | message,
|  | IMFResponder * | source,
|  | void * | data |
| ) |  |  | `[pure virtual]`

Passes a message up to the next Responder.

See also:
  Receive

Parameters:

  | message | The message being passed
  | source | The Responder originating the message
  | data | Data associated with a message. Optional.

virtual IDType MCCOMAPI IMFResponder::GetInstanceID | ( |  | ) | const`[pure virtual]`

Used to get an ID from a Responder, generally in order for an object to choose the correct response to the message passed. For Parts, this is the Part ID. Responders without a useful ID to pass will return kNoId.

Returns:
  The ID of the Responder

virtual boolean MCCOMAPI IMFResponder::GetIsFirstResponder | ( |  | ) | `[pure virtual]`

Returns true if this responder is the first responder

virtual boolean MCCOMAPI IMFResponder::Receive | ( | MessageID | message,
|  | IMFResponder * | source,
|  | void * | data |
| ) |  |  | `[pure virtual]`

This function is used to try to handle incoming messages. Generally, it will be used as follows:

     if (Receive(...) == kMFReceiveResult_KeepGoing)
         BroadcastMessageUp(...);

The message can also be passed with a pointer to some data associated with the message. For example, a Part value changed message can be passed along with a pointer to the new value.

Parameters:

  | message | The message being passed
  | source | The Responder originating the message
  | data | Data associated with a message. Optional.

Returns:
  True if the message has been handled.

virtual void MCCOMAPI IMFResponder::RemoveIMFResponderListener | ( | IMFResponder * | inListener | ) | `[pure virtual]`

Removes a Responder from this Responder's list of listeners, which is used by BroadcastMessageToListeners()

Parameters:

  | inListener | Pointer to the Responder to remove from the list

virtual void MCCOMAPI IMFResponder::SetNextIMFResponder | ( | IMFResponder * | inNewResponder | ) | `[pure virtual]`

Sets the next Responder to receive messages after this one.

Parameters:

  | inNewResponder | Pointer to the Responder to be added as the next Responder

virtual void MCCOMAPI IMFResponder::SetWantsToBeFirstResponder | ( | boolean | inWantsTo | ) | `[pure virtual]`

Sets whether or not this Responder wants to be the first Responder

Parameters:

  | inWantsTo | If true, the Responder wants to be first

The documentation for this struct was generated from the following file:

- IMFResponder.h