2 Copyright (C) 1999 Paul Barton-Davis
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #ifndef __pbd_touchable_h__
20 #define __pbd_touchable_h__
22 #include "pbd/libpbd_visibility.h"
24 class /*LIBPBD_API*/ Touchable
27 Touchable() : _delete_after_touch (false) {}
28 virtual ~Touchable() {}
30 void set_delete_after_touch (bool yn) { _delete_after_touch = yn; }
31 bool delete_after_touch() const { return _delete_after_touch; }
33 virtual void touch () = 0;
36 bool _delete_after_touch;
40 class /*LIBPBD_API*/ DynamicTouchable : public Touchable
43 DynamicTouchable (T& t, void (T::*m)(void))
44 : object (t), method (m) { set_delete_after_touch (true); }
52 void (T::*method)(void);
55 template<class T1, class T2>
56 class /*LIBPBD_API*/ DynamicTouchable1 : public Touchable
59 DynamicTouchable1 (T1& t, void (T1::*m)(T2), T2 a)
60 : object (t), method (m), arg (a) { set_delete_after_touch (true); }
63 (object.*method)(arg);
68 void (T1::*method)(T2);
72 template<class T1, class T2, class T3>
73 class /*LIBPBD_API*/ DynamicTouchable2 : public Touchable
76 DynamicTouchable2 (T1& t, void (T1::*m)(T2, T3), T2 a1, T3 a2)
77 : object (t), method (m), arg1 (a1), arg2 (a2) { set_delete_after_touch (true); }
80 (object.*method)(arg1, arg2);
85 void (T1::*method)(T2,T3);
90 #endif // __pbd_touchable_h__