[dispatcher] Adding (s|g)etCurrentTarget for Event.

This commit is contained in:
James Chen 2013-09-13 16:34:34 +08:00
parent c948a67243
commit 838b059b45
2 changed files with 16 additions and 1 deletions

View File

@ -29,6 +29,7 @@ NS_CC_BEGIN
Event::Event(const std::string& type)
: _type(type)
, _isStopped(false)
, _currentTarget(nullptr)
{
}
@ -36,5 +37,14 @@ Event::~Event()
{
}
Node* Event::getCurrentTarget()
{
return _currentTarget;
}
void Event::setCurrentTarget(Node* target)
{
_currentTarget = target;
}
NS_CC_END

View File

@ -33,6 +33,8 @@
NS_CC_BEGIN
class Node;
class Event
{
public:
@ -42,10 +44,13 @@ public:
const std::string& getType() const { return _type; };
void stopPropagation() { _isStopped = true; };
bool isStopped() const { return _isStopped; };
Node* getCurrentTarget();
protected:
void setCurrentTarget(Node* target);
std::string _type;
bool _isStopped;
Node* _currentTarget;
friend class EventDispatcher;
};