#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 & toArray) { int rc = Delegate::TransferTo (toArray); DelegateArgsNotifyDelegate e; m_Notify.Invoke (this, &e); return rc; } inline int TransferFrom (Array & fromArray) { int rc = Delegate::TransferFrom (fromArray); DelegateArgsNotifyDelegate e; m_Notify.Invoke (this, &e); return rc; } public: Delegate m_Notify; };