MyGUI  3.0.1
MyGUI_EventPair.h
Go to the documentation of this file.
1 
7 /*
8  This file is part of MyGUI.
9 
10  MyGUI is free software: you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  MyGUI is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
22 */
23 #ifndef __MYGUI_EVENT_PAIR_H__
24 #define __MYGUI_EVENT_PAIR_H__
25 
26 #include "MyGUI_Prerequest.h"
27 
28 namespace MyGUI
29 {
30 
31  template <typename EventObsolete, typename Event>
32  class EventPair
33  {
34  public:
35 
36  template <typename T>
37  MYGUI_OBSOLETE("use : signature : Event::IDelegate * _delegate")
38  void operator = (T * _delegate)
39  {
40  m_eventObsolete = _delegate;
41  m_event = nullptr;
42  }
43 
44  void operator = (typename Event::IDelegate * _delegate)
45  {
46  m_eventObsolete = nullptr;
47  m_event = _delegate;
48  }
49 
50  template <typename TP1>
51  void operator()( TP1 p1 )
52  {
53  m_eventObsolete(p1);
54  m_event(p1);
55  }
56 
57  template <typename TP1, typename TP2>
58  void operator()( TP1 p1, TP2 p2 )
59  {
60  m_eventObsolete(p1, p2);
61  m_event(p1, p2);
62  }
63 
64  template <typename TP1, typename TP2, typename TP3>
65  void operator()( TP1 p1, TP2 p2, TP3 p3 )
66  {
67  m_eventObsolete(p1, p2, p3);
68  m_event(p1, p2, p3);
69  }
70 
71  template <typename TP1, typename TP2, typename TP3, typename TP4>
72  void operator()( TP1 p1, TP2 p2, TP3 p3, TP4 p4 )
73  {
74  m_eventObsolete(p1, p2, p3, p4);
75  m_event(p1, p2, p3, p4);
76  }
77 
78  template <typename TP1, typename TP2, typename TP3, typename TP4, typename TP5>
79  void operator()( TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5 )
80  {
81  m_eventObsolete(p1, p2, p3, p4, p5);
82  m_event(p1, p2, p3, p4, p5);
83  }
84 
85  template <typename TP1, typename TP2, typename TP3, typename TP4, typename TP5, typename TP6>
86  void operator()( TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5, TP6 p6 )
87  {
88  m_eventObsolete(p1, p2, p3, p4, p5, p6);
89  m_event(p1, p2, p3, p4, p5, p6);
90  }
91 
92  template <typename TP1, typename TP2, typename TP3, typename TP4, typename TP5, typename TP6, typename TP7>
93  void operator()( TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5, TP6 p6, TP7 p7 )
94  {
95  m_eventObsolete(p1, p2, p3, p4, p5, p6, p7);
96  m_event(p1, p2, p3, p4, p5, p6, p7);
97  }
98 
99  template <typename TP1, typename TP2, typename TP3, typename TP4, typename TP5, typename TP6, typename TP7, typename TP8>
100  void operator()( TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5, TP6 p6, TP7 p7, TP8 p8 )
101  {
102  m_eventObsolete(p1, p2, p3, p4, p5, p6, p7, p8);
103  m_event(p1, p2, p3, p4, p5, p6, p7, p8);
104  }
105 
106  bool empty() const
107  {
108  return m_eventObsolete.empty() && m_event.empty();
109  }
110 
111  public:
112  EventObsolete m_eventObsolete;
113  Event m_event;
114  };
115 
116 } // namespace MyGUI
117 
118 #endif // __MYGUI_EVENT_PAIR_H__