This class manages event listener subscriptions and event dispatching.
More...
#include <CCEventDispatcher.h>
This class manages event listener subscriptions and event dispatching.
The EventListener list is managed in such a way that event listeners can be added and removed even from within an EventListener, while events are being dispatched.
void
addEventListenerWithFixedPriority |
( |
EventListener * |
listener, |
|
|
int |
fixedPriority |
|
) |
| |
Adds a event listener for a specified event with the fixed priority.
- Parameters
-
listener | The listener of a specified event. |
fixedPriority | The fixed priority of the listener. |
- Note
- A lower priority will be called before the ones that have a higher value. 0 priority is forbidden for fixed priority since it's used for scene graph based priority.
var
addEventListenerWithFixedPriority |
( |
var |
listener, |
|
|
var |
fixedPriority |
|
) |
| |
Adds a event listener for a specified event with the fixed priority.
- Parameters
-
listener | The listener of a specified event. |
fixedPriority | The fixed priority of the listener. |
- Note
- A lower priority will be called before the ones that have a higher value. 0 priority is forbidden for fixed priority since it's used for scene graph based priority.
local
addEventListenerWithFixedPriority |
( |
local |
listener, |
|
|
local |
fixedPriority |
|
) |
| |
Adds a event listener for a specified event with the fixed priority.
- Parameters
-
listener | The listener of a specified event. |
fixedPriority | The fixed priority of the listener. |
- Note
- A lower priority will be called before the ones that have a higher value. 0 priority is forbidden for fixed priority since it's used for scene graph based priority.
void
addEventListenerWithSceneGraphPriority |
( |
EventListener * |
listener, |
|
|
Node * |
node |
|
) |
| |
Adds a event listener for a specified event with the priority of scene graph.
- Parameters
-
listener | The listener of a specified event. |
node | The priority of the listener is based on the draw order of this node. |
- Note
- The priority of scene graph will be fixed value 0. So the order of listener item in the vector will be ' <0, scene graph (0 priority), >0'.
var
addEventListenerWithSceneGraphPriority |
( |
var |
listener, |
|
|
var |
node |
|
) |
| |
Adds a event listener for a specified event with the priority of scene graph.
- Parameters
-
listener | The listener of a specified event. |
node | The priority of the listener is based on the draw order of this node. |
- Note
- The priority of scene graph will be fixed value 0. So the order of listener item in the vector will be ' <0, scene graph (0 priority), >0'.
local
addEventListenerWithSceneGraphPriority |
( |
local |
listener, |
|
|
local |
node |
|
) |
| |
Adds a event listener for a specified event with the priority of scene graph.
- Parameters
-
listener | The listener of a specified event. |
node | The priority of the listener is based on the draw order of this node. |
- Note
- The priority of scene graph will be fixed value 0. So the order of listener item in the vector will be ' <0, scene graph (0 priority), >0'.
static void destroyInstance |
( |
) | |
|
|
static |
local destroyInstance |
( |
) | |
|
|
static |
void dispatchEvent |
( |
Event * |
event, |
|
|
bool |
forceSortListeners = false |
|
) |
| |
Dispatches the event Also removes all EventListeners marked for deletion from the event dispatcher list.
var dispatchEvent |
( |
var |
event, |
|
|
var |
forceSortListeners = false |
|
) |
| |
Dispatches the event Also removes all EventListeners marked for deletion from the event dispatcher list.
local dispatchEvent |
( |
local |
event, |
|
|
local |
forceSortListeners = false |
|
) |
| |
Dispatches the event Also removes all EventListeners marked for deletion from the event dispatcher list.
bool isDirtyForEventType |
( |
const std::string & |
eventType) | |
|
var isDirtyForEventType |
( |
var |
eventType) | |
|
local isDirtyForEventType |
( |
local |
eventType) | |
|
Checks whether dispatching events is enabled.
Checks whether dispatching events is enabled.
Checks whether dispatching events is enabled.
void removeAllListeners |
( |
) | |
|
var removeAllListeners |
( |
) | |
|
local removeAllListeners |
( |
) | |
|
Remove a listener.
- Parameters
-
listener | The specified event listener which needs to be removed. |
var removeEventListener |
( |
var |
listener) | |
|
Remove a listener.
- Parameters
-
listener | The specified event listener which needs to be removed. |
local removeEventListener |
( |
local |
listener) | |
|
Remove a listener.
- Parameters
-
listener | The specified event listener which needs to be removed. |
void removeListenersForEventType |
( |
const std::string & |
eventType) | |
|
Removes all listeners with the same event type.
var removeListenersForEventType |
( |
var |
eventType) | |
|
Removes all listeners with the same event type.
local removeListenersForEventType |
( |
local |
eventType) | |
|
Removes all listeners with the same event type.
void setDirtyForEventType |
( |
const std::string & |
eventType, |
|
|
bool |
isDirty |
|
) |
| |
var setDirtyForEventType |
( |
var |
eventType, |
|
|
var |
isDirty |
|
) |
| |
local setDirtyForEventType |
( |
local |
eventType, |
|
|
local |
isDirty |
|
) |
| |
void setEnabled |
( |
bool |
isEnabled) | |
|
Whether to enable dispatching events.
var setEnabled |
( |
var |
isEnabled) | |
|
Whether to enable dispatching events.
local setEnabled |
( |
local |
isEnabled) | |
|
Whether to enable dispatching events.
Sets listener's priority with fixed value.
var setPriority |
( |
var |
listener, |
|
|
var |
fixedPriority |
|
) |
| |
Sets listener's priority with fixed value.
local setPriority |
( |
local |
listener, |
|
|
local |
fixedPriority |
|
) |
| |
Sets listener's priority with fixed value.
The documentation for this class was generated from the following file: