Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / action.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/action.h>
4 #include <gtkmm/private/action_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/gtkaction.h>
27
28 #include <gtkmm/menuitem.h>
29 #include <gtkmm/toolitem.h>
30 #include <gtkmm/image.h>
31
32 namespace Gtk
33 {
34
35 Action::Action(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip)
36 :
37   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
38   Glib::Object(Glib::ConstructParams(action_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))
39 {}
40
41 Glib::RefPtr<Action> Action::create(const Glib::ustring& name, const Glib::ustring& label, const Glib::ustring& tooltip)
42 {
43   return Glib::RefPtr<Action>( new Action(name, Gtk::StockID(), label, tooltip) );
44 }
45
46 Glib::RefPtr<Action> Action::create(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip)
47 {
48   return Glib::RefPtr<Action>( new Action(name, stock_id, label, tooltip) );
49 }
50
51
52 void Action::set_tooltip(const Glib::ustring& tooltip)
53 {
54   property_tooltip() = tooltip;
55 }
56   
57
58 } // namespace Gtk
59
60
61 namespace
62 {
63
64 const Glib::SignalProxyInfo Action_signal_activate_info =
65 {
66   "activate",
67   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
68   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
69 };
70
71 } // anonymous namespace
72
73
74 namespace Glib
75 {
76
77 Glib::RefPtr<Gtk::Action> wrap(GtkAction* object, bool take_copy)
78 {
79   return Glib::RefPtr<Gtk::Action>( dynamic_cast<Gtk::Action*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
80   //We use dynamic_cast<> in case of multiple inheritance.
81 }
82
83 } /* namespace Glib */
84
85
86 namespace Gtk
87 {
88
89
90 /* The *_Class implementation: */
91
92 const Glib::Class& Action_Class::init()
93 {
94   if(!gtype_) // create the GType if necessary
95   {
96     // Glib::Class has to know the class init function to clone custom types.
97     class_init_func_ = &Action_Class::class_init_function;
98
99     // This is actually just optimized away, apparently with no harm.
100     // Make sure that the parent type has been created.
101     //CppClassParent::CppObjectType::get_type();
102
103     // Create the wrapper type, with the same class/instance size as the base type.
104     register_derived_type(gtk_action_get_type());
105
106     // Add derived versions of interfaces, if the C type implements any interfaces:
107   }
108
109   return *this;
110 }
111
112 void Action_Class::class_init_function(void* g_class, void* class_data)
113 {
114   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
115   CppClassParent::class_init_function(klass, class_data);
116
117   klass->create_menu_item = &create_menu_item_vfunc_callback;
118   klass->create_tool_item = &create_tool_item_vfunc_callback;
119   klass->connect_proxy = &connect_proxy_vfunc_callback;
120   klass->disconnect_proxy = &disconnect_proxy_vfunc_callback;
121   klass->activate = &activate_callback;
122 }
123
124 GtkWidget* Action_Class::create_menu_item_vfunc_callback(GtkAction* self)
125 {
126   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
127       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
128
129   // Non-gtkmmproc-generated custom classes implicitly call the default
130   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
131   // generated classes can use this optimisation, which avoids the unnecessary
132   // parameter conversions if there is no possibility of the virtual function
133   // being overridden:
134   if(obj && obj->is_derived_())
135   {
136     try // Trap C++ exceptions which would normally be lost because this is a C callback.
137     {
138       // Call the virtual member method, which derived classes might override.
139       return (GtkWidget*)Glib::unwrap(obj->create_menu_item_vfunc());
140     }
141     catch(...)
142     {
143       Glib::exception_handlers_invoke();
144     }
145   }
146   else
147   {
148     BaseClassType *const base = static_cast<BaseClassType*>(
149         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
150     );
151
152     // Call the original underlying C function:
153     if(base && base->create_menu_item)
154       return (*base->create_menu_item)(self);
155   }
156
157   typedef GtkWidget* RType;
158   return RType();
159 }
160
161 GtkWidget* Action_Class::create_tool_item_vfunc_callback(GtkAction* self)
162 {
163   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
164       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
165
166   // Non-gtkmmproc-generated custom classes implicitly call the default
167   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
168   // generated classes can use this optimisation, which avoids the unnecessary
169   // parameter conversions if there is no possibility of the virtual function
170   // being overridden:
171   if(obj && obj->is_derived_())
172   {
173     try // Trap C++ exceptions which would normally be lost because this is a C callback.
174     {
175       // Call the virtual member method, which derived classes might override.
176       return (GtkWidget*)Glib::unwrap(obj->create_tool_item_vfunc());
177     }
178     catch(...)
179     {
180       Glib::exception_handlers_invoke();
181     }
182   }
183   else
184   {
185     BaseClassType *const base = static_cast<BaseClassType*>(
186         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
187     );
188
189     // Call the original underlying C function:
190     if(base && base->create_tool_item)
191       return (*base->create_tool_item)(self);
192   }
193
194   typedef GtkWidget* RType;
195   return RType();
196 }
197
198 void Action_Class::connect_proxy_vfunc_callback(GtkAction* self, GtkWidget* proxy)
199 {
200   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
201       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
202
203   // Non-gtkmmproc-generated custom classes implicitly call the default
204   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
205   // generated classes can use this optimisation, which avoids the unnecessary
206   // parameter conversions if there is no possibility of the virtual function
207   // being overridden:
208   if(obj && obj->is_derived_())
209   {
210     try // Trap C++ exceptions which would normally be lost because this is a C callback.
211     {
212       // Call the virtual member method, which derived classes might override.
213       obj->connect_proxy_vfunc(Glib::wrap(proxy)
214 );
215     }
216     catch(...)
217     {
218       Glib::exception_handlers_invoke();
219     }
220   }
221   else
222   {
223     BaseClassType *const base = static_cast<BaseClassType*>(
224         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
225     );
226
227     // Call the original underlying C function:
228     if(base && base->connect_proxy)
229       (*base->connect_proxy)(self, proxy);
230   }
231 }
232
233 void Action_Class::disconnect_proxy_vfunc_callback(GtkAction* self, GtkWidget* proxy)
234 {
235   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
236       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
237
238   // Non-gtkmmproc-generated custom classes implicitly call the default
239   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
240   // generated classes can use this optimisation, which avoids the unnecessary
241   // parameter conversions if there is no possibility of the virtual function
242   // being overridden:
243   if(obj && obj->is_derived_())
244   {
245     try // Trap C++ exceptions which would normally be lost because this is a C callback.
246     {
247       // Call the virtual member method, which derived classes might override.
248       obj->disconnect_proxy_vfunc(Glib::wrap(proxy)
249 );
250     }
251     catch(...)
252     {
253       Glib::exception_handlers_invoke();
254     }
255   }
256   else
257   {
258     BaseClassType *const base = static_cast<BaseClassType*>(
259         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
260     );
261
262     // Call the original underlying C function:
263     if(base && base->disconnect_proxy)
264       (*base->disconnect_proxy)(self, proxy);
265   }
266 }
267
268
269 void Action_Class::activate_callback(GtkAction* self)
270 {
271   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
272       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
273
274   // Non-gtkmmproc-generated custom classes implicitly call the default
275   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
276   // generated classes can use this optimisation, which avoids the unnecessary
277   // parameter conversions if there is no possibility of the virtual function
278   // being overridden:
279   if(obj && obj->is_derived_())
280   {
281     try // Trap C++ exceptions which would normally be lost because this is a C callback.
282     {
283       // Call the virtual member method, which derived classes might override.
284       obj->on_activate();
285     }
286     catch(...)
287     {
288       Glib::exception_handlers_invoke();
289     }
290   }
291   else
292   {
293     BaseClassType *const base = static_cast<BaseClassType*>(
294         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
295     );
296
297     // Call the original underlying C function:
298     if(base && base->activate)
299       (*base->activate)(self);
300   }
301 }
302
303
304 Glib::ObjectBase* Action_Class::wrap_new(GObject* object)
305 {
306   return new Action((GtkAction*)object);
307 }
308
309
310 /* The implementation: */
311
312 GtkAction* Action::gobj_copy()
313 {
314   reference();
315   return gobj();
316 }
317
318 Action::Action(const Glib::ConstructParams& construct_params)
319 :
320   Glib::Object(construct_params)
321 {}
322
323 Action::Action(GtkAction* castitem)
324 :
325   Glib::Object((GObject*)(castitem))
326 {}
327
328 Action::~Action()
329 {}
330
331
332 Action::CppClassType Action::action_class_; // initialize static member
333
334 GType Action::get_type()
335 {
336   return action_class_.init().get_type();
337 }
338
339 GType Action::get_base_type()
340 {
341   return gtk_action_get_type();
342 }
343
344
345 Action::Action()
346 :
347   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
348   Glib::Object(Glib::ConstructParams(action_class_.init()))
349 {
350   }
351
352 Glib::RefPtr<Action> Action::create()
353 {
354   return Glib::RefPtr<Action>( new Action() );
355 }
356 Glib::ustring Action::get_name() const
357 {
358   return Glib::convert_const_gchar_ptr_to_ustring(gtk_action_get_name(const_cast<GtkAction*>(gobj())));
359 }
360
361 bool Action::is_sensitive() const
362 {
363   return gtk_action_is_sensitive(const_cast<GtkAction*>(gobj()));
364 }
365
366 bool Action::get_sensitive() const
367 {
368   return gtk_action_get_sensitive(const_cast<GtkAction*>(gobj()));
369 }
370
371 void Action::set_sensitive(bool sensitive)
372 {
373   gtk_action_set_sensitive(gobj(), static_cast<int>(sensitive));
374 }
375
376 bool Action::is_visible() const
377 {
378   return gtk_action_is_visible(const_cast<GtkAction*>(gobj()));
379 }
380
381 bool Action::get_visible() const
382 {
383   return gtk_action_get_visible(const_cast<GtkAction*>(gobj()));
384 }
385
386 void Action::set_visible(bool visible)
387 {
388   gtk_action_set_visible(gobj(), static_cast<int>(visible));
389 }
390
391 void Action::activate()
392 {
393   gtk_action_activate(gobj());
394 }
395
396 Image* Action::create_icon(IconSize icon_size)
397 {
398   return Glib::wrap((GtkImage*)(gtk_action_create_icon(gobj(), static_cast<GtkIconSize>(int(icon_size)))));
399 }
400
401 MenuItem* Action::create_menu_item()
402 {
403   return Glib::wrap((GtkMenuItem*)(gtk_action_create_menu_item(gobj())));
404 }
405
406 ToolItem* Action::create_tool_item()
407 {
408   return Glib::wrap((GtkToolItem*)(gtk_action_create_tool_item(gobj())));
409 }
410
411 void Action::connect_proxy(Widget& proxy)
412 {
413   gtk_action_connect_proxy(gobj(), (proxy).gobj());
414 }
415
416 void Action::disconnect_proxy(Widget& proxy)
417 {
418   gtk_action_disconnect_proxy(gobj(), (proxy).gobj());
419 }
420
421 Glib::SListHandle<Widget*> Action::get_proxies()
422 {
423   return Glib::SListHandle<Widget*>(gtk_action_get_proxies(gobj()), Glib::OWNERSHIP_SHALLOW);
424 }
425
426 Glib::SListHandle<const Widget*> Action::get_proxies() const
427 {
428   return Glib::SListHandle<const Widget*>(gtk_action_get_proxies(const_cast<GtkAction*>(gobj())), Glib::OWNERSHIP_SHALLOW);
429 }
430
431 void Action::connect_accelerator()
432 {
433   gtk_action_connect_accelerator(gobj());
434 }
435
436 void Action::disconnect_accelerator()
437 {
438   gtk_action_disconnect_accelerator(gobj());
439 }
440
441 Glib::ustring Action::get_accel_path() const
442 {
443   return Glib::convert_const_gchar_ptr_to_ustring(gtk_action_get_accel_path(const_cast<GtkAction*>(gobj())));
444 }
445
446 void Action::set_accel_path(const Glib::ustring& accel_path)
447 {
448   gtk_action_set_accel_path(gobj(), accel_path.c_str());
449 }
450
451 void Action::set_accel_group(const Glib::RefPtr<AccelGroup>& accel_group)
452 {
453   gtk_action_set_accel_group(gobj(), Glib::unwrap(accel_group));
454 }
455
456 void Action::block_activate_from(Widget& proxy)
457 {
458   gtk_action_block_activate_from(gobj(), (proxy).gobj());
459 }
460
461 void Action::unblock_activate_from(Widget& proxy)
462 {
463   gtk_action_unblock_activate_from(gobj(), (proxy).gobj());
464 }
465
466
467 Glib::SignalProxy0< void > Action::signal_activate()
468 {
469   return Glib::SignalProxy0< void >(this, &Action_signal_activate_info);
470 }
471
472
473 Glib::PropertyProxy_ReadOnly<Glib::ustring> Action::property_name() const
474 {
475   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "name");
476 }
477
478 Glib::PropertyProxy<Glib::ustring> Action::property_label() 
479 {
480   return Glib::PropertyProxy<Glib::ustring>(this, "label");
481 }
482
483 Glib::PropertyProxy_ReadOnly<Glib::ustring> Action::property_label() const
484 {
485   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "label");
486 }
487
488 Glib::PropertyProxy<Glib::ustring> Action::property_short_label() 
489 {
490   return Glib::PropertyProxy<Glib::ustring>(this, "short-label");
491 }
492
493 Glib::PropertyProxy_ReadOnly<Glib::ustring> Action::property_short_label() const
494 {
495   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "short-label");
496 }
497
498 Glib::PropertyProxy<Glib::ustring> Action::property_tooltip() 
499 {
500   return Glib::PropertyProxy<Glib::ustring>(this, "tooltip");
501 }
502
503 Glib::PropertyProxy_ReadOnly<Glib::ustring> Action::property_tooltip() const
504 {
505   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "tooltip");
506 }
507
508 Glib::PropertyProxy<StockID> Action::property_stock_id() 
509 {
510   return Glib::PropertyProxy<StockID>(this, "stock-id");
511 }
512
513 Glib::PropertyProxy_ReadOnly<StockID> Action::property_stock_id() const
514 {
515   return Glib::PropertyProxy_ReadOnly<StockID>(this, "stock-id");
516 }
517
518 Glib::PropertyProxy<bool> Action::property_visible_horizontal() 
519 {
520   return Glib::PropertyProxy<bool>(this, "visible-horizontal");
521 }
522
523 Glib::PropertyProxy_ReadOnly<bool> Action::property_visible_horizontal() const
524 {
525   return Glib::PropertyProxy_ReadOnly<bool>(this, "visible-horizontal");
526 }
527
528 Glib::PropertyProxy<bool> Action::property_visible_vertical() 
529 {
530   return Glib::PropertyProxy<bool>(this, "visible-vertical");
531 }
532
533 Glib::PropertyProxy_ReadOnly<bool> Action::property_visible_vertical() const
534 {
535   return Glib::PropertyProxy_ReadOnly<bool>(this, "visible-vertical");
536 }
537
538 Glib::PropertyProxy<bool> Action::property_is_important() 
539 {
540   return Glib::PropertyProxy<bool>(this, "is-important");
541 }
542
543 Glib::PropertyProxy_ReadOnly<bool> Action::property_is_important() const
544 {
545   return Glib::PropertyProxy_ReadOnly<bool>(this, "is-important");
546 }
547
548 Glib::PropertyProxy<bool> Action::property_hide_if_empty() 
549 {
550   return Glib::PropertyProxy<bool>(this, "hide-if-empty");
551 }
552
553 Glib::PropertyProxy_ReadOnly<bool> Action::property_hide_if_empty() const
554 {
555   return Glib::PropertyProxy_ReadOnly<bool>(this, "hide-if-empty");
556 }
557
558 Glib::PropertyProxy<bool> Action::property_sensitive() 
559 {
560   return Glib::PropertyProxy<bool>(this, "sensitive");
561 }
562
563 Glib::PropertyProxy_ReadOnly<bool> Action::property_sensitive() const
564 {
565   return Glib::PropertyProxy_ReadOnly<bool>(this, "sensitive");
566 }
567
568 Glib::PropertyProxy<bool> Action::property_visible() 
569 {
570   return Glib::PropertyProxy<bool>(this, "visible");
571 }
572
573 Glib::PropertyProxy_ReadOnly<bool> Action::property_visible() const
574 {
575   return Glib::PropertyProxy_ReadOnly<bool>(this, "visible");
576 }
577
578
579 void Gtk::Action::on_activate()
580 {
581   BaseClassType *const base = static_cast<BaseClassType*>(
582       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
583   );
584
585   if(base && base->activate)
586     (*base->activate)(gobj());
587 }
588
589
590 Widget* Gtk::Action::create_menu_item_vfunc() 
591 {
592   BaseClassType *const base = static_cast<BaseClassType*>(
593       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
594   );
595
596   if(base && base->create_menu_item)
597     return Glib::wrap((*base->create_menu_item)(gobj()));
598
599   typedef Widget* RType;
600   return RType();
601 }
602
603 Widget* Gtk::Action::create_tool_item_vfunc() 
604 {
605   BaseClassType *const base = static_cast<BaseClassType*>(
606       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
607   );
608
609   if(base && base->create_tool_item)
610     return Glib::wrap((*base->create_tool_item)(gobj()));
611
612   typedef Widget* RType;
613   return RType();
614 }
615
616 void Gtk::Action::connect_proxy_vfunc(Widget* proxy) 
617 {
618   BaseClassType *const base = static_cast<BaseClassType*>(
619       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
620   );
621
622   if(base && base->connect_proxy)
623     (*base->connect_proxy)(gobj(),(GtkWidget*)Glib::unwrap(proxy));
624 }
625
626 void Gtk::Action::disconnect_proxy_vfunc(Widget* proxy) 
627 {
628   BaseClassType *const base = static_cast<BaseClassType*>(
629       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
630   );
631
632   if(base && base->disconnect_proxy)
633     (*base->disconnect_proxy)(gobj(),(GtkWidget*)Glib::unwrap(proxy));
634 }
635
636
637 } // namespace Gtk
638
639