ObjectAL  2.1
ObjectAL API Reference (iOS) for Kobold2D developers
OALSuspendHandler Class Reference

Provides two controls (interrupted and manuallySuspended) for suspending a slave object, and also propagates such control messages to interested listeners. More...

#include <OALSuspendHandler.h>

Collaboration diagram for OALSuspendHandler:

List of all members.

Public Member Functions

id initWithTarget:selector: (id target,[selector] SEL selector)
 Initialize a handler with the specified slave target and selector.
void addSuspendListener: (id< OALSuspendListener > listener)
 Add a listener that will receive manual suspend and interrupt events.
void removeSuspendListener: (id< OALSuspendListener > listener)
 Remove a registered listener.

Static Public Member Functions

OALSuspendHandlerhandlerWithTarget:selector: (id target,[selector] SEL selector)
 Create a new handler with the specified slave target and selector.

Protected Attributes

NSMutableArray * listeners
 Listeners that will receive manualSuspend and interrupt events.
NSMutableArray * manualSuspendStates
 Holder for the state of manualSuspend in listeners when this object is manually suspended.
__unsafe_unretained id suspendStatusChangeTarget
 Slave object that is notified when this object suspends or unsuspends.
SEL suspendStatusChangeSelector
 Selector to be invoked on suspend or unsuspend.
bool manualSuspendLock
 Holds the current "manually suspended" state.
bool interruptLock
 Holds the current "interrupted" state.

Properties

bool manuallySuspended
 If YES, the manual suspend control is set.
bool interrupted
 If YES, the interrupt control is set.
bool suspended
 If YES, the slave object is suspended.

Detailed Description

Provides two controls (interrupted and manuallySuspended) for suspending a slave object, and also propagates such control messages to interested listeners.

"interrupted" is meant to be set by the system when an interrupt occurs.

"manuallySuspended" is a user-settable control for suspending an object.
"manuallySuspended" also has an extra step in its processing: When set, the handler makes a note of what its listeners' "manuallySuspended" values are. When cleared, it will only clear a listener's "manuallySuspended" value if it was not set at suspend time. This allows for ad-hoc setting/clearing of "manuallySuspended" in the middle of a handler/listener graph rather than only from the top level.

When either control is set, the slave object will be suspended. When both are cleared, the slave object will be unsuspended.


Member Function Documentation

void OALSuspendHandler::addSuspendListener: ( id<OALSuspendListener listener) [virtual]

Add a listener that will receive manual suspend and interrupt events.

Parameters:
listenerThe listener to register with this handler.
OALSuspendHandler * OALSuspendHandler::handlerWithTarget:selector: ( id  target,
[selector] SEL  selector 
) [static, virtual]

Create a new handler with the specified slave target and selector.

The selector provided must take a single boolean value like so:

  • (void) setSuspended:(bool) value
Parameters:
targetThe slave object that will receive suspend/unsuspend events.
selectorThe selector for a "set suspended" method, taking a single boolean parameter.
id OALSuspendHandler::initWithTarget:selector: ( id  target,
[selector] SEL  selector 
) [virtual]

Initialize a handler with the specified slave target and selector.

The selector provided must take a single boolean value like so:

  • (void) setSuspended:(bool) value
Parameters:
targetThe slave object that will receive suspend/unsuspend events.
selectorThe selector for a "set suspended" method, taking a single boolean parameter.
void OALSuspendHandler::removeSuspendListener: ( id<OALSuspendListener listener) [virtual]

Remove a registered listener.

Parameters:
listenerThe listener to unregister from this handler.

Member Data Documentation

Holds the current "interrupted" state.

NSMutableArray* OALSuspendHandler::listeners [protected]

Listeners that will receive manualSuspend and interrupt events.

Holds the current "manually suspended" state.

NSMutableArray* OALSuspendHandler::manualSuspendStates [protected]

Holder for the state of manualSuspend in listeners when this object is manually suspended.

Selector to be invoked on suspend or unsuspend.

Takes the signature: setSelected:(bool) value

__unsafe_unretained id OALSuspendHandler::suspendStatusChangeTarget [protected]

Slave object that is notified when this object suspends or unsuspends.


Property Documentation

bool OALSuspendHandler::interrupted [read, write, assign]

If YES, the interrupt control is set.

bool OALSuspendHandler::manuallySuspended [read, write, assign]

If YES, the manual suspend control is set.

bool OALSuspendHandler::suspended [read, assign]

If YES, the slave object is suspended.


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