You.i Engine
CYIEventTarget Class Reference

Detailed Description

Represents an event target of type CYIEventTarget::SpecialEventTargetType.

CYISceneNode is an event target.

#include <event/YiEventTarget.h>

Inheritance diagram for CYIEventTarget:

Public Types

enum  SpecialEventTargetType : uint8_t {
  SpecialEventTargetType::None = 0x00,
  SpecialEventTargetType::NoPick = 0x20
enum  Phase : uint8_t {

Public Member Functions

 CYIEventTarget ()
virtual ~CYIEventTarget ()
bool AddEventListener (CYIEvent::Type eventType, CYIEventHandler *pListener, CYIEventTarget::Phase phase=CYIEventTarget::Phase::Bubble)
bool RemoveEventListener (CYIEvent::Type eventType, CYIEventHandler *pListener, CYIEventTarget::Phase phase=CYIEventTarget::Phase::Bubble)
virtual bool ProcessEvent (const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent)
void SetSpecialTypeFlag (SpecialEventTargetType type)
void ClearSpecialTypeFlag (SpecialEventTargetType type)
SpecialEventTargetType GetSpecialTypes () const
const std::shared_ptr< CYIEventTargetProxy > & GetProxy () const

Protected Attributes

std::vector< EventListenerEntry > m_listeners
SpecialEventTargetType m_specialTypes
std::shared_ptr< CYIEventTargetProxym_pEventTargetProxy

Member Enumeration Documentation

◆ Phase

enum CYIEventTarget::Phase : uint8_t

The bubble phase walks up the scene tree and allows each node from target to parent to process the next event with this phase set.


The capture phase walks down the scene tree and allows each node from parent to target process the next event with this phase set.

◆ SpecialEventTargetType


Constructor & Destructor Documentation

◆ CYIEventTarget()

CYIEventTarget::CYIEventTarget ( )

◆ ~CYIEventTarget()

virtual CYIEventTarget::~CYIEventTarget ( )

Member Function Documentation

◆ AddEventListener()

bool CYIEventTarget::AddEventListener ( CYIEvent::Type  eventType,
CYIEventHandler pListener,
CYIEventTarget::Phase  phase = CYIEventTarget::Phase::Bubble 

Registers a new event listener for the specified event type. If phase is set to CYIEventTarget::Phase::Capture, pListener is registered for the CYIEvent::Phase::Capture event phase (as well as CYIEvent::Phase::AtTarget). Otherwise, listener is registered for the #CYIEvent::Phase::Bubble event phase (as well as CYIEvent::Phase::AtTarget). Returns true if the listener was successfully registered.

The event target does not take ownership of pListener.
It is unsafe to add an event listener inside of the following methods:

◆ ClearSpecialTypeFlag()

void CYIEventTarget::ClearSpecialTypeFlag ( SpecialEventTargetType  type)

◆ GetProxy()

const std::shared_ptr<CYIEventTargetProxy>& CYIEventTarget::GetProxy ( ) const

Returns the event target's proxy tracking object. If the event target is deleted, the proxy's pointer will be set to nullptr.

◆ GetSpecialTypes()

SpecialEventTargetType CYIEventTarget::GetSpecialTypes ( ) const

◆ ProcessEvent()

virtual bool CYIEventTarget::ProcessEvent ( const std::shared_ptr< CYIEventDispatcher > &  pDispatcher,
CYIEvent pEvent 

Notifies this event target of an incoming event. Calls all the relevant listeners based on event type and phase. Returns true if any of the listeners' handleEvent() function returned true.

Reimplemented in CYISceneNode, and CYISceneView.

◆ RemoveEventListener()

◆ SetSpecialTypeFlag()

void CYIEventTarget::SetSpecialTypeFlag ( SpecialEventTargetType  type)

Member Data Documentation

◆ m_listeners

std::vector<EventListenerEntry> CYIEventTarget::m_listeners

◆ m_pEventTargetProxy

std::shared_ptr<CYIEventTargetProxy> CYIEventTarget::m_pEventTargetProxy

◆ m_specialTypes

SpecialEventTargetType CYIEventTarget::m_specialTypes

The documentation for this class was generated from the following file: