1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/radioaction.h>
4 #include <gtkmm/private/radioaction_p.h>
9 /* Copyright 2003 The gtkmm Development Team
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <gtk/gtkradioaction.h>
29 typedef Gtk::RadioAction::Group Group; //So that the generate get_group return type is parsed.
34 RadioAction::RadioAction(Group& group, const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip)
36 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
37 Gtk::ToggleAction(Glib::ConstructParams(radioaction_class_.init(), "name",name.c_str(),"stock_id",stock_id.get_c_str(),"label",(label.empty() ? 0 : label.c_str()),"tooltip",(tooltip.empty() ? 0 : tooltip.c_str()), (char*) 0))
42 Glib::RefPtr<RadioAction> RadioAction::create(Group& group, const Glib::ustring& name, const Glib::ustring& label, const Glib::ustring& tooltip)
44 return Glib::RefPtr<RadioAction>( new RadioAction(group, name, Gtk::StockID(), label, tooltip) );
47 Glib::RefPtr<RadioAction> RadioAction::create(Group& group, const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip)
49 return Glib::RefPtr<RadioAction>( new RadioAction(group, name, stock_id, label, tooltip) );
52 void RadioAction::set_group(Group& group)
54 gtk_radio_action_set_group(gobj(), group.group_);
56 //The group will be updated, ready for use with the next radio action:
67 void RadioAction_signal_changed_callback(GtkRadioAction* self, GtkRadioAction* p0,void* data)
70 typedef sigc::slot< void,const Glib::RefPtr<RadioAction>& > SlotType;
72 // Do not try to call a signal on a disassociated wrapper.
73 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
77 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
78 (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
83 Glib::exception_handlers_invoke();
88 const Glib::SignalProxyInfo RadioAction_signal_changed_info =
91 (GCallback) &RadioAction_signal_changed_callback,
92 (GCallback) &RadioAction_signal_changed_callback
95 } // anonymous namespace
101 Glib::RefPtr<Gtk::RadioAction> wrap(GtkRadioAction* object, bool take_copy)
103 return Glib::RefPtr<Gtk::RadioAction>( dynamic_cast<Gtk::RadioAction*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
104 //We use dynamic_cast<> in case of multiple inheritance.
107 } /* namespace Glib */
114 /* The *_Class implementation: */
116 const Glib::Class& RadioAction_Class::init()
118 if(!gtype_) // create the GType if necessary
120 // Glib::Class has to know the class init function to clone custom types.
121 class_init_func_ = &RadioAction_Class::class_init_function;
123 // This is actually just optimized away, apparently with no harm.
124 // Make sure that the parent type has been created.
125 //CppClassParent::CppObjectType::get_type();
127 // Create the wrapper type, with the same class/instance size as the base type.
128 register_derived_type(gtk_radio_action_get_type());
130 // Add derived versions of interfaces, if the C type implements any interfaces:
136 void RadioAction_Class::class_init_function(void* g_class, void* class_data)
138 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
139 CppClassParent::class_init_function(klass, class_data);
141 klass->changed = &changed_callback;
145 void RadioAction_Class::changed_callback(GtkRadioAction* self, GtkRadioAction* p0)
147 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
148 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
150 // Non-gtkmmproc-generated custom classes implicitly call the default
151 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
152 // generated classes can use this optimisation, which avoids the unnecessary
153 // parameter conversions if there is no possibility of the virtual function
155 if(obj && obj->is_derived_())
157 try // Trap C++ exceptions which would normally be lost because this is a C callback.
159 // Call the virtual member method, which derived classes might override.
160 obj->on_changed(Glib::wrap(p0)
165 Glib::exception_handlers_invoke();
170 BaseClassType *const base = static_cast<BaseClassType*>(
171 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
174 // Call the original underlying C function:
175 if(base && base->changed)
176 (*base->changed)(self, p0);
181 Glib::ObjectBase* RadioAction_Class::wrap_new(GObject* object)
183 return new RadioAction((GtkRadioAction*)object);
187 /* The implementation: */
189 GtkRadioAction* RadioAction::gobj_copy()
195 RadioAction::RadioAction(const Glib::ConstructParams& construct_params)
197 Gtk::ToggleAction(construct_params)
200 RadioAction::RadioAction(GtkRadioAction* castitem)
202 Gtk::ToggleAction((GtkToggleAction*)(castitem))
205 RadioAction::~RadioAction()
209 RadioAction::CppClassType RadioAction::radioaction_class_; // initialize static member
211 GType RadioAction::get_type()
213 return radioaction_class_.init().get_type();
216 GType RadioAction::get_base_type()
218 return gtk_radio_action_get_type();
222 RadioAction::RadioAction()
224 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
225 Gtk::ToggleAction(Glib::ConstructParams(radioaction_class_.init()))
229 Glib::RefPtr<RadioAction> RadioAction::create()
231 return Glib::RefPtr<RadioAction>( new RadioAction() );
233 Group RadioAction::get_group()
235 return Group(gtk_radio_action_get_group(gobj()));
238 int RadioAction::get_current_value() const
240 return gtk_radio_action_get_current_value(const_cast<GtkRadioAction*>(gobj()));
244 Glib::SignalProxy1< void,const Glib::RefPtr<RadioAction>& > RadioAction::signal_changed()
246 return Glib::SignalProxy1< void,const Glib::RefPtr<RadioAction>& >(this, &RadioAction_signal_changed_info);
250 Glib::PropertyProxy<int> RadioAction::property_value()
252 return Glib::PropertyProxy<int>(this, "value");
255 Glib::PropertyProxy_ReadOnly<int> RadioAction::property_value() const
257 return Glib::PropertyProxy_ReadOnly<int>(this, "value");
261 void Gtk::RadioAction::on_changed(const Glib::RefPtr<RadioAction>& current)
263 BaseClassType *const base = static_cast<BaseClassType*>(
264 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
267 if(base && base->changed)
268 (*base->changed)(gobj(),Glib::unwrap(current));