issue #3069: Protecting some methods in EventListener, make EventDispatcher as its friend class.

This commit is contained in:
James Chen 2013-10-29 14:58:47 +08:00
parent 296978a9be
commit 5698dcd0e1
1 changed files with 5 additions and 4 deletions

View File

@ -74,6 +74,7 @@ public:
/** Clones the listener, its subclasses have to override this method. */ /** Clones the listener, its subclasses have to override this method. */
virtual EventListener* clone() = 0; virtual EventListener* clone() = 0;
protected:
inline void setPaused(bool paused) { _paused = paused; }; inline void setPaused(bool paused) { _paused = paused; };
inline bool isPaused() const { return _paused; }; inline bool isPaused() const { return _paused; };
@ -91,8 +92,6 @@ public:
std::function<void(Event*)> _onEvent; /// Event callback function std::function<void(Event*)> _onEvent; /// Event callback function
protected:
Type _type; /// Event listener type Type _type; /// Event listener type
ListenerID _listenerID; /// Event listener ID ListenerID _listenerID; /// Event listener ID
bool _isRegistered; /// Whether the listener has been added to dispatcher. bool _isRegistered; /// Whether the listener has been added to dispatcher.
@ -100,7 +99,9 @@ protected:
// The priority of event listener // The priority of event listener
int _fixedPriority; // The higher the number, the higher the priority, 0 is for scene graph base priority. int _fixedPriority; // The higher the number, the higher the priority, 0 is for scene graph base priority.
Node* _node; // scene graph based priority Node* _node; // scene graph based priority
bool _paused; bool _paused; // Whether the listener is paused
friend class EventDispatcher;
}; };
NS_CC_END NS_CC_END