Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / radioaction.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/radioaction.h>
4 #include <gtkmm/private/radioaction_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* Copyright 2003 The gtkmm Development Team
10  *
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.
15  *
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.
20  *
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.
24  */
25
26 #include <gtk/gtkradioaction.h>
27
28
29 typedef Gtk::RadioAction::Group Group; //So that the generate get_group return type is parsed.
30
31 namespace Gtk
32 {
33
34 RadioAction::RadioAction(Group& group, const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip)
35 :
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))
38 {
39   set_group(group);
40 }
41
42 Glib::RefPtr<RadioAction> RadioAction::create(Group& group, const Glib::ustring& name, const Glib::ustring& label, const Glib::ustring& tooltip)
43 {
44   return Glib::RefPtr<RadioAction>( new RadioAction(group, name, Gtk::StockID(), label, tooltip) );
45 }
46
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)
48 {
49   return Glib::RefPtr<RadioAction>( new RadioAction(group, name, stock_id, label, tooltip) );
50 }
51
52 void RadioAction::set_group(Group& group)
53 {
54   gtk_radio_action_set_group(gobj(), group.group_);
55
56   //The group will be updated, ready for use with the next radio action:
57   group = get_group();
58 }
59
60
61 } // namespace Gtk
62
63
64 namespace
65 {
66
67 void RadioAction_signal_changed_callback(GtkRadioAction* self, GtkRadioAction* p0,void* data)
68 {
69   using namespace Gtk;
70   typedef sigc::slot< void,const Glib::RefPtr<RadioAction>& > SlotType;
71
72   // Do not try to call a signal on a disassociated wrapper.
73   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
74   {
75     try
76     {
77       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
78         (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
79 );
80     }
81     catch(...)
82     {
83       Glib::exception_handlers_invoke();
84     }
85   }
86 }
87
88 const Glib::SignalProxyInfo RadioAction_signal_changed_info =
89 {
90   "changed",
91   (GCallback) &RadioAction_signal_changed_callback,
92   (GCallback) &RadioAction_signal_changed_callback
93 };
94
95 } // anonymous namespace
96
97
98 namespace Glib
99 {
100
101 Glib::RefPtr<Gtk::RadioAction> wrap(GtkRadioAction* object, bool take_copy)
102 {
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.
105 }
106
107 } /* namespace Glib */
108
109
110 namespace Gtk
111 {
112
113
114 /* The *_Class implementation: */
115
116 const Glib::Class& RadioAction_Class::init()
117 {
118   if(!gtype_) // create the GType if necessary
119   {
120     // Glib::Class has to know the class init function to clone custom types.
121     class_init_func_ = &RadioAction_Class::class_init_function;
122
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();
126
127     // Create the wrapper type, with the same class/instance size as the base type.
128     register_derived_type(gtk_radio_action_get_type());
129
130     // Add derived versions of interfaces, if the C type implements any interfaces:
131   }
132
133   return *this;
134 }
135
136 void RadioAction_Class::class_init_function(void* g_class, void* class_data)
137 {
138   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
139   CppClassParent::class_init_function(klass, class_data);
140
141   klass->changed = &changed_callback;
142 }
143
144
145 void RadioAction_Class::changed_callback(GtkRadioAction* self, GtkRadioAction* p0)
146 {
147   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
148       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
149
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
154   // being overridden:
155   if(obj && obj->is_derived_())
156   {
157     try // Trap C++ exceptions which would normally be lost because this is a C callback.
158     {
159       // Call the virtual member method, which derived classes might override.
160       obj->on_changed(Glib::wrap(p0)
161 );
162     }
163     catch(...)
164     {
165       Glib::exception_handlers_invoke();
166     }
167   }
168   else
169   {
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).
172     );
173
174     // Call the original underlying C function:
175     if(base && base->changed)
176       (*base->changed)(self, p0);
177   }
178 }
179
180
181 Glib::ObjectBase* RadioAction_Class::wrap_new(GObject* object)
182 {
183   return new RadioAction((GtkRadioAction*)object);
184 }
185
186
187 /* The implementation: */
188
189 GtkRadioAction* RadioAction::gobj_copy()
190 {
191   reference();
192   return gobj();
193 }
194
195 RadioAction::RadioAction(const Glib::ConstructParams& construct_params)
196 :
197   Gtk::ToggleAction(construct_params)
198 {}
199
200 RadioAction::RadioAction(GtkRadioAction* castitem)
201 :
202   Gtk::ToggleAction((GtkToggleAction*)(castitem))
203 {}
204
205 RadioAction::~RadioAction()
206 {}
207
208
209 RadioAction::CppClassType RadioAction::radioaction_class_; // initialize static member
210
211 GType RadioAction::get_type()
212 {
213   return radioaction_class_.init().get_type();
214 }
215
216 GType RadioAction::get_base_type()
217 {
218   return gtk_radio_action_get_type();
219 }
220
221
222 RadioAction::RadioAction()
223 :
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()))
226 {
227   }
228
229 Glib::RefPtr<RadioAction> RadioAction::create()
230 {
231   return Glib::RefPtr<RadioAction>( new RadioAction() );
232 }
233 Group RadioAction::get_group()
234 {
235   return Group(gtk_radio_action_get_group(gobj()));
236 }
237
238 int RadioAction::get_current_value() const
239 {
240   return gtk_radio_action_get_current_value(const_cast<GtkRadioAction*>(gobj()));
241 }
242
243
244 Glib::SignalProxy1< void,const Glib::RefPtr<RadioAction>& > RadioAction::signal_changed()
245 {
246   return Glib::SignalProxy1< void,const Glib::RefPtr<RadioAction>& >(this, &RadioAction_signal_changed_info);
247 }
248
249
250 Glib::PropertyProxy<int> RadioAction::property_value() 
251 {
252   return Glib::PropertyProxy<int>(this, "value");
253 }
254
255 Glib::PropertyProxy_ReadOnly<int> RadioAction::property_value() const
256 {
257   return Glib::PropertyProxy_ReadOnly<int>(this, "value");
258 }
259
260
261 void Gtk::RadioAction::on_changed(const Glib::RefPtr<RadioAction>& current)
262 {
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).
265   );
266
267   if(base && base->changed)
268     (*base->changed)(gobj(),Glib::unwrap(current));
269 }
270
271
272 } // namespace Gtk
273
274