123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #ifndef __CCEVENT_H__
- #define __CCEVENT_H__
- #include "base/CCRef.h"
- #include "platform/CCPlatformMacros.h"
- NS_CC_BEGIN
- class Node;
- /** @class Event
- * @brief Base class of all kinds of events.
- */
- class CC_DLL Event : public Ref
- {
- public:
-
- enum class Type
- {
- TOUCH,
- KEYBOARD,
- ACCELERATION,
- MOUSE,
- FOCUS,
- GAME_CONTROLLER,
- CUSTOM
- };
-
- CC_CONSTRUCTOR_ACCESS:
-
- Event(Type type);
- public:
-
- virtual ~Event();
-
- Type getType() const { return _type; }
-
-
- void stopPropagation() { _isStopped = true; }
-
-
- bool isStopped() const { return _isStopped; }
-
-
- Node* getCurrentTarget() { return _currentTarget; }
-
- protected:
-
- void setCurrentTarget(Node* target) { _currentTarget = target; }
-
- Type _type;
-
- bool _isStopped;
- Node* _currentTarget;
-
- friend class EventDispatcher;
- };
- NS_CC_END
- // end of base group
- /// @}
- #endif // __CCEVENT_H__
|