kalarm/lib

buttongroup.cpp
1/*
2 * buttongroup.cpp - TQButtonGroup with an extra signal and KDE 2 compatibility
3 * Program: kalarm
4 * Copyright (c) 2002, 2004 by David Jarvie <software@astrojar.org.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20#include "kalarm.h"
21
22#include <tqlayout.h>
23#include <tqbutton.h>
24#include <kdialog.h>
25
26#include "buttongroup.moc"
27
28
29ButtonGroup::ButtonGroup(TQWidget* parent, const char* name)
30 : TQButtonGroup(parent, name)
31{
32 connect(this, TQ_SIGNAL(clicked(int)), TQ_SIGNAL(buttonSet(int)));
33}
34
35ButtonGroup::ButtonGroup(const TQString& title, TQWidget* parent, const char* name)
36 : TQButtonGroup(title, parent, name)
37{
38 connect(this, TQ_SIGNAL(clicked(int)), TQ_SIGNAL(buttonSet(int)));
39}
40
41ButtonGroup::ButtonGroup(int strips, TQt::Orientation orient, TQWidget* parent, const char* name)
42 : TQButtonGroup(strips, orient, parent, name)
43{
44 connect(this, TQ_SIGNAL(clicked(int)), TQ_SIGNAL(buttonSet(int)));
45}
46
47ButtonGroup::ButtonGroup(int strips, TQt::Orientation orient, const TQString& title, TQWidget* parent, const char* name)
48 : TQButtonGroup(strips, orient, title, parent, name)
49{
50 connect(this, TQ_SIGNAL(clicked(int)), TQ_SIGNAL(buttonSet(int)));
51}
52
53/******************************************************************************
54 * Inserts a button in the group.
55 * This should really be a virtual method...
56 */
57int ButtonGroup::insert(TQButton* button, int id)
58{
59 id = TQButtonGroup::insert(button, id);
60 connect(button, TQ_SIGNAL(toggled(bool)), TQ_SLOT(slotButtonToggled(bool)));
61 return id;
62}
63
64/******************************************************************************
65 * Called when one of the member buttons is toggled.
66 */
67void ButtonGroup::slotButtonToggled(bool)
68{
69 emit buttonSet(selectedId());
70}
void buttonSet(int id)
Signal emitted whenever whenever any button in the group changes state, for whatever reason.
int insert(TQButton *button, int id=-1)
Inserts a button in the group.
Definition: buttongroup.cpp:57
ButtonGroup(TQWidget *parent, const char *name=0)
Constructor.
Definition: buttongroup.cpp:29