3 * Copyright 2002, The libsigc++ Development Team
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <sigc++/connection.h>
26 connection::connection()
30 connection::connection(const connection& c)
33 //Let the connection forget about the signal handler when the handler object dies:
35 slot_->add_destroy_notify_callback(this, ¬ify);
38 connection::connection(slot_base& sl)
41 //Let the connection forget about the signal handler when the handler object dies:
42 slot_->add_destroy_notify_callback(this, ¬ify);
45 connection& connection::operator=(const connection& c)
51 connection::~connection()
54 slot_->remove_destroy_notify_callback(this);
57 bool connection::empty() const
59 return (!slot_ || slot_->empty());
62 bool connection::connected() const
67 bool connection::blocked() const
69 return (slot_ ? slot_->blocked() : false);
72 bool connection::block(bool should_block)
74 return (slot_ ? slot_->block(should_block) : false);
77 bool connection::unblock()
79 return (slot_ ? slot_->unblock() : false);
82 void connection::disconnect()
85 slot_->disconnect(); // This notifies slot_'s parent.
88 connection::operator bool()
93 void connection::set_slot(slot_base* sl)
96 slot_->remove_destroy_notify_callback(this);
101 slot_->add_destroy_notify_callback(this, ¬ify);
104 void* connection::notify(void* data)
106 connection* self = (connection*)data;
111 } /* namespace sigc */