Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

pgsignals.h

Go to the documentation of this file.
00001 /*
00002     ParaGUI - crossplatform widgetset
00003     Copyright (C) 2000,2001,2002  Alexander Pipelka
00004  
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009  
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014  
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  
00019     Alexander Pipelka
00020     pipelka@teleweb.at
00021  
00022     Last Update:      $Author: mbickel $
00023     Update Date:      $Date: 2007-04-13 16:15:57 $
00024     Source File:      $Source: /home/cvspsrv/cvsroot/games/asc/source/libs/paragui/include/pgsignals.h,v $
00025     CVS/RCS Revision: $Revision: 1.2 $
00026     Status:           $State: Exp $
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

Generated on Tue Jun 24 01:27:49 2008 for Advanced Strategic Command by  doxygen 1.4.2