Initial revision
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / radiobuttongroup.cc
1 /* $Id$ */
2
3 /* Copyright(C) 2003 The gtkmm Development Team
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or(at your option) any later version.
9  *
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  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19
20 #include <gtkmm/radiobuttongroup.h>
21
22 #include <gtkmm/radiobutton.h>
23 #include <gtkmm/radiomenuitem.h>
24 #include <gtkmm/radioaction.h>
25 #include <gtkmm/radiotoolbutton.h>
26 #include <gtk/gtkradiobutton.h>
27 #include <gtk/gtkradioaction.h>
28 #include <gtk/gtkradiomenuitem.h>
29 #include <gtk/gtkradiotoolbutton.h>
30
31 namespace Gtk
32 {
33
34 RadioButtonGroup::RadioButtonGroup()
35 : group_(0)
36 {}
37
38 RadioButtonGroup::RadioButtonGroup(GSList* group)
39  : group_(group)
40 {
41 }
42
43 RadioButtonGroup::RadioButtonGroup(const RadioButtonGroup& src)
44  : group_(src.group_)
45 {
46 }
47
48 RadioButtonGroup& RadioButtonGroup::operator=(const RadioButtonGroup& src)
49 {
50   group_ = src.group_;
51   return *this;
52 }
53
54 void RadioButtonGroup::add(RadioButton& item)
55 {
56   item.set_group(*this);
57
58   //probably not necessary:
59   group_ = gtk_radio_button_get_group(item.gobj());
60 }
61
62 void RadioButtonGroup::add(RadioMenuItem& item)
63 {
64   item.set_group(*this);
65
66   //probably not necessary:
67   group_ = item.gobj()->group;
68 }
69
70 void RadioButtonGroup::add(const Glib::RefPtr<RadioAction>& item)
71 {
72   item->set_group(*this);
73
74   //probably not necessary:
75   group_ = gtk_radio_action_get_group(item->gobj());
76 }
77
78 void RadioButtonGroup::add(RadioToolButton& item)
79 {
80   item.set_group(*this);
81
82   //probably not necessary:
83   group_ = gtk_radio_tool_button_get_group(item.gobj());
84 }
85
86 } //namespace Gtk