Check parents in the method CEvent::IsPropagated

This commit is contained in:
Kernell 2016-01-07 21:12:49 +03:00
parent 27e2ee61f7
commit 2930d23128
2 changed files with 29 additions and 7 deletions

View File

@ -32,7 +32,29 @@ CEvent::~CEvent( void )
this->m_pEventManager = nullptr;
}
bool CEvent::Call( CElement* pThis, void** params )
bool CEvent::IsPropagated( CElement* pSource ) const
{
if( this->m_bPropagated )
{
CElement* pParent = pSource;
while( pParent != this->m_pElement )
{
pParent = pParent->GetParent();
if( !pParent )
{
return false;
}
}
return true;
}
return false;
}
bool CEvent::Call( CElement* pThis, PVOID* params ) const
{
CResource* pResource = this->m_pEventManager->GetResource();

View File

@ -38,13 +38,13 @@ public:
CEvent ( CEventManager* pEventManager, string strName, CElement* pElement, MonoObject* pMonoDelegate, bool bPropagated, string strPriority );
~CEvent ( void );
bool Call ( CElement* pThis, void** params );
bool Call ( CElement* pThis, PVOID* params ) const;
bool IsPropagated ( CElement* pSource ) const;
string GetName ( void ) { return this->m_strName; }
CElement* GetElement ( void ) { return this->m_pElement; }
MonoObject* GetDelegate ( void ) { return this->m_pMonoDelegate; }
bool IsPropagated ( void ) { return this->m_bPropagated; }
string GetPriority ( void ) { return this->m_strPriority; }
inline string GetName ( void ) const { return this->m_strName; }
inline CElement* GetElement ( void ) const { return this->m_pElement; }
inline MonoObject* GetDelegate ( void ) const { return this->m_pMonoDelegate; }
inline string GetPriority ( void ) const { return this->m_strPriority; }
};
#endif