Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Attributes | List of all members
IMessageListener Class Referenceabstract
Message System

Listener interface for objects that receive messages. More...

`#include <dispatcher.h>`

Inheritance diagram for IMessageListener:

## Public Member Functions
virtual | ~IMessageListener ()
virtual bool | onMessageReceived (StringTableEntry queue, const char *msg, const char *data)=0
| Callback for when messages are received. More...
virtual bool | onMessageObjectReceived (StringTableEntry queue, Message *msg)=0
| Callback for when message objects are received. More...
virtual void | onAddToQueue (StringTableEntry queue)
| Callback for when the listener is added to a queue. More...
virtual void | onRemoveFromQueue (StringTableEntry queue)
| Callback for when the listener is removed from a queue. More...

## Protected Attributes
Vector< StringTableEntry > | mQueues
| List of queues this listener is registered with. More...

## Detailed Description

Listener interface for objects that receive messages.

See also
  ScriptMsgListener

## Constructor & Destructor Documentation

~IMessageListener | ( |  | ) |
| virtual

## Member Function Documentation

void onAddToQueue | ( | StringTableEntry | queue | ) |
| virtual

Callback for when the listener is added to a queue.

The default implementation of onAddToQueue() and onRemoveFromQueue() provide tracking of the queues this listener is added to through the mQueues member. Overrides of onAddToQueue() or onRemoveFromQueue() should ensure they call the parent implementation in any overrides.

Parameters

  queue | The name of the queue that the listener added to

See also
  onRemoveFromQueue()

Reimplemented in ScriptMsgListener.

virtual bool onMessageObjectReceived | ( | StringTableEntry | queue,
|  | Message * | msg
| ) |  |
| pure virtual

Callback for when message objects are received.

Parameters

  queue | The name of the queue the message was dispatched to
  msg | The message object

Returns
  false to prevent other listeners receiving this message, true otherwise

See also
  onMessageReceived()

Implemented in PopupMenu, MessageForwarder, ScriptMsgListener, and EventManagerListener.

virtual bool onMessageReceived | ( | StringTableEntry | queue,
|  | const char * | msg,
|  | const char * | data
| ) |  |
| pure virtual

Callback for when messages are received.

Parameters

  queue | The name of the queue the message was dispatched to
  msg | The type of message
  data | The data for the message

Returns
  false to prevent other listeners receiving this message, true otherwise

See also
  onMessageObjectReceived()

Implemented in PopupMenu, MessageForwarder, ScriptMsgListener, and EventManagerListener.

void onRemoveFromQueue | ( | StringTableEntry | queue | ) |
| virtual

Callback for when the listener is removed from a queue.

The default implementation of onAddToQueue() and onRemoveFromQueue() provide tracking of the queues this listener is added to through the mQueues member. Overrides of onAddToQueue() or onRemoveFromQueue() should ensure they call the parent implementation in any overrides.

Parameters

  queue | The name of the queue the listener was removed from

See also
  onAddToQueue()

Reimplemented in ScriptMsgListener.

## Member Data Documentation

Vector<StringTableEntry> mQueues
| protected

List of queues this listener is registered with.

The documentation for this class was generated from the following files:

- messaging/dispatcher.h
- messaging/dispatcher.cc