首页 > 代码库 > 事件Event
事件Event
Event类是所有事件类的基类
/** * Base class of all kinds of events. */class Event : public Ref{public: enum class Type { TOUCH, KEYBOARD, ACCELERATION, MOUSE, CUSTOM }; protected: /** Constructor */ Event(Type type);public: /** Destructor */ virtual ~Event(); /** Gets the event type */ inline Type getType() const { return _type; }; /** Stops propagation for current event */ inline void stopPropagation() { _isStopped = true; }; /** Checks whether the event has been stopped */ inline bool isStopped() const { return _isStopped; }; /** @brief Gets current target of the event * @return The target with which the event associates. * @note It onlys be available when the event listener is associated with node. * It returns 0 when the listener is associated with fixed priority. */ inline Node* getCurrentTarget() { return _currentTarget; }; protected: /** Sets current target */ inline void setCurrentTarget(Node* target) { _currentTarget = target; }; Type _type; ///< Event type bool _isStopped; ///< whether the event has been stopped. Node* _currentTarget; ///< Current target friend class EventDispatcher;};
事件Event
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。