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'.
void dispatchEvent |
( |
Event * |
event) | |
|
Dispatches the event Also removes all EventListeners marked for deletion from the event dispatcher list.
var dispatchEvent |
( |
var |
event) | |
|
Dispatches the event Also removes all EventListeners marked for deletion from the event dispatcher list.
local dispatchEvent |
( |
local |
event) | |
|
Dispatches the event Also removes all EventListeners marked for deletion from the event dispatcher list.
Checks whether dispatching events is enabled.
Checks whether dispatching events is enabled.
Checks whether dispatching events is enabled.
void removeAllEventListeners |
( |
) | |
|
var removeAllEventListeners |
( |
) | |
|
local removeAllEventListeners |
( |
) | |
|
void removeCustomEventListeners |
( |
const std::string & |
customEventName) | |
|
Removes all custom listeners with the same event name.
var removeCustomEventListeners |
( |
var |
customEventName) | |
|
Removes all custom listeners with the same event name.
local removeCustomEventListeners |
( |
local |
customEventName) | |
|
Removes all custom listeners with the same event name.
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. |
Removes all listeners with the same event listener type.
var removeEventListeners |
( |
var |
listenerType) | |
|
Removes all listeners with the same event listener type.
local removeEventListeners |
( |
local |
listenerType) | |
|
Removes all listeners with the same event listener type.
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: