00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00033 #ifndef PG_SIGNALS_H
00034 #define PG_SIGNALS_H
00035
00036 #include <sigc++/sigc++.h>
00037 #include "pgsigconvert.h"
00038
00039
00040 typedef void* PG_Pointer;
00041
00042 template<class datatype = PG_Pointer>
00043 class PG_Signal0 : public SigC::Signal0<bool> {
00044 public:
00045
00046 SigC::Connection connect(const SigC::Slot1<bool, datatype>& s, datatype data) {
00047 return SigC::Signal0<bool>::connect(bind(s, data));
00048 };
00049
00050 };
00051
00052 template<class P1, class datatype = PG_Pointer>
00053 class PG_Signal1 : public SigC::Signal1<bool, P1> {
00054 static bool sig_convert0(SigC::Slot0<bool>& s, P1 p1) {
00055 return s();
00056 }
00057
00058 public:
00059
00060 SigC::Connection connect(const SigC::Slot2<bool, P1, datatype>& s, datatype data) {
00061 return SigC::Signal1<bool, P1>::connect(bind(s, data));
00062 };
00063
00064 SigC::Connection connect(const SigC::Slot1<bool, datatype>& s, datatype data) {
00065 return connect(bind(s, data));
00066 }
00067
00068 SigC::Connection connect(const SigC::Slot1<bool, P1>& s) {
00069 return SigC::Signal1<bool, P1>::connect(s);
00070 }
00071
00072 SigC::Connection connect(const SigC::Slot0<bool>& s) {
00073 return SigC::Signal1<bool, P1>::connect( SigCX::convert(s, sig_convert0));
00074 }
00075
00076 PG_Signal1& operator=(const PG_Signal1&);
00077 };
00078
00079
00080 template<class P1, class P2, class datatype = PG_Pointer>
00081 class PG_Signal2 : public SigC::Signal2<bool, P1, P2> {
00082
00083 static bool sig_convert_p2( SigC::Slot1<bool, P2>& s, P1 p1, P2 p2) {
00084 return s(p2);
00085 }
00086
00087 static bool sig_convert_p1( SigC::Slot1<bool, P1>& s, P1 p1, P2 p2) {
00088 return s(p1);
00089 }
00090
00091 static bool sig_convert0( SigC::Slot0<bool>& s, P1 p1, P2 p2) {
00092 return s();
00093 }
00094
00095 public:
00096
00097 SigC::Connection connect(const SigC::Slot3<bool, P1, P2, datatype>& s, datatype data) {
00098 return SigC::Signal2<bool, P1, P2>::connect(bind(s, data));
00099 }
00100
00101 SigC::Connection connect(const SigC::Slot2<bool, P1, datatype>& s, datatype data) {
00102 return SigC::Signal2<bool, P1, P2>::connect(bind(s, data));
00103 };
00104
00105 SigC::Connection connect(const SigC::Slot2<bool, P1, P2>& s) {
00106 return SigC::Signal2<bool, P1, P2>::connect(s);
00107 }
00108
00109 SigC::Connection connect(const SigC::Slot1<bool, P2>& s) {
00110 return SigC::Signal2<bool, P1, P2>::connect( SigCX::convert(s, sig_convert_p2));
00111 }
00112
00113 SigC::Connection connect(const SigC::Slot1<bool, P1>& s) {
00114 return SigC::Signal2<bool, P1, P2>::connect( SigCX::convert(s, sig_convert_p2));
00115 }
00116
00117 SigC::Connection connect(const SigC::Slot0<bool>& s) {
00118 return SigC::Signal2<bool, P1, P2>::connect( SigCX::convert(s, sig_convert0));
00119 }
00120
00121 private:
00122
00123 PG_Signal2& operator=(const PG_Signal2&);
00124
00125 };
00126
00127 #endif // PG_SIGNALS_H