1 /* This file is part of the KDE libraries
2 Copyright (C) 1997, 1998 Stephan Kulow (coolo@kde.org)
3 (C) 1997, 1998 Mark Donohoe (donohoe@kde.org)
4 (C) 1997, 1998 Sven Radej (radej@kde.org)
5 (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org)
6 (C) 1999 Chris Schlaeger (cs@kde.org)
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License version 2 as published by the Free Software Foundation.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
20 Boston, MA 02110-1301, USA.
25 #include "ktoolbarradiogroup.h"
27 #include "ktoolbarbutton.h"
29 /*************************************************************************
30 * KToolBarRadioGroup *
31 *************************************************************************/
34 KToolBarRadioGroup::KToolBarRadioGroup (KToolBar
*_parent
, const char *_name
)
35 : QObject(_parent
, _name
)
37 buttons
= new KToolBarButtonList();
39 connect (tb
, SIGNAL(toggled(int)), this, SLOT(slotToggled(int)));
42 KToolBarRadioGroup::~KToolBarRadioGroup()
47 void KToolBarRadioGroup::addButton (int id
)
49 KToolBarButton
*b
= tb
->getButton( id
);
51 buttons
->insert( id
, b
);
54 void KToolBarRadioGroup::removeButton (int id
)
56 if (!buttons
->find(id
))
58 buttons
->find(id
)->setRadio(false);
62 void KToolBarRadioGroup::slotToggled(int id
)
64 if (buttons
->find(id
) && buttons
->find(id
)->isOn())
66 QIntDictIterator
<KToolBarButton
> it(*buttons
);
69 if (it
.currentKey() != id
)
70 it
.current()->on(false);
76 #include "ktoolbarradiogroup.moc"