buttongroup.cpp
00001 /* 00002 * buttongroup.cpp - TQButtonGroup with an extra signal and KDE 2 compatibility 00003 * Program: kalarm 00004 * Copyright (c) 2002, 2004 by David Jarvie <software@astrojar.org.uk> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along 00017 * with this program; if not, write to the Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 #include "kalarm.h" 00021 00022 #include <tqlayout.h> 00023 #include <tqbutton.h> 00024 #include <kdialog.h> 00025 00026 #include "buttongroup.moc" 00027 00028 00029 ButtonGroup::ButtonGroup(TQWidget* parent, const char* name) 00030 : TQButtonGroup(parent, name) 00031 { 00032 connect(this, TQT_SIGNAL(clicked(int)), TQT_SIGNAL(buttonSet(int))); 00033 } 00034 00035 ButtonGroup::ButtonGroup(const TQString& title, TQWidget* parent, const char* name) 00036 : TQButtonGroup(title, parent, name) 00037 { 00038 connect(this, TQT_SIGNAL(clicked(int)), TQT_SIGNAL(buttonSet(int))); 00039 } 00040 00041 ButtonGroup::ButtonGroup(int strips, Qt::Orientation orient, TQWidget* parent, const char* name) 00042 : TQButtonGroup(strips, orient, parent, name) 00043 { 00044 connect(this, TQT_SIGNAL(clicked(int)), TQT_SIGNAL(buttonSet(int))); 00045 } 00046 00047 ButtonGroup::ButtonGroup(int strips, Qt::Orientation orient, const TQString& title, TQWidget* parent, const char* name) 00048 : TQButtonGroup(strips, orient, title, parent, name) 00049 { 00050 connect(this, TQT_SIGNAL(clicked(int)), TQT_SIGNAL(buttonSet(int))); 00051 } 00052 00053 /****************************************************************************** 00054 * Inserts a button in the group. 00055 * This should really be a virtual method... 00056 */ 00057 int ButtonGroup::insert(TQButton* button, int id) 00058 { 00059 id = TQButtonGroup::insert(button, id); 00060 connect(button, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotButtonToggled(bool))); 00061 return id; 00062 } 00063 00064 /****************************************************************************** 00065 * Called when one of the member buttons is toggled. 00066 */ 00067 void ButtonGroup::slotButtonToggled(bool) 00068 { 00069 emit buttonSet(selectedId()); 00070 }