Guest User

Untitled

a guest
Feb 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #ifndef EVENTRECEIVER_H
  2. #define EVENTRECEIVER_H
  3.  
  4. namespace Cappra
  5. {
  6.     class UIEvent;
  7. }
  8.  
  9. namespace Cappra
  10. {
  11.  
  12.     template <class EventReceiver> class CallBack
  13.     {
  14.     private:
  15.         void                (EventReceiver::*cFunc)(UIEvent* e);
  16.         EventReceiver*      cObj;
  17.  
  18.     public:
  19.         CallBack(EventReceiver* pObj, void(EventReceiver::*pFunc)())
  20.         {
  21.             cObj        = pObj;
  22.             cFunc       = pFunc;
  23.         }
  24.  
  25.         void operator()(UIEvent* e)
  26.         {
  27.             (*cObj.*cFunc)(e);
  28.         }
  29.     };
  30. }
  31.  
  32. #endif // EVENTRECEIVER_H
Add Comment
Please, Sign In to add comment