issue #4557: Updates comments for EventListener::setEnabled/setPaused.

Also does whitespace cleanup and untabify codes. Thanks emacs. :)
This commit is contained in:
James Chen 2014-04-03 17:02:17 +08:00
parent 7a5dba9eb9
commit a3214b7505
1 changed files with 20 additions and 19 deletions

View File

@ -22,8 +22,8 @@
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef cocos2d_libs_EventListener_h #ifndef __CCEVENTLISTENER_H__
#define cocos2d_libs_EventListener_h #define __CCEVENTLISTENER_H__
#include "CCPlatformMacros.h" #include "CCPlatformMacros.h"
#include "CCRef.h" #include "CCRef.h"
@ -78,8 +78,8 @@ public:
/** Enables or disables the listener /** Enables or disables the listener
* @note Only listeners with `enabled` state will be able to receive events. * @note Only listeners with `enabled` state will be able to receive events.
* When an listener was initialized, it's enabled by default. * When an listener was initialized, it's enabled by default.
* For a `scene graph priority` listener, to receive an event, excepting it was `enabled`, * An event listener can receive events when it is enabled and is not paused.
* it also shouldn't be in `pause` state. * paused state is always false when it is a fixed priority listener.
*/ */
inline void setEnabled(bool enabled) { _isEnabled = enabled; }; inline void setEnabled(bool enabled) { _isEnabled = enabled; };
@ -88,12 +88,13 @@ public:
protected: protected:
/** Sets pause state for the listener /** Sets paused state for the listener
* The paused state is only used for scene graph priority listeners. * The paused state is only used for scene graph priority listeners.
* `EventDispatcher::resumeAllEventListenersForTarget(node)` will set the paused state to `true`, * `EventDispatcher::resumeAllEventListenersForTarget(node)` will set the paused state to `true`,
* while `EventDispatcher::pauseAllEventListenersForTarget(node)` will set it to `false`. * while `EventDispatcher::pauseAllEventListenersForTarget(node)` will set it to `false`.
* @note Fixed priority listeners will never get paused. If a fixed priority doesn't want to receive events, * @note 1) Fixed priority listeners will never get paused. If a fixed priority doesn't want to receive events,
* call `setEnabled(false)` instead. * call `setEnabled(false)` instead.
* 2) In `Node`'s onEnter and onExit, listeners associated with that node will automatically update their `paused state`.
*/ */
inline void setPaused(bool paused) { _paused = paused; }; inline void setPaused(bool paused) { _paused = paused; };
@ -153,4 +154,4 @@ protected:
NS_CC_END NS_CC_END
#endif #endif // __CCEVENTLISTENER_H__