MyGUI
3.0.3
|
00001 00007 /* 00008 This file is part of MyGUI. 00009 00010 MyGUI is free software: you can redistribute it and/or modify 00011 it under the terms of the GNU Lesser General Public License as published by 00012 the Free Software Foundation, either version 3 of the License, or 00013 (at your option) any later version. 00014 00015 MyGUI is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public License 00021 along with MyGUI. If not, see <http://www.gnu.org/licenses/>. 00022 */ 00023 #ifndef __MYGUI_EVENT_PAIR_H__ 00024 #define __MYGUI_EVENT_PAIR_H__ 00025 00026 #include "MyGUI_Prerequest.h" 00027 00028 namespace MyGUI 00029 { 00030 00031 template <typename EventObsolete, typename Event> 00032 class EventPair 00033 { 00034 public: 00035 00036 template <typename T> 00037 MYGUI_OBSOLETE("use : signature : Event::IDelegate * _delegate") 00038 void operator = (T * _delegate) 00039 { 00040 m_eventObsolete = _delegate; 00041 m_event = nullptr; 00042 } 00043 00044 void operator = (typename Event::IDelegate * _delegate) 00045 { 00046 m_eventObsolete = nullptr; 00047 m_event = _delegate; 00048 } 00049 00050 template <typename TP1> 00051 void operator()( TP1 p1 ) 00052 { 00053 m_eventObsolete(p1); 00054 m_event(p1); 00055 } 00056 00057 template <typename TP1, typename TP2> 00058 void operator()( TP1 p1, TP2 p2 ) 00059 { 00060 m_eventObsolete(p1, p2); 00061 m_event(p1, p2); 00062 } 00063 00064 template <typename TP1, typename TP2, typename TP3> 00065 void operator()( TP1 p1, TP2 p2, TP3 p3 ) 00066 { 00067 m_eventObsolete(p1, p2, p3); 00068 m_event(p1, p2, p3); 00069 } 00070 00071 template <typename TP1, typename TP2, typename TP3, typename TP4> 00072 void operator()( TP1 p1, TP2 p2, TP3 p3, TP4 p4 ) 00073 { 00074 m_eventObsolete(p1, p2, p3, p4); 00075 m_event(p1, p2, p3, p4); 00076 } 00077 00078 template <typename TP1, typename TP2, typename TP3, typename TP4, typename TP5> 00079 void operator()( TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5 ) 00080 { 00081 m_eventObsolete(p1, p2, p3, p4, p5); 00082 m_event(p1, p2, p3, p4, p5); 00083 } 00084 00085 template <typename TP1, typename TP2, typename TP3, typename TP4, typename TP5, typename TP6> 00086 void operator()( TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5, TP6 p6 ) 00087 { 00088 m_eventObsolete(p1, p2, p3, p4, p5, p6); 00089 m_event(p1, p2, p3, p4, p5, p6); 00090 } 00091 00092 template <typename TP1, typename TP2, typename TP3, typename TP4, typename TP5, typename TP6, typename TP7> 00093 void operator()( TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5, TP6 p6, TP7 p7 ) 00094 { 00095 m_eventObsolete(p1, p2, p3, p4, p5, p6, p7); 00096 m_event(p1, p2, p3, p4, p5, p6, p7); 00097 } 00098 00099 template <typename TP1, typename TP2, typename TP3, typename TP4, typename TP5, typename TP6, typename TP7, typename TP8> 00100 void operator()( TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5, TP6 p6, TP7 p7, TP8 p8 ) 00101 { 00102 m_eventObsolete(p1, p2, p3, p4, p5, p6, p7, p8); 00103 m_event(p1, p2, p3, p4, p5, p6, p7, p8); 00104 } 00105 00106 bool empty() const 00107 { 00108 return m_eventObsolete.empty() && m_event.empty(); 00109 } 00110 00111 public: 00112 EventObsolete m_eventObsolete; 00113 Event m_event; 00114 }; 00115 00116 } // namespace MyGUI 00117 00118 #endif // __MYGUI_EVENT_PAIR_H__