Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / radiomenuitem.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/radiomenuitem.h>
4 #include <gtkmm/private/radiomenuitem_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* 
10  *
11  * Copyright 1998-2002 The gtkmm Development Team
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Library General Public
15  * License as published by the Free Software Foundation; either
16  * version 2 of the License, or (at your option) any later version.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21  * Library General Public License for more details.
22  *
23  * You should have received a copy of the GNU Library General Public
24  * License along with this library; if not, write to the Free
25  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26  */
27
28 #include <gtkmm/misc.h>
29 #include <gtkmm/label.h>
30 #include <gtk/gtkradiomenuitem.h>
31
32 typedef Gtk::RadioMenuItem::Group Group; //So that the generate get_group return type is parsed.
33
34 namespace Gtk
35 {
36
37 RadioMenuItem::RadioMenuItem(Group& groupx)
38 :
39   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
40   Gtk::CheckMenuItem(Glib::ConstructParams(radiomenuitem_class_.init(), (char*) 0))
41 {
42   groupx.add(*this);
43 }
44
45 RadioMenuItem::RadioMenuItem(Group& groupx, const Glib::ustring &label, bool mnemonic)
46 :
47   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
48   Gtk::CheckMenuItem(Glib::ConstructParams(radiomenuitem_class_.init(), (char*) 0))
49 {
50   groupx.add(*this);
51   add_accel_label(label, mnemonic);
52 }
53
54 void RadioMenuItem::set_group(Group& group)
55 {
56   gtk_radio_menu_item_set_group(gobj(), group.group_);
57
58    //The group will be updated, ready for use with the next radiomenuitem:
59   group = get_group();
60 }
61
62 void RadioMenuItem::reset_group()
63 {
64   gtk_radio_menu_item_set_group(gobj(), 0);
65 }
66
67
68 } // namespace Gtk
69
70
71 namespace
72 {
73
74 const Glib::SignalProxyInfo RadioMenuItem_signal_group_changed_info =
75 {
76   "group_changed",
77   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
78   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
79 };
80
81 } // anonymous namespace
82
83
84 namespace Glib
85 {
86
87 Gtk::RadioMenuItem* wrap(GtkRadioMenuItem* object, bool take_copy)
88 {
89   return dynamic_cast<Gtk::RadioMenuItem *> (Glib::wrap_auto ((GObject*)(object), take_copy));
90 }
91
92 } /* namespace Glib */
93
94 namespace Gtk
95 {
96
97
98 /* The *_Class implementation: */
99
100 const Glib::Class& RadioMenuItem_Class::init()
101 {
102   if(!gtype_) // create the GType if necessary
103   {
104     // Glib::Class has to know the class init function to clone custom types.
105     class_init_func_ = &RadioMenuItem_Class::class_init_function;
106
107     // This is actually just optimized away, apparently with no harm.
108     // Make sure that the parent type has been created.
109     //CppClassParent::CppObjectType::get_type();
110
111     // Create the wrapper type, with the same class/instance size as the base type.
112     register_derived_type(gtk_radio_menu_item_get_type());
113
114     // Add derived versions of interfaces, if the C type implements any interfaces:
115   }
116
117   return *this;
118 }
119
120 void RadioMenuItem_Class::class_init_function(void* g_class, void* class_data)
121 {
122   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
123   CppClassParent::class_init_function(klass, class_data);
124
125   klass->group_changed = &group_changed_callback;
126 }
127
128
129 void RadioMenuItem_Class::group_changed_callback(GtkRadioMenuItem* self)
130 {
131   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
132       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
133
134   // Non-gtkmmproc-generated custom classes implicitly call the default
135   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
136   // generated classes can use this optimisation, which avoids the unnecessary
137   // parameter conversions if there is no possibility of the virtual function
138   // being overridden:
139   if(obj && obj->is_derived_())
140   {
141     try // Trap C++ exceptions which would normally be lost because this is a C callback.
142     {
143       // Call the virtual member method, which derived classes might override.
144       obj->on_group_changed();
145     }
146     catch(...)
147     {
148       Glib::exception_handlers_invoke();
149     }
150   }
151   else
152   {
153     BaseClassType *const base = static_cast<BaseClassType*>(
154         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
155     );
156
157     // Call the original underlying C function:
158     if(base && base->group_changed)
159       (*base->group_changed)(self);
160   }
161 }
162
163
164 Glib::ObjectBase* RadioMenuItem_Class::wrap_new(GObject* o)
165 {
166   return manage(new RadioMenuItem((GtkRadioMenuItem*)(o)));
167
168 }
169
170
171 /* The implementation: */
172
173 RadioMenuItem::RadioMenuItem(const Glib::ConstructParams& construct_params)
174 :
175   Gtk::CheckMenuItem(construct_params)
176 {
177   }
178
179 RadioMenuItem::RadioMenuItem(GtkRadioMenuItem* castitem)
180 :
181   Gtk::CheckMenuItem((GtkCheckMenuItem*)(castitem))
182 {
183   }
184
185 RadioMenuItem::~RadioMenuItem()
186 {
187   destroy_();
188 }
189
190 RadioMenuItem::CppClassType RadioMenuItem::radiomenuitem_class_; // initialize static member
191
192 GType RadioMenuItem::get_type()
193 {
194   return radiomenuitem_class_.init().get_type();
195 }
196
197 GType RadioMenuItem::get_base_type()
198 {
199   return gtk_radio_menu_item_get_type();
200 }
201
202
203 Group RadioMenuItem::get_group()
204 {
205   return Group(gtk_radio_menu_item_get_group(gobj()));
206 }
207
208
209 Glib::SignalProxy0< void > RadioMenuItem::signal_group_changed()
210 {
211   return Glib::SignalProxy0< void >(this, &RadioMenuItem_signal_group_changed_info);
212 }
213
214
215 void Gtk::RadioMenuItem::on_group_changed()
216 {
217   BaseClassType *const base = static_cast<BaseClassType*>(
218       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
219   );
220
221   if(base && base->group_changed)
222     (*base->group_changed)(gobj());
223 }
224
225
226 } // namespace Gtk
227
228