MyGUI 3.2.0

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files
- Examples

- File List
- Globals

MyGUI_EventPair.h
Go to the documentation of this file.
1
6 /*
7 This file is part of MyGUI.
8
9 MyGUI is free software: you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 MyGUI is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #ifndef __MYGUI_EVENT_PAIR_H__
23 #define __MYGUI_EVENT_PAIR_H__
24
25 #include "MyGUI_Prerequest.h"
26
27 namespace MyGUI
28 {
29
30 template <typename EventObsolete, typename Event>
31 class EventPair
32 {
33 public:
34
35 template <typename T>
36 MYGUI_OBSOLETE("use : signature : Event::IDelegate * _delegate")
37 void operator = (T* _delegate)
38 {
39 m_eventObsolete = _delegate;
40 m_event = nullptr;
41 }
42
43 MYGUI_OBSOLETE("use : operator += ")
44 void operator = (typename Event::IDelegate* _delegate)
45 {
46 m_eventObsolete = nullptr;
47 m_event = _delegate;
48 }
49
50 template <typename T>
51 MYGUI_OBSOLETE("use : signature : Event::IDelegate * _delegate")
52 void operator += (T* _delegate)
53 {
54 m_eventObsolete += _delegate;
55 m_event.clear();
56 }
57
58 void operator += (typename Event::IDelegate* _delegate)
59 {
60 m_eventObsolete.clear();
61 m_event += _delegate;
62 }
63
64 template <typename T>
65 MYGUI_OBSOLETE("use : signature : Event::IDelegate * _delegate")
66 void operator -= (T* _delegate)
67 {
68 m_eventObsolete -= _delegate;
69 m_event.clear();
70 }
71
72 void operator -= (typename Event::IDelegate* _delegate)
73 {
74 m_eventObsolete.clear();
75 m_event -= _delegate;
76 }
77
78 template <typename TP1>
79 void operator()( TP1 p1 )
80 {
81 m_eventObsolete(p1);
82 m_event(p1);
83 }
84
85 template <typename TP1, typename TP2>
86 void operator()( TP1 p1, TP2 p2 )
87 {
88 m_eventObsolete(p1, p2);
89 m_event(p1, p2);
90 }
91
92 template <typename TP1, typename TP2, typename TP3>
93 void operator()( TP1 p1, TP2 p2, TP3 p3 )
94 {
95 m_eventObsolete(p1, p2, p3);
96 m_event(p1, p2, p3);
97 }
98
99 template <typename TP1, typename TP2, typename TP3, typename TP4>
100 void operator()( TP1 p1, TP2 p2, TP3 p3, TP4 p4 )
101 {
102 m_eventObsolete(p1, p2, p3, p4);
103 m_event(p1, p2, p3, p4);
104 }
105
106 template <typename TP1, typename TP2, typename TP3, typename TP4, typename TP5>
107 void operator()( TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5 )
108 {
109 m_eventObsolete(p1, p2, p3, p4, p5);
110 m_event(p1, p2, p3, p4, p5);
111 }
112
113 template <typename TP1, typename TP2, typename TP3, typename TP4, typename TP5, typename TP6>
114 void operator()( TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5, TP6 p6 )
115 {
116 m_eventObsolete(p1, p2, p3, p4, p5, p6);
117 m_event(p1, p2, p3, p4, p5, p6);
118 }
119
120 template <typename TP1, typename TP2, typename TP3, typename TP4, typename TP5, typename TP6, typename TP7>
121 void operator()( TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5, TP6 p6, TP7 p7 )
122 {
123 m_eventObsolete(p1, p2, p3, p4, p5, p6, p7);
124 m_event(p1, p2, p3, p4, p5, p6, p7);
125 }
126
127 template <typename TP1, typename TP2, typename TP3, typename TP4, typename TP5, typename TP6, typename TP7, typename TP8>
128 void operator()( TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5, TP6 p6, TP7 p7, TP8 p8 )
129 {
130 m_eventObsolete(p1, p2, p3, p4, p5, p6, p7, p8);
131 m_event(p1, p2, p3, p4, p5, p6, p7, p8);
132 }
133
134 bool empty() const
135 {
136 return m_eventObsolete.empty() && m_event.empty();
137 }
138
139 public:
140 EventObsolete m_eventObsolete;
141 Event m_event;
142 };
143
144 template <typename EventObsolete, typename Event>
145 class EventPair3to4
146 {
147 public:
148
149 template <typename T>
150 MYGUI_OBSOLETE("use : signature : Event::IDelegate * _delegate")
151 void operator = (T* _delegate)
152 {
153 m_eventObsolete = _delegate;
154 m_event = nullptr;
155 }
156
157 MYGUI_OBSOLETE("use : operator += ")
158 void operator = (typename Event::IDelegate* _delegate)
159 {
160 m_eventObsolete = nullptr;
161 m_event = _delegate;
162 }
163
164 template <typename T>
165 MYGUI_OBSOLETE("use : signature : Event::IDelegate * _delegate")
166 void operator += (T* _delegate)
167 {
168 m_eventObsolete += _delegate;
169 m_event.clear();
170 }
171
172 void operator += (typename Event::IDelegate* _delegate)
173 {
174 m_eventObsolete.clear();
175 m_event += _delegate;
176 }
177
178 template <typename T>
179 MYGUI_OBSOLETE("use : signature : Event::IDelegate * _delegate")
180 void operator -= (T* _delegate)
181 {
182 m_eventObsolete -= _delegate;
183 m_event.clear();
184 }
185
186 void operator -= (typename Event::IDelegate* _delegate)
187 {
188 m_eventObsolete.clear();
189 m_event -= _delegate;
190 }
191
192 template <typename TP1, typename TP2, typename TP3, typename TP4>
193 void operator()( TP1 p1, TP2 p2, TP3 p3, TP4 p4 )
194 {
195 m_eventObsolete(p1, p2, p3);
196 m_event(p1, p2, p3, p4);
197 }
198
199 bool empty() const
200 {
201 return m_eventObsolete.empty() && m_event.empty();
202 }
203
204 public:
205 EventObsolete m_eventObsolete;
206 Event m_event;
207 };
208
209 } // namespace MyGUI
210
211 #endif // __MYGUI_EVENT_PAIR_H__
MyGUI::EventPair3to4::operator+=
void operator+=(T *_delegate)
Definition: MyGUI_EventPair.h:166
MyGUI_Prerequest.h
MyGUI::EventPair3to4::operator()
void operator()(TP1 p1, TP2 p2, TP3 p3, TP4 p4)
Definition: MyGUI_EventPair.h:193
MyGUI::EventPair::operator+=
void operator+=(T *_delegate)
Definition: MyGUI_EventPair.h:52
MyGUI::EventPair::operator()
void operator()(TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5)
Definition: MyGUI_EventPair.h:107
MyGUI::EventPair::operator()
void operator()(TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5, TP6 p6)
Definition: MyGUI_EventPair.h:114
MyGUI::EventPair::operator-=
void operator-=(T *_delegate)
Definition: MyGUI_EventPair.h:66
MyGUI::EventPair::operator()
void operator()(TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5, TP6 p6, TP7 p7)
Definition: MyGUI_EventPair.h:121
MyGUI::EventPair
Definition: MyGUI_EventPair.h:31
MyGUI::EventPair3to4::operator-=
void operator-=(T *_delegate)
Definition: MyGUI_EventPair.h:180
MyGUI::EventPair3to4::empty
bool empty() const
Definition: MyGUI_EventPair.h:199
MyGUI::EventPair::m_event
Event m_event
Definition: MyGUI_EventPair.h:141
MyGUI::EventPair3to4::m_event
Event m_event
Definition: MyGUI_EventPair.h:206
MyGUI::EventPair::operator()
void operator()(TP1 p1)
Definition: MyGUI_EventPair.h:79
MyGUI::EventPair::empty
bool empty() const
Definition: MyGUI_EventPair.h:134
MyGUI::EventPair::operator()
void operator()(TP1 p1, TP2 p2, TP3 p3)
Definition: MyGUI_EventPair.h:93
MyGUI::EventPair::m_eventObsolete
EventObsolete m_eventObsolete
Definition: MyGUI_EventPair.h:140
MyGUI::EventPair::operator()
void operator()(TP1 p1, TP2 p2, TP3 p3, TP4 p4)
Definition: MyGUI_EventPair.h:100
MYGUI_OBSOLETE
#define MYGUI_OBSOLETE(text)
Definition: MyGUI_Diagnostic.h:111
MyGUI::EventPair::operator()
void operator()(TP1 p1, TP2 p2)
Definition: MyGUI_EventPair.h:86
MyGUI::EventPair3to4
Definition: MyGUI_EventPair.h:145
MyGUI::EventPair::operator()
void operator()(TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5, TP6 p6, TP7 p7, TP8 p8)
Definition: MyGUI_EventPair.h:128
MyGUI::EventPair3to4::m_eventObsolete
EventObsolete m_eventObsolete
Definition: MyGUI_EventPair.h:205