You.i Engine
CYIEventHandler Class Referenceabstract

Detailed Description

Allows registering of event filters which can be used to perform processing on an event before and after the event has been handled and/or dispatched.

#include <event/YiEventHandler.h>

Inheritance diagram for CYIEventHandler:

Public Member Functions

 CYIEventHandler ()
 
 CYIEventHandler (const CYIEventHandler &)
 
virtual ~CYIEventHandler ()
 
CYIEventHandleroperator= (const CYIEventHandler &)
 
bool RegisterEventFilter (CYIEventFilter *pFilter)
 
bool UnregisterEventFilter (CYIEventFilter *pFilter)
 
bool PreFilter (const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent)
 
bool PostFilter (const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent)
 
bool AreEventsEnabled () const
 
void EnableEvents (bool enable)
 
virtual bool HandleEvent (const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent)=0
 

Protected Attributes

bool m_enableEvents
 

Friends

class CYIEventDispatcher
 

Constructor & Destructor Documentation

◆ CYIEventHandler() [1/2]

CYIEventHandler::CYIEventHandler ( )

◆ CYIEventHandler() [2/2]

CYIEventHandler::CYIEventHandler ( const CYIEventHandler )

◆ ~CYIEventHandler()

virtual CYIEventHandler::~CYIEventHandler ( )
virtual

Member Function Documentation

◆ AreEventsEnabled()

bool CYIEventHandler::AreEventsEnabled ( ) const

Used as one of the criteria in CYIEventTarget::ProcessEvent() to determine if HandleEvent() should be called on the events for this handler.

Return true if events have been enabled and false otherwise.

◆ EnableEvents()

void CYIEventHandler::EnableEvents ( bool  enable)

Allows enabling and disabling of event handling as desired.

◆ HandleEvent()

virtual bool CYIEventHandler::HandleEvent ( const std::shared_ptr< CYIEventDispatcher > &  pDispatcher,
CYIEvent pEvent 
)
pure virtual

Pure virtual for the child to implement according to how they wish the events to be handled.

The method is to return true if the event was processed and false otherwise.

Implemented in CYIScrollingView, CYISceneManager, CYISceneView, CYITextEditView, CYIToggleButtonView, CYIAbstractButtonView, CYIScrollBarView, CYIScrollingTextView, CYIPasswordTextEditView, CYIDrawerView, CYIDeferredDeletionEventHandler, and CYITaskEventHandler.

◆ operator=()

CYIEventHandler& CYIEventHandler::operator= ( const CYIEventHandler )

◆ PostFilter()

bool CYIEventHandler::PostFilter ( const std::shared_ptr< CYIEventDispatcher > &  pDispatcher,
CYIEvent pEvent 
)

For each registered event filter, initiate that filter's post-filter event processing on pEvent. If a pDispatcher is provided, notify the dispatcher that the post-filtering processing has occurred.

Return true if the event was post-filtered and false otherwise.

◆ PreFilter()

bool CYIEventHandler::PreFilter ( const std::shared_ptr< CYIEventDispatcher > &  pDispatcher,
CYIEvent pEvent 
)

For each registered event filter, initiate that filter's pre-filter event processing on pEvent. If a pDispatcher is provided, notify the dispatcher that the pre-filtering processing has occurred.

Return true if the event was pre-filtered and false otherwise.

◆ RegisterEventFilter()

bool CYIEventHandler::RegisterEventFilter ( CYIEventFilter pFilter)

Adds pFilter to the list of event filters. Returns true if the registration was successful and false otherwise.

Note
The event handler does not take ownership of pFilter.
Warning
It is unsafe to register an event filter inside of the following methods:

◆ UnregisterEventFilter()

bool CYIEventHandler::UnregisterEventFilter ( CYIEventFilter pFilter)

Removes pFilter from the list of event filters. Returns true if the removal was successful and false otherwise.

Warning
It is unsafe to unregister an event filter inside the following methods:

Friends And Related Function Documentation

◆ CYIEventDispatcher

friend class CYIEventDispatcher
friend

Member Data Documentation

◆ m_enableEvents

bool CYIEventHandler::m_enableEvents
protected

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