00001 /* 00002 00003 Copyright 2004 Bastiaan Veelo 00004 00005 This file is part of dcouple. 00006 00007 Dcouple is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 00012 You are free to negociate a different license with the copyright holder. 00013 00014 Dcouple is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with dcouple; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 00023 */ 00024 00025 module dcouple.connect; 00026 00027 private import dcouple.signal; 00028 private import dcouple.slot; 00029 00030 /*! Provides a syntax for connecting signals to slots akin to the Qt syntax: 00031 \code 00032 connect(incomeButton.pressed, moneyInTheBank.up); 00033 \endcode 00034 Alternatively, you can do 00035 \code 00036 incomeButton.pressed.connect(moneyInTheBank.up); // or: 00037 moneyInTheBank.up.connect(incomeButton.pressed); 00038 \endcode 00039 */ 00040 void connect(GenericSignal signal, GenericSlot slot) 00041 { 00042 signal.genericConnect(slot); 00043 //slot.connect(signal); // superfluous 00044 } 00045 void connect(GenericSlot slot, GenericSignal signal) 00046 { 00047 signal.genericConnect(slot); 00048 //slot.connect(signal); // superfluous 00049 } 00050 00051 /*! Provides a syntax for explicitly disconnecting signals from slots akin to the Qt syntax: 00052 \code 00053 disconnect(incomeButton.pressed, moneyInTheBank.up); 00054 \endcode 00055 Alternatively, you can do 00056 \code 00057 incomeButton.pressed.disconnect(moneyInTheBank.up); // or: 00058 moneyInTheBank.up.disconnect(incomeButton.pressed); 00059 \endcode 00060 Note that connections get implicitly disconnected when the sending and/or the receiving end is deleted, and connections may be broken by classes that manage the signals and slots they own. 00061 */ 00062 void disconnect(GenericSignal signal, GenericSlot slot) 00063 { 00064 signal.genericDisconnect(slot); 00065 //slot.disconnect(signal); // superfluous 00066 } 00067 void disconnect(GenericSlot slot, GenericSignal signal) 00068 { 00069 signal.genericDisconnect(slot); 00070 //slot.disconnect(signal); // superfluous 00071 }