1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/radiomenuitem.h>
4 #include <gtkmm/private/radiomenuitem_p.h>
11 * Copyright 1998-2002 The gtkmm Development Team
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.
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.
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.
28 #include <gtkmm/misc.h>
29 #include <gtkmm/label.h>
30 #include <gtk/gtkradiomenuitem.h>
32 typedef Gtk::RadioMenuItem::Group Group; //So that the generate get_group return type is parsed.
37 RadioMenuItem::RadioMenuItem(Group& groupx)
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))
45 RadioMenuItem::RadioMenuItem(Group& groupx, const Glib::ustring &label, bool mnemonic)
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))
51 add_accel_label(label, mnemonic);
54 void RadioMenuItem::set_group(Group& group)
56 gtk_radio_menu_item_set_group(gobj(), group.group_);
58 //The group will be updated, ready for use with the next radiomenuitem:
62 void RadioMenuItem::reset_group()
64 gtk_radio_menu_item_set_group(gobj(), 0);
74 const Glib::SignalProxyInfo RadioMenuItem_signal_group_changed_info =
77 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
78 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
81 } // anonymous namespace
87 Gtk::RadioMenuItem* wrap(GtkRadioMenuItem* object, bool take_copy)
89 return dynamic_cast<Gtk::RadioMenuItem *> (Glib::wrap_auto ((GObject*)(object), take_copy));
92 } /* namespace Glib */
98 /* The *_Class implementation: */
100 const Glib::Class& RadioMenuItem_Class::init()
102 if(!gtype_) // create the GType if necessary
104 // Glib::Class has to know the class init function to clone custom types.
105 class_init_func_ = &RadioMenuItem_Class::class_init_function;
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();
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());
114 // Add derived versions of interfaces, if the C type implements any interfaces:
120 void RadioMenuItem_Class::class_init_function(void* g_class, void* class_data)
122 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
123 CppClassParent::class_init_function(klass, class_data);
125 klass->group_changed = &group_changed_callback;
129 void RadioMenuItem_Class::group_changed_callback(GtkRadioMenuItem* self)
131 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
132 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
139 if(obj && obj->is_derived_())
141 try // Trap C++ exceptions which would normally be lost because this is a C callback.
143 // Call the virtual member method, which derived classes might override.
144 obj->on_group_changed();
148 Glib::exception_handlers_invoke();
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).
157 // Call the original underlying C function:
158 if(base && base->group_changed)
159 (*base->group_changed)(self);
164 Glib::ObjectBase* RadioMenuItem_Class::wrap_new(GObject* o)
166 return manage(new RadioMenuItem((GtkRadioMenuItem*)(o)));
171 /* The implementation: */
173 RadioMenuItem::RadioMenuItem(const Glib::ConstructParams& construct_params)
175 Gtk::CheckMenuItem(construct_params)
179 RadioMenuItem::RadioMenuItem(GtkRadioMenuItem* castitem)
181 Gtk::CheckMenuItem((GtkCheckMenuItem*)(castitem))
185 RadioMenuItem::~RadioMenuItem()
190 RadioMenuItem::CppClassType RadioMenuItem::radiomenuitem_class_; // initialize static member
192 GType RadioMenuItem::get_type()
194 return radiomenuitem_class_.init().get_type();
197 GType RadioMenuItem::get_base_type()
199 return gtk_radio_menu_item_get_type();
203 Group RadioMenuItem::get_group()
205 return Group(gtk_radio_menu_item_get_group(gobj()));
209 Glib::SignalProxy0< void > RadioMenuItem::signal_group_changed()
211 return Glib::SignalProxy0< void >(this, &RadioMenuItem_signal_group_changed_info);
215 void Gtk::RadioMenuItem::on_group_changed()
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).
221 if(base && base->group_changed)
222 (*base->group_changed)(gobj());