2 dnl Class Slot Templates
4 dnl Copyright (C) 1998-1999 Karl Nelson <kenelson@ece.ucdavis.edu>
6 dnl This library is free software; you can redistribute it and/or
7 dnl modify it under the terms of the GNU Library General Public
8 dnl License as published by the Free Software Foundation; either
9 dnl version 2 of the License, or (at your option) any later version.
11 dnl This library is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 dnl Library General Public License for more details.
16 dnl You should have received a copy of the GNU Library General Public
17 dnl License along with this library; if not, write to the Free
18 dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 dnl Ignore the next line
22 /* This is a generated file, do not edit. Generated from __file__ */
23 include(template.macros.m4)
28 SigC::slot_class() (class)
29 -----------------------
30 slot_class() can be applied to a class method to form a Slot with a
31 profile equivelent to the method. At the same time an instance
32 of that class must be specified. This is an unsafe interface.
34 This does NOT require that the class be derived from SigC::Object.
35 However, the object should be static with regards to the signal system.
36 (allocated within the global scope.) If it is not and a connected
37 slot is call it will result in a seg fault. If the object must
38 be destroyed before the connected slots, all connections must
39 be disconnected by hand.
48 Slot2<void,int,int> s=slot_class(a,&A::foo);
53 #include <sigc++/object_slot.h>
55 #ifdef SIGC_CXX_NAMESPACES
63 define([CLASS_SLOT],[dnl
64 /****************************************************************
65 ***** Class Slot NUM($1)
66 ****************************************************************/
67 template <LIST(class R,1,ARG_CLASS($1),[$1],class Obj,1)>
68 struct [ClassSlot]NUM($1)_:public [ObjectSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],Obj,1)>
70 typedef [ObjectSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],Obj,1)> Base;
71 typedef typename Base::InFunc InFunc;
73 static SlotData* create(Obj* obj,InFunc func)
76 SlotData* tmp=manage(new SlotData());
77 CallData &data=reinterpret_cast<CallData&>(tmp->data_);
78 data.callback=&callback;
85 template <LIST(class R,1,ARG_CLASS($1),[$1],class Obj,1)>
87 slot_class(Obj &obj,R (Obj::*func)(ARG_TYPE($1)))
88 {return [ClassSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],Obj,1)>::create(&obj,func);
91 template <LIST(class R,1,ARG_CLASS($1),[$1],class Obj,1)>
93 slot_class(Obj *obj,R (Obj::*func)(ARG_TYPE($1)))
94 {return [ClassSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],Obj,1)>::create(obj,func);
100 CLASS_SLOT(ARGS(P,1))
101 CLASS_SLOT(ARGS(P,2))
102 CLASS_SLOT(ARGS(P,3))
104 #ifdef SIGC_CXX_NAMESPACES