123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- #pragma once
- // Define a dummy DelegateArg for notification
- class DelegateArgsNotifyDelegate : public DelegateArgs
- {
- };
- //
- // a Notify delegate, send notification when insert, remove, clear
- //
- class NotifyDelegate : public Delegate
- {
- public:
- inline NotifyDelegate ()
- {
- }
- inline NotifyDelegate (const char * DelegateID) : Delegate (DelegateID)
- {
- }
- inline virtual ~NotifyDelegate ()
- {
- }
- inline virtual void AddDelegateHandler (DelegateHandler * handler)
- {
- Delegate::AddDelegateHandler (handler);
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- }
- inline virtual void RemoveDelegateHandler (DelegateHandler * handler)
- {
- Delegate::RemoveDelegateHandler (handler);
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- }
- inline void RemoveAll ()
- {
- Delegate::RemoveAll ();
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- }
- inline virtual void AddFirst (DelegateHandler * handler)
- {
- Delegate::AddFirst (handler);
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- }
- inline virtual void AddLast (DelegateHandler * handler)
- {
- Delegate::AddLast (handler);
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- }
- inline int TransferTo (Delegate & toDelegate)
- {
- int rc = Delegate::TransferTo (toDelegate);
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- return rc;
- }
- inline int TransferFrom (Delegate & fromDelegate)
- {
- int rc = Delegate::TransferFrom (fromDelegate);
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- return rc;
- }
- inline int TransferTo (Array <DelegateHandler *> & toArray)
- {
- int rc = Delegate::TransferTo (toArray);
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- return rc;
- }
- inline int TransferFrom (Array <DelegateHandler *> & fromArray)
- {
- int rc = Delegate::TransferFrom (fromArray);
- DelegateArgsNotifyDelegate e;
- m_Notify.Invoke (this, &e);
- return rc;
- }
- public:
- Delegate m_Notify;
- };
|