123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- #pragma once
- #include "MultiNotifyDelegate.hpp"
- //
- // a Notify delegate, send notification when insert, remove, clear
- //
- class UnsafeNotifyDelegate : public UnsafeDelegate
- {
- public:
- inline UnsafeNotifyDelegate ()
- {
- }
- inline UnsafeNotifyDelegate (const char * DelegateID) : UnsafeDelegate (DelegateID)
- {
- }
- inline virtual ~UnsafeNotifyDelegate ()
- {
- }
- inline virtual void AddDelegateHandler (DelegateHandler * handler)
- {
- UnsafeDelegate::AddDelegateHandler (handler);
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- }
- inline virtual void RemoveDelegateHandler (DelegateHandler * handler)
- {
- UnsafeDelegate::RemoveDelegateHandler (handler);
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- }
- inline void RemoveAll ()
- {
- UnsafeDelegate::RemoveAll ();
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- }
- inline virtual void AddFirst (DelegateHandler * handler)
- {
- UnsafeDelegate::AddFirst (handler);
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- }
- inline virtual void AddLast (DelegateHandler * handler)
- {
- UnsafeDelegate::AddLast (handler);
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- }
- inline int TransferTo (UnsafeDelegate & toDelegate)
- {
- int rc = UnsafeDelegate::TransferTo (toDelegate);
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- return rc;
- }
- inline int TransferFrom (UnsafeDelegate & fromDelegate)
- {
- int rc = UnsafeDelegate::TransferFrom (fromDelegate);
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- return rc;
- }
- inline int TransferTo (Array <DelegateHandler *> & toArray)
- {
- int rc = UnsafeDelegate::TransferTo (toArray);
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- return rc;
- }
- inline int TransferFrom (Array <DelegateHandler *> & fromArray)
- {
- int rc = UnsafeDelegate::TransferFrom (fromArray);
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- return rc;
- }
- virtual void SetTrace (bool bEnable)
- {
- UnsafeDelegate::SetTrace (bEnable);
- m_Notify.SetTrace (bEnable);
- }
- public:
- UnsafeDelegate m_Notify;
- };
|