#include <CCNotificationCenter.h>
Public Member Functions | |
NotificationCenter () | |
NotificationCenter constructor. More... | |
~NotificationCenter () | |
NotificationCenter destructor. More... | |
void | addObserver (Object *target, SEL_CallFuncO selector, const char *name, Object *sender) |
Adds an observer for the specified target. More... | |
void | removeObserver (Object *target, const char *name) |
Removes the observer by the specified target and name. More... | |
int | removeAllObservers (Object *target) |
Removes all notifications registered by this target. More... | |
void | registerScriptObserver (Object *target, int handler, const char *name) |
Registers one hander for script binding. More... | |
var | registerScriptObserver ( var target, var handler, var name) |
Registers one hander for script binding. More... | |
local | registerScriptObserver ( local target, local handler, local name) |
Registers one hander for script binding. More... | |
void | unregisterScriptObserver (Object *target, const char *name) |
Unregisters script observer. More... | |
void | postNotification (const char *name) |
Posts one notification event by name. More... | |
void | postNotification (const char *name, Object *sender) |
Posts one notification event by name. More... | |
int | getScriptHandler () const |
Gets script handler. More... | |
int | getObserverHandlerByName (const char *name) |
Gets observer script handler. More... | |
![]() | |
Object () | |
Constructor. More... | |
virtual | ~Object () |
void | release () |
Release the ownership immediately. More... | |
void | retain () |
Retains the ownership. More... | |
Object * | autorelease () |
Release the ownership sometime soon automatically. More... | |
bool | isSingleReference () const |
Returns a boolean value that indicates whether there is only one reference to the object. More... | |
unsigned int | retainCount () const |
Returns the object's current reference count. More... | |
virtual bool | isEqual (const Object *object) |
Returns a boolean value that indicates whether this object and a given object are equal. More... | |
virtual void | acceptVisitor (DataVisitor &visitor) |
virtual void | update (float dt) |
Static Public Member Functions | |
static NotificationCenter * | getInstance () |
Gets the single instance of NotificationCenter. More... | |
local | getInstance () |
Gets the single instance of NotificationCenter. More... | |
static void | destroyInstance () |
Destroys the single instance of NotificationCenter. More... | |
static CC_DEPRECATED_ATTRIBUTE NotificationCenter * | sharedNotificationCenter (void) |
local | sharedNotificationCenter () |
static CC_DEPRECATED_ATTRIBUTE void | purgeNotificationCenter (void) |
local | purgeNotificationCenter () |
Friends | |
class | ScriptHandlerMgr |
Additional Inherited Members | |
![]() | |
unsigned int | _ID |
object id, ScriptSupport need public _ID More... | |
int | _luaID |
Lua reference id. More... | |
![]() | |
unsigned int | _reference |
count of references More... | |
var | _reference |
count of references More... | |
local | _reference |
count of references More... | |
unsigned int | _autoReleaseCount |
count of autorelease More... | |
var | _autoReleaseCount |
count of autorelease More... | |
local | _autoReleaseCount |
count of autorelease More... | |
NotificationCenter constructor.
var ctor | ( | ) |
NotificationCenter constructor.
local NotificationCenter | ( | ) |
NotificationCenter constructor.
~NotificationCenter | ( | ) |
NotificationCenter destructor.
void addObserver | ( | Object * | target, |
SEL_CallFuncO | selector, | ||
const char * | name, | ||
Object * | sender | ||
) |
Adds an observer for the specified target.
target | The target which wants to observe notification events. |
selector | The callback function which will be invoked when the specified notification event was posted. |
name | The name of this notification. |
sender | The object whose notifications the target wants to receive. Only notifications sent by this sender are delivered to the target. NULL means that the sender is not used to decide whether to deliver the notification to target. |
var addObserver | ( | var | target, |
var | selector, | ||
var | name, | ||
var | sender | ||
) |
Adds an observer for the specified target.
target | The target which wants to observe notification events. |
selector | The callback function which will be invoked when the specified notification event was posted. |
name | The name of this notification. |
sender | The object whose notifications the target wants to receive. Only notifications sent by this sender are delivered to the target. NULL means that the sender is not used to decide whether to deliver the notification to target. |
local addObserver | ( | local | target, |
local | selector, | ||
local | name, | ||
local | sender | ||
) |
Adds an observer for the specified target.
target | The target which wants to observe notification events. |
selector | The callback function which will be invoked when the specified notification event was posted. |
name | The name of this notification. |
sender | The object whose notifications the target wants to receive. Only notifications sent by this sender are delivered to the target. NULL means that the sender is not used to decide whether to deliver the notification to target. |
|
static |
Destroys the single instance of NotificationCenter.
|
static |
Destroys the single instance of NotificationCenter.
|
static |
Destroys the single instance of NotificationCenter.
|
static |
Gets the single instance of NotificationCenter.
|
static |
Gets the single instance of NotificationCenter.
|
static |
Gets the single instance of NotificationCenter.
int getObserverHandlerByName | ( | const char * | name) |
Gets observer script handler.
name | The name of this notification. |
var getObserverHandlerByName | ( | var | name) |
Gets observer script handler.
name | The name of this notification. |
local getObserverHandlerByName | ( | local | name) |
Gets observer script handler.
name | The name of this notification. |
|
inline |
Gets script handler.
|
inline |
Gets script handler.
|
inline |
Gets script handler.
void postNotification | ( | const char * | name) |
Posts one notification event by name.
name | The name of this notification. |
var postNotification | ( | var | name) |
Posts one notification event by name.
name | The name of this notification. |
local postNotification | ( | local | name) |
Posts one notification event by name.
name | The name of this notification. |
void postNotification | ( | const char * | name, |
Object * | sender | ||
) |
Posts one notification event by name.
name | The name of this notification. |
sender | The object posting the notification. Can be NULL |
var postNotification | ( | var | name, |
var | sender | ||
) |
Posts one notification event by name.
name | The name of this notification. |
sender | The object posting the notification. Can be NULL |
local postNotification | ( | local | name, |
local | sender | ||
) |
Posts one notification event by name.
name | The name of this notification. |
sender | The object posting the notification. Can be NULL |
|
static |
|
static |
|
static |
void registerScriptObserver | ( | Object * | target, |
int | handler, | ||
const char * | name | ||
) |
Registers one hander for script binding.
handler | The lua handler. |
var registerScriptObserver | ( | var | target, |
var | handler, | ||
var | name | ||
) |
Registers one hander for script binding.
handler | The lua handler. |
local registerScriptObserver | ( | local | target, |
local | handler, | ||
local | name | ||
) |
Registers one hander for script binding.
handler | The lua handler. |
int removeAllObservers | ( | Object * | target) |
Removes all notifications registered by this target.
target | The target of this notification. |
var removeAllObservers | ( | var | target) |
Removes all notifications registered by this target.
target | The target of this notification. |
local removeAllObservers | ( | local | target) |
Removes all notifications registered by this target.
target | The target of this notification. |
void removeObserver | ( | Object * | target, |
const char * | name | ||
) |
Removes the observer by the specified target and name.
target | The target of this notification. |
name | The name of this notification. |
var removeObserver | ( | var | target, |
var | name | ||
) |
Removes the observer by the specified target and name.
target | The target of this notification. |
name | The name of this notification. |
local removeObserver | ( | local | target, |
local | name | ||
) |
Removes the observer by the specified target and name.
target | The target of this notification. |
name | The name of this notification. |
|
static |
|
static |
|
static |
void unregisterScriptObserver | ( | Object * | target, |
const char * | name | ||
) |
Unregisters script observer.
var unregisterScriptObserver | ( | var | target, |
var | name | ||
) |
Unregisters script observer.
local unregisterScriptObserver | ( | local | target, |
local | name | ||
) |
Unregisters script observer.
|
friend |
|
friend |
|
friend |