/* Copyright 2024, The libsigc++ Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ #ifndef SIGC_SIGNAL_CONNECT_H #define SIGC_SIGNAL_CONNECT_H #include #include #include namespace sigc { /** Connect a function to a signal * @param signal The signal to connect to. * @param fun The function that should be wrapped. * @return A connection. * * @newin{3,8} * @ingroup signal */ template inline connection signal_connect(signal& signal, T_return (*fun)(T_arg...)) { return signal.connect(ptr_fun(fun)); } /** Connect a non-const method to a signal * @param signal The signal to connect to. * @param obj Reference to object instance the functor should operate on. * @param fun Pointer to method that should be wrapped. * @return A connection. * * @newin{3,8} * @ingroup signal */ template inline connection signal_connect(signal& signal, T_obj& obj, T_return (T_obj::*fun)(T_arg...)) { return signal.connect(mem_fun(obj, fun)); } /** Connect a const method to a signal * @param signal The signal to connect to. * @param obj Reference to object instance the functor should operate on. * @param fun Pointer to method that should be wrapped. * @return A connection. * * @newin{3,8} * @ingroup signal */ template inline connection signal_connect(signal& signal, const T_obj& obj, T_return (T_obj::*fun)(T_arg...) const) { return signal.connect(mem_fun(obj, fun)); } } /* namespace sigc */ #endif /* SIGC_SIGNAL_CONNECT_H */