Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / uimanager.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/uimanager.h>
4 #include <gtkmm/private/uimanager_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/gtkuimanager.h>
27
28
29 namespace Gtk
30 {
31
32 typedef UIManager::ui_merge_id ui_merge_id; //Help gmmproc so that it does not need to add the full type name for the return type.
33
34 UIManager::ui_merge_id UIManager::add_ui_from_string(const Glib::ustring& buffer)
35 {
36   GError *error = 0;
37   guint retvalue = gtk_ui_manager_add_ui_from_string(gobj(), buffer.c_str(), buffer.size(), &(error));
38   if(error) ::Glib::Error::throw_exception(error);
39   return retvalue;
40 }
41
42 void UIManager::add_ui_separator(ui_merge_id merge_id, const Glib::ustring& path, const Glib::ustring& name, UIManagerItemType type, bool top)
43 {
44   gtk_ui_manager_add_ui(gobj(), merge_id, path.c_str(), name.c_str(), 0 /* See C docs */, ((GtkUIManagerItemType)(type)), static_cast<int>(top));
45 }
46
47
48 } // namespace Gtk
49
50
51 namespace
52 {
53
54 void UIManager_signal_add_widget_callback(GtkUIManager* self, GtkWidget* p0,void* data)
55 {
56   using namespace Gtk;
57   typedef sigc::slot< void,Widget* > SlotType;
58
59   // Do not try to call a signal on a disassociated wrapper.
60   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
61   {
62     try
63     {
64       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
65         (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
66 );
67     }
68     catch(...)
69     {
70       Glib::exception_handlers_invoke();
71     }
72   }
73 }
74
75 const Glib::SignalProxyInfo UIManager_signal_add_widget_info =
76 {
77   "add_widget",
78   (GCallback) &UIManager_signal_add_widget_callback,
79   (GCallback) &UIManager_signal_add_widget_callback
80 };
81
82
83 const Glib::SignalProxyInfo UIManager_signal_actions_changed_info =
84 {
85   "actions_changed",
86   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
87   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
88 };
89
90
91 void UIManager_signal_connect_proxy_callback(GtkUIManager* self, GtkAction* p0,GtkWidget* p1,void* data)
92 {
93   using namespace Gtk;
94   typedef sigc::slot< void,const Glib::RefPtr<Action>&,Widget* > SlotType;
95
96   // Do not try to call a signal on a disassociated wrapper.
97   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
98   {
99     try
100     {
101       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
102         (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
103 , Glib::wrap(p1)
104 );
105     }
106     catch(...)
107     {
108       Glib::exception_handlers_invoke();
109     }
110   }
111 }
112
113 const Glib::SignalProxyInfo UIManager_signal_connect_proxy_info =
114 {
115   "connect_proxy",
116   (GCallback) &UIManager_signal_connect_proxy_callback,
117   (GCallback) &UIManager_signal_connect_proxy_callback
118 };
119
120
121 void UIManager_signal_disconnect_proxy_callback(GtkUIManager* self, GtkAction* p0,GtkWidget* p1,void* data)
122 {
123   using namespace Gtk;
124   typedef sigc::slot< void,const Glib::RefPtr<Action>&,Widget* > SlotType;
125
126   // Do not try to call a signal on a disassociated wrapper.
127   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
128   {
129     try
130     {
131       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
132         (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
133 , Glib::wrap(p1)
134 );
135     }
136     catch(...)
137     {
138       Glib::exception_handlers_invoke();
139     }
140   }
141 }
142
143 const Glib::SignalProxyInfo UIManager_signal_disconnect_proxy_info =
144 {
145   "disconnect_proxy",
146   (GCallback) &UIManager_signal_disconnect_proxy_callback,
147   (GCallback) &UIManager_signal_disconnect_proxy_callback
148 };
149
150
151 void UIManager_signal_pre_activate_callback(GtkUIManager* self, GtkAction* p0,void* data)
152 {
153   using namespace Gtk;
154   typedef sigc::slot< void,const Glib::RefPtr<Action>& > SlotType;
155
156   // Do not try to call a signal on a disassociated wrapper.
157   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
158   {
159     try
160     {
161       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
162         (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
163 );
164     }
165     catch(...)
166     {
167       Glib::exception_handlers_invoke();
168     }
169   }
170 }
171
172 const Glib::SignalProxyInfo UIManager_signal_pre_activate_info =
173 {
174   "pre_activate",
175   (GCallback) &UIManager_signal_pre_activate_callback,
176   (GCallback) &UIManager_signal_pre_activate_callback
177 };
178
179
180 void UIManager_signal_post_activate_callback(GtkUIManager* self, GtkAction* p0,void* data)
181 {
182   using namespace Gtk;
183   typedef sigc::slot< void,const Glib::RefPtr<Action>& > SlotType;
184
185   // Do not try to call a signal on a disassociated wrapper.
186   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
187   {
188     try
189     {
190       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
191         (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
192 );
193     }
194     catch(...)
195     {
196       Glib::exception_handlers_invoke();
197     }
198   }
199 }
200
201 const Glib::SignalProxyInfo UIManager_signal_post_activate_info =
202 {
203   "post_activate",
204   (GCallback) &UIManager_signal_post_activate_callback,
205   (GCallback) &UIManager_signal_post_activate_callback
206 };
207
208 } // anonymous namespace
209
210 // static
211 GType Glib::Value<Gtk::UIManagerItemType>::value_type()
212 {
213   return gtk_ui_manager_item_type_get_type();
214 }
215
216
217 namespace Glib
218 {
219
220 Glib::RefPtr<Gtk::UIManager> wrap(GtkUIManager* object, bool take_copy)
221 {
222   return Glib::RefPtr<Gtk::UIManager>( dynamic_cast<Gtk::UIManager*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
223   //We use dynamic_cast<> in case of multiple inheritance.
224 }
225
226 } /* namespace Glib */
227
228
229 namespace Gtk
230 {
231
232
233 /* The *_Class implementation: */
234
235 const Glib::Class& UIManager_Class::init()
236 {
237   if(!gtype_) // create the GType if necessary
238   {
239     // Glib::Class has to know the class init function to clone custom types.
240     class_init_func_ = &UIManager_Class::class_init_function;
241
242     // This is actually just optimized away, apparently with no harm.
243     // Make sure that the parent type has been created.
244     //CppClassParent::CppObjectType::get_type();
245
246     // Create the wrapper type, with the same class/instance size as the base type.
247     register_derived_type(gtk_ui_manager_get_type());
248
249     // Add derived versions of interfaces, if the C type implements any interfaces:
250   }
251
252   return *this;
253 }
254
255 void UIManager_Class::class_init_function(void* g_class, void* class_data)
256 {
257   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
258   CppClassParent::class_init_function(klass, class_data);
259
260   klass->add_widget = &add_widget_callback;
261   klass->actions_changed = &actions_changed_callback;
262 }
263
264
265 void UIManager_Class::add_widget_callback(GtkUIManager* self, GtkWidget* p0)
266 {
267   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
268       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
269
270   // Non-gtkmmproc-generated custom classes implicitly call the default
271   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
272   // generated classes can use this optimisation, which avoids the unnecessary
273   // parameter conversions if there is no possibility of the virtual function
274   // being overridden:
275   if(obj && obj->is_derived_())
276   {
277     try // Trap C++ exceptions which would normally be lost because this is a C callback.
278     {
279       // Call the virtual member method, which derived classes might override.
280       obj->on_add_widget(Glib::wrap(p0)
281 );
282     }
283     catch(...)
284     {
285       Glib::exception_handlers_invoke();
286     }
287   }
288   else
289   {
290     BaseClassType *const base = static_cast<BaseClassType*>(
291         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
292     );
293
294     // Call the original underlying C function:
295     if(base && base->add_widget)
296       (*base->add_widget)(self, p0);
297   }
298 }
299
300 void UIManager_Class::actions_changed_callback(GtkUIManager* self)
301 {
302   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
303       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
304
305   // Non-gtkmmproc-generated custom classes implicitly call the default
306   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
307   // generated classes can use this optimisation, which avoids the unnecessary
308   // parameter conversions if there is no possibility of the virtual function
309   // being overridden:
310   if(obj && obj->is_derived_())
311   {
312     try // Trap C++ exceptions which would normally be lost because this is a C callback.
313     {
314       // Call the virtual member method, which derived classes might override.
315       obj->on_actions_changed();
316     }
317     catch(...)
318     {
319       Glib::exception_handlers_invoke();
320     }
321   }
322   else
323   {
324     BaseClassType *const base = static_cast<BaseClassType*>(
325         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
326     );
327
328     // Call the original underlying C function:
329     if(base && base->actions_changed)
330       (*base->actions_changed)(self);
331   }
332 }
333
334
335 Glib::ObjectBase* UIManager_Class::wrap_new(GObject* object)
336 {
337   return new UIManager((GtkUIManager*)object);
338 }
339
340
341 /* The implementation: */
342
343 GtkUIManager* UIManager::gobj_copy()
344 {
345   reference();
346   return gobj();
347 }
348
349 UIManager::UIManager(const Glib::ConstructParams& construct_params)
350 :
351   Glib::Object(construct_params)
352 {}
353
354 UIManager::UIManager(GtkUIManager* castitem)
355 :
356   Glib::Object((GObject*)(castitem))
357 {}
358
359 UIManager::~UIManager()
360 {}
361
362
363 UIManager::CppClassType UIManager::uimanager_class_; // initialize static member
364
365 GType UIManager::get_type()
366 {
367   return uimanager_class_.init().get_type();
368 }
369
370 GType UIManager::get_base_type()
371 {
372   return gtk_ui_manager_get_type();
373 }
374
375
376 UIManager::UIManager()
377 :
378   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
379   Glib::Object(Glib::ConstructParams(uimanager_class_.init()))
380 {
381   }
382
383 Glib::RefPtr<UIManager> UIManager::create()
384 {
385   return Glib::RefPtr<UIManager>( new UIManager() );
386 }
387 void UIManager::set_add_tearoffs(bool add_tearoffs)
388 {
389   gtk_ui_manager_set_add_tearoffs(gobj(), static_cast<int>(add_tearoffs));
390 }
391
392 bool UIManager::get_add_tearoffs() const
393 {
394   return gtk_ui_manager_get_add_tearoffs(const_cast<GtkUIManager*>(gobj()));
395 }
396
397 void UIManager::insert_action_group(const Glib::RefPtr<ActionGroup>& action_group, int pos)
398 {
399   gtk_ui_manager_insert_action_group(gobj(), Glib::unwrap(action_group), pos);
400 }
401
402 void UIManager::remove_action_group(const Glib::RefPtr<ActionGroup>& action_group)
403 {
404   gtk_ui_manager_remove_action_group(gobj(), Glib::unwrap(action_group));
405 }
406
407 Glib::ListHandle< Glib::RefPtr<ActionGroup> > UIManager::get_action_groups()
408 {
409   return Glib::ListHandle< Glib::RefPtr<ActionGroup> >(gtk_ui_manager_get_action_groups(gobj()), Glib::OWNERSHIP_SHALLOW);
410 }
411
412 Glib::ListHandle< Glib::RefPtr<const ActionGroup> > UIManager::get_action_groups() const
413 {
414   return Glib::ListHandle< Glib::RefPtr<const ActionGroup> >(gtk_ui_manager_get_action_groups(const_cast<GtkUIManager*>(gobj())), Glib::OWNERSHIP_SHALLOW);
415 }
416
417 Glib::RefPtr<AccelGroup> UIManager::get_accel_group()
418 {
419
420   Glib::RefPtr<AccelGroup> retvalue = Glib::wrap(gtk_ui_manager_get_accel_group(gobj()));
421
422   if(retvalue)
423     retvalue->reference(); //The function does not do a ref for us.
424   return retvalue;
425 }
426
427 Glib::RefPtr<const AccelGroup> UIManager::get_accel_group() const
428 {
429
430   Glib::RefPtr<const AccelGroup> retvalue = Glib::wrap(gtk_ui_manager_get_accel_group(const_cast<GtkUIManager*>(gobj())));
431
432   if(retvalue)
433     retvalue->reference(); //The function does not do a ref for us.
434   return retvalue;
435 }
436
437 Widget* UIManager::get_widget(const Glib::ustring& path)
438 {
439   return Glib::wrap(gtk_ui_manager_get_widget(gobj(), path.c_str()));
440 }
441
442 const Widget* UIManager::get_widget(const Glib::ustring& path) const
443 {
444   return Glib::wrap(gtk_ui_manager_get_widget(const_cast<GtkUIManager*>(gobj()), path.c_str()));
445 }
446
447 Glib::SListHandle<Widget*> UIManager::get_toplevels(UIManagerItemType types)
448 {
449   return Glib::SListHandle<Widget*>(gtk_ui_manager_get_toplevels(gobj(), ((GtkUIManagerItemType)(types))), Glib::OWNERSHIP_SHALLOW);
450 }
451
452 Glib::SListHandle<const Widget*> UIManager::get_toplevels(UIManagerItemType types) const
453 {
454   return Glib::SListHandle<const Widget*>(gtk_ui_manager_get_toplevels(const_cast<GtkUIManager*>(gobj()), ((GtkUIManagerItemType)(types))), Glib::OWNERSHIP_SHALLOW);
455 }
456
457 Glib::RefPtr<Action> UIManager::get_action(const Glib::ustring& path)
458 {
459
460   Glib::RefPtr<Action> retvalue = Glib::wrap(gtk_ui_manager_get_action(gobj(), path.c_str()));
461
462   if(retvalue)
463     retvalue->reference(); //The function does not do a ref for us.
464   return retvalue;
465 }
466
467 Glib::RefPtr<const Action> UIManager::get_action(const Glib::ustring& path) const
468 {
469
470   Glib::RefPtr<const Action> retvalue = Glib::wrap(gtk_ui_manager_get_action(const_cast<GtkUIManager*>(gobj()), path.c_str()));
471
472   if(retvalue)
473     retvalue->reference(); //The function does not do a ref for us.
474   return retvalue;
475 }
476
477 ui_merge_id UIManager::add_ui_from_file(const Glib::ustring& filename)
478 {
479   GError *error = 0;
480   ui_merge_id retvalue = gtk_ui_manager_add_ui_from_file(gobj(), filename.c_str(), &(error));
481   if(error) ::Glib::Error::throw_exception(error);
482   return retvalue;
483 }
484
485 void UIManager::add_ui(ui_merge_id merge_id, const Glib::ustring& path, const Glib::ustring& name, const Glib::ustring& action, UIManagerItemType type, bool top)
486 {
487   gtk_ui_manager_add_ui(gobj(), merge_id, path.c_str(), name.c_str(), action.c_str(), ((GtkUIManagerItemType)(type)), static_cast<int>(top));
488 }
489
490 void UIManager::remove_ui(ui_merge_id merge_id)
491 {
492   gtk_ui_manager_remove_ui(gobj(), merge_id);
493 }
494
495 Glib::ustring UIManager::get_ui() const
496 {
497   return Glib::convert_return_gchar_ptr_to_ustring(gtk_ui_manager_get_ui(const_cast<GtkUIManager*>(gobj())));
498 }
499
500 void UIManager::ensure_update()
501 {
502   gtk_ui_manager_ensure_update(gobj());
503 }
504
505 ui_merge_id UIManager::new_merge_id()
506 {
507   return gtk_ui_manager_new_merge_id(gobj());
508 }
509
510
511 Glib::SignalProxy1< void,Widget* > UIManager::signal_add_widget()
512 {
513   return Glib::SignalProxy1< void,Widget* >(this, &UIManager_signal_add_widget_info);
514 }
515
516 Glib::SignalProxy0< void > UIManager::signal_actions_changed()
517 {
518   return Glib::SignalProxy0< void >(this, &UIManager_signal_actions_changed_info);
519 }
520
521 Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* > UIManager::signal_connect_proxy()
522 {
523   return Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* >(this, &UIManager_signal_connect_proxy_info);
524 }
525
526 Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* > UIManager::signal_disconnect_proxy()
527 {
528   return Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* >(this, &UIManager_signal_disconnect_proxy_info);
529 }
530
531 Glib::SignalProxy1< void,const Glib::RefPtr<Action>& > UIManager::signal_pre_activate()
532 {
533   return Glib::SignalProxy1< void,const Glib::RefPtr<Action>& >(this, &UIManager_signal_pre_activate_info);
534 }
535
536 Glib::SignalProxy1< void,const Glib::RefPtr<Action>& > UIManager::signal_post_activate()
537 {
538   return Glib::SignalProxy1< void,const Glib::RefPtr<Action>& >(this, &UIManager_signal_post_activate_info);
539 }
540
541
542 Glib::PropertyProxy<bool> UIManager::property_add_tearoffs() 
543 {
544   return Glib::PropertyProxy<bool>(this, "add-tearoffs");
545 }
546
547 Glib::PropertyProxy_ReadOnly<bool> UIManager::property_add_tearoffs() const
548 {
549   return Glib::PropertyProxy_ReadOnly<bool>(this, "add-tearoffs");
550 }
551
552 Glib::PropertyProxy_ReadOnly<Glib::ustring> UIManager::property_ui() const
553 {
554   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "ui");
555 }
556
557
558 void Gtk::UIManager::on_add_widget(Widget* widget)
559 {
560   BaseClassType *const base = static_cast<BaseClassType*>(
561       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
562   );
563
564   if(base && base->add_widget)
565     (*base->add_widget)(gobj(),(GtkWidget*)Glib::unwrap(widget));
566 }
567
568 void Gtk::UIManager::on_actions_changed()
569 {
570   BaseClassType *const base = static_cast<BaseClassType*>(
571       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
572   );
573
574   if(base && base->actions_changed)
575     (*base->actions_changed)(gobj());
576 }
577
578
579 } // namespace Gtk
580
581