1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <gtkmm/radiobutton.h>
5 #include <gtkmm/private/radiobutton_p.h>
12 * Copyright 1998-2002 The gtkmm Development Team
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Library General Public
16 * License as published by the Free Software Foundation; either
17 * version 2 of the License, or (at your option) any later version.
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with this library; if not, write to the Free
26 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #include <gtk/gtkradiobutton.h>
31 typedef Gtk::RadioButton::Group Group; //So that the generate get_group return type is parsed.
36 RadioButton::RadioButton()
38 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
40 Gtk::CheckButton(Glib::ConstructParams(radiobutton_class_.init()))
43 RadioButton::RadioButton(const Glib::ustring& label, bool mnemonic)
45 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
47 Gtk::CheckButton(Glib::ConstructParams(radiobutton_class_.init(), "label",label.c_str(),"use_underline",gboolean(mnemonic), static_cast<char*>(0)))
50 RadioButton::RadioButton(Group& group)
52 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
54 Gtk::CheckButton(Glib::ConstructParams(radiobutton_class_.init()))
59 RadioButton::RadioButton(Group& group, const Glib::ustring& label, bool mnemonic)
61 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
63 Gtk::CheckButton(Glib::ConstructParams(radiobutton_class_.init(), "label",label.c_str(),"use_underline",gboolean(mnemonic), static_cast<char*>(0)))
68 void RadioButton::set_group(Group& group)
70 gtk_radio_button_set_group(gobj(), group.group_);
72 //The group will be updated, ready for use with the next radiobutton:
76 void RadioButton::reset_group()
78 gtk_radio_button_set_group(gobj(), 0);
88 static const Glib::SignalProxyInfo RadioButton_signal_group_changed_info =
91 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
92 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
96 } // anonymous namespace
102 Gtk::RadioButton* wrap(GtkRadioButton* object, bool take_copy)
104 return dynamic_cast<Gtk::RadioButton *> (Glib::wrap_auto ((GObject*)(object), take_copy));
107 } /* namespace Glib */
113 /* The *_Class implementation: */
115 const Glib::Class& RadioButton_Class::init()
117 if(!gtype_) // create the GType if necessary
119 // Glib::Class has to know the class init function to clone custom types.
120 class_init_func_ = &RadioButton_Class::class_init_function;
122 // This is actually just optimized away, apparently with no harm.
123 // Make sure that the parent type has been created.
124 //CppClassParent::CppObjectType::get_type();
126 // Create the wrapper type, with the same class/instance size as the base type.
127 register_derived_type(gtk_radio_button_get_type());
129 // Add derived versions of interfaces, if the C type implements any interfaces:
135 void RadioButton_Class::class_init_function(void* g_class, void* class_data)
137 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
138 CppClassParent::class_init_function(klass, class_data);
140 #ifdef GLIBMM_VFUNCS_ENABLED
141 #endif //GLIBMM_VFUNCS_ENABLED
143 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
144 klass->group_changed = &group_changed_callback;
145 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
148 #ifdef GLIBMM_VFUNCS_ENABLED
149 #endif //GLIBMM_VFUNCS_ENABLED
151 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
152 void RadioButton_Class::group_changed_callback(GtkRadioButton* self)
154 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
155 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
157 // Non-gtkmmproc-generated custom classes implicitly call the default
158 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
159 // generated classes can use this optimisation, which avoids the unnecessary
160 // parameter conversions if there is no possibility of the virtual function
162 if(obj_base && obj_base->is_derived_())
164 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
165 if(obj) // This can be NULL during destruction.
167 #ifdef GLIBMM_EXCEPTIONS_ENABLED
168 try // Trap C++ exceptions which would normally be lost because this is a C callback.
170 #endif //GLIBMM_EXCEPTIONS_ENABLED
171 // Call the virtual member method, which derived classes might override.
172 obj->on_group_changed();
174 #ifdef GLIBMM_EXCEPTIONS_ENABLED
178 Glib::exception_handlers_invoke();
180 #endif //GLIBMM_EXCEPTIONS_ENABLED
184 BaseClassType *const base = static_cast<BaseClassType*>(
185 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
188 // Call the original underlying C function:
189 if(base && base->group_changed)
190 (*base->group_changed)(self);
192 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
195 Glib::ObjectBase* RadioButton_Class::wrap_new(GObject* o)
197 return manage(new RadioButton((GtkRadioButton*)(o)));
202 /* The implementation: */
204 RadioButton::RadioButton(const Glib::ConstructParams& construct_params)
206 Gtk::CheckButton(construct_params)
210 RadioButton::RadioButton(GtkRadioButton* castitem)
212 Gtk::CheckButton((GtkCheckButton*)(castitem))
216 RadioButton::~RadioButton()
221 RadioButton::CppClassType RadioButton::radiobutton_class_; // initialize static member
223 GType RadioButton::get_type()
225 return radiobutton_class_.init().get_type();
228 GType RadioButton::get_base_type()
230 return gtk_radio_button_get_type();
234 Group RadioButton::get_group()
236 return Group(gtk_radio_button_get_group(gobj()));
240 Glib::SignalProxy0< void > RadioButton::signal_group_changed()
242 return Glib::SignalProxy0< void >(this, &RadioButton_signal_group_changed_info);
246 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
247 void Gtk::RadioButton::on_group_changed()
249 BaseClassType *const base = static_cast<BaseClassType*>(
250 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
253 if(base && base->group_changed)
254 (*base->group_changed)(gobj());
256 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
258 #ifdef GLIBMM_VFUNCS_ENABLED
259 #endif //GLIBMM_VFUNCS_ENABLED