Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / button.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/button.h>
4 #include <gtkmm/private/button_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* 
10  *
11  * Copyright 1998-2002 The gtkmm Development Team
12  *
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.
17  *
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.
22  *
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.
26  */
27
28 #include <gtk/gtklabel.h>
29 #include <gtk/gtkmisc.h>
30 #include <gtk/gtkbutton.h>
31 #include <gtkmm/stock.h>
32
33
34 namespace Gtk
35 {
36
37 Button::Button(const Glib::ustring& label, bool mnemonic)
38 :
39   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
40   Gtk::Bin(Glib::ConstructParams(button_class_.init(), "label",label.c_str(),"use_underline",gboolean(mnemonic), (char*) 0))
41 {}
42
43 Button::Button(const StockID& stock_id)
44 :
45   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
46   Gtk::Bin(Glib::ConstructParams(button_class_.init(), "use_stock",1,"label",stock_id.get_c_str(), (char*) 0))
47 {}
48
49 } // namespace Gtk
50
51
52 namespace
53 {
54
55 const Glib::SignalProxyInfo Button_signal_pressed_info =
56 {
57   "pressed",
58   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
59   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
60 };
61
62
63 const Glib::SignalProxyInfo Button_signal_released_info =
64 {
65   "released",
66   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
67   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
68 };
69
70
71 const Glib::SignalProxyInfo Button_signal_clicked_info =
72 {
73   "clicked",
74   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
75   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
76 };
77
78
79 const Glib::SignalProxyInfo Button_signal_enter_info =
80 {
81   "enter",
82   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
83   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
84 };
85
86
87 const Glib::SignalProxyInfo Button_signal_leave_info =
88 {
89   "leave",
90   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
91   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
92 };
93
94
95 const Glib::SignalProxyInfo Button_signal_activate_info =
96 {
97   "activate",
98   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
99   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
100 };
101
102 } // anonymous namespace
103
104
105 namespace Glib
106 {
107
108 Gtk::Button* wrap(GtkButton* object, bool take_copy)
109 {
110   return dynamic_cast<Gtk::Button *> (Glib::wrap_auto ((GObject*)(object), take_copy));
111 }
112
113 } /* namespace Glib */
114
115 namespace Gtk
116 {
117
118
119 /* The *_Class implementation: */
120
121 const Glib::Class& Button_Class::init()
122 {
123   if(!gtype_) // create the GType if necessary
124   {
125     // Glib::Class has to know the class init function to clone custom types.
126     class_init_func_ = &Button_Class::class_init_function;
127
128     // This is actually just optimized away, apparently with no harm.
129     // Make sure that the parent type has been created.
130     //CppClassParent::CppObjectType::get_type();
131
132     // Create the wrapper type, with the same class/instance size as the base type.
133     register_derived_type(gtk_button_get_type());
134
135     // Add derived versions of interfaces, if the C type implements any interfaces:
136   }
137
138   return *this;
139 }
140
141 void Button_Class::class_init_function(void* g_class, void* class_data)
142 {
143   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
144   CppClassParent::class_init_function(klass, class_data);
145
146   klass->pressed = &pressed_callback;
147   klass->released = &released_callback;
148   klass->clicked = &clicked_callback;
149   klass->enter = &enter_callback;
150   klass->leave = &leave_callback;
151   klass->activate = &activate_callback;
152 }
153
154
155 void Button_Class::pressed_callback(GtkButton* self)
156 {
157   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
158       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
159
160   // Non-gtkmmproc-generated custom classes implicitly call the default
161   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
162   // generated classes can use this optimisation, which avoids the unnecessary
163   // parameter conversions if there is no possibility of the virtual function
164   // being overridden:
165   if(obj && obj->is_derived_())
166   {
167     try // Trap C++ exceptions which would normally be lost because this is a C callback.
168     {
169       // Call the virtual member method, which derived classes might override.
170       obj->on_pressed();
171     }
172     catch(...)
173     {
174       Glib::exception_handlers_invoke();
175     }
176   }
177   else
178   {
179     BaseClassType *const base = static_cast<BaseClassType*>(
180         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
181     );
182
183     // Call the original underlying C function:
184     if(base && base->pressed)
185       (*base->pressed)(self);
186   }
187 }
188
189 void Button_Class::released_callback(GtkButton* self)
190 {
191   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
192       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
193
194   // Non-gtkmmproc-generated custom classes implicitly call the default
195   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
196   // generated classes can use this optimisation, which avoids the unnecessary
197   // parameter conversions if there is no possibility of the virtual function
198   // being overridden:
199   if(obj && obj->is_derived_())
200   {
201     try // Trap C++ exceptions which would normally be lost because this is a C callback.
202     {
203       // Call the virtual member method, which derived classes might override.
204       obj->on_released();
205     }
206     catch(...)
207     {
208       Glib::exception_handlers_invoke();
209     }
210   }
211   else
212   {
213     BaseClassType *const base = static_cast<BaseClassType*>(
214         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
215     );
216
217     // Call the original underlying C function:
218     if(base && base->released)
219       (*base->released)(self);
220   }
221 }
222
223 void Button_Class::clicked_callback(GtkButton* self)
224 {
225   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
226       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
227
228   // Non-gtkmmproc-generated custom classes implicitly call the default
229   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
230   // generated classes can use this optimisation, which avoids the unnecessary
231   // parameter conversions if there is no possibility of the virtual function
232   // being overridden:
233   if(obj && obj->is_derived_())
234   {
235     try // Trap C++ exceptions which would normally be lost because this is a C callback.
236     {
237       // Call the virtual member method, which derived classes might override.
238       obj->on_clicked();
239     }
240     catch(...)
241     {
242       Glib::exception_handlers_invoke();
243     }
244   }
245   else
246   {
247     BaseClassType *const base = static_cast<BaseClassType*>(
248         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
249     );
250
251     // Call the original underlying C function:
252     if(base && base->clicked)
253       (*base->clicked)(self);
254   }
255 }
256
257 void Button_Class::enter_callback(GtkButton* self)
258 {
259   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
260       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
261
262   // Non-gtkmmproc-generated custom classes implicitly call the default
263   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
264   // generated classes can use this optimisation, which avoids the unnecessary
265   // parameter conversions if there is no possibility of the virtual function
266   // being overridden:
267   if(obj && obj->is_derived_())
268   {
269     try // Trap C++ exceptions which would normally be lost because this is a C callback.
270     {
271       // Call the virtual member method, which derived classes might override.
272       obj->on_enter();
273     }
274     catch(...)
275     {
276       Glib::exception_handlers_invoke();
277     }
278   }
279   else
280   {
281     BaseClassType *const base = static_cast<BaseClassType*>(
282         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
283     );
284
285     // Call the original underlying C function:
286     if(base && base->enter)
287       (*base->enter)(self);
288   }
289 }
290
291 void Button_Class::leave_callback(GtkButton* self)
292 {
293   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
294       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
295
296   // Non-gtkmmproc-generated custom classes implicitly call the default
297   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
298   // generated classes can use this optimisation, which avoids the unnecessary
299   // parameter conversions if there is no possibility of the virtual function
300   // being overridden:
301   if(obj && obj->is_derived_())
302   {
303     try // Trap C++ exceptions which would normally be lost because this is a C callback.
304     {
305       // Call the virtual member method, which derived classes might override.
306       obj->on_leave();
307     }
308     catch(...)
309     {
310       Glib::exception_handlers_invoke();
311     }
312   }
313   else
314   {
315     BaseClassType *const base = static_cast<BaseClassType*>(
316         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
317     );
318
319     // Call the original underlying C function:
320     if(base && base->leave)
321       (*base->leave)(self);
322   }
323 }
324
325 void Button_Class::activate_callback(GtkButton* self)
326 {
327   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
328       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
329
330   // Non-gtkmmproc-generated custom classes implicitly call the default
331   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
332   // generated classes can use this optimisation, which avoids the unnecessary
333   // parameter conversions if there is no possibility of the virtual function
334   // being overridden:
335   if(obj && obj->is_derived_())
336   {
337     try // Trap C++ exceptions which would normally be lost because this is a C callback.
338     {
339       // Call the virtual member method, which derived classes might override.
340       obj->on_activate();
341     }
342     catch(...)
343     {
344       Glib::exception_handlers_invoke();
345     }
346   }
347   else
348   {
349     BaseClassType *const base = static_cast<BaseClassType*>(
350         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
351     );
352
353     // Call the original underlying C function:
354     if(base && base->activate)
355       (*base->activate)(self);
356   }
357 }
358
359
360 Glib::ObjectBase* Button_Class::wrap_new(GObject* o)
361 {
362   return manage(new Button((GtkButton*)(o)));
363
364 }
365
366
367 /* The implementation: */
368
369 Button::Button(const Glib::ConstructParams& construct_params)
370 :
371   Gtk::Bin(construct_params)
372 {
373   }
374
375 Button::Button(GtkButton* castitem)
376 :
377   Gtk::Bin((GtkBin*)(castitem))
378 {
379   }
380
381 Button::~Button()
382 {
383   destroy_();
384 }
385
386 Button::CppClassType Button::button_class_; // initialize static member
387
388 GType Button::get_type()
389 {
390   return button_class_.init().get_type();
391 }
392
393 GType Button::get_base_type()
394 {
395   return gtk_button_get_type();
396 }
397
398
399 Button::Button()
400 :
401   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
402   Gtk::Bin(Glib::ConstructParams(button_class_.init()))
403 {
404   }
405
406 void Button::pressed()
407 {
408   gtk_button_pressed(gobj());
409 }
410
411 void Button::released()
412 {
413   gtk_button_released(gobj());
414 }
415
416 void Button::clicked()
417 {
418   gtk_button_clicked(gobj());
419 }
420
421 void Button::enter()
422 {
423   gtk_button_enter(gobj());
424 }
425
426 void Button::leave()
427 {
428   gtk_button_leave(gobj());
429 }
430
431 void Button::set_relief(ReliefStyle newstyle)
432 {
433   gtk_button_set_relief(gobj(), ((GtkReliefStyle)(newstyle)));
434 }
435
436 ReliefStyle Button::get_relief() const
437 {
438   return ((ReliefStyle)(gtk_button_get_relief(const_cast<GtkButton*>(gobj()))));
439 }
440
441 void Button::set_label(const Glib::ustring& label)
442 {
443   gtk_button_set_label(gobj(), label.c_str());
444 }
445
446 Glib::ustring Button::get_label() const
447 {
448   return Glib::convert_const_gchar_ptr_to_ustring(gtk_button_get_label(const_cast<GtkButton*>(gobj())));
449 }
450
451 void Button::set_use_underline(bool use_underline)
452 {
453   gtk_button_set_use_underline(gobj(), static_cast<int>(use_underline));
454 }
455
456 bool Button::get_use_underline() const
457 {
458   return gtk_button_get_use_underline(const_cast<GtkButton*>(gobj()));
459 }
460
461 void Button::set_use_stock(bool use_stock)
462 {
463   gtk_button_set_use_stock(gobj(), static_cast<int>(use_stock));
464 }
465
466 bool Button::get_use_stock() const
467 {
468   return gtk_button_get_use_stock(const_cast<GtkButton*>(gobj()));
469 }
470
471 void Button::set_focus_on_click(bool focus_on_click)
472 {
473   gtk_button_set_focus_on_click(gobj(), static_cast<int>(focus_on_click));
474 }
475
476 bool Button::get_focus_on_click() const
477 {
478   return gtk_button_get_focus_on_click(const_cast<GtkButton*>(gobj()));
479 }
480
481 void Button::set_alignment(float xalign, float yalign)
482 {
483   gtk_button_set_alignment(gobj(), xalign, yalign);
484 }
485
486 void Button::get_alignment(float& xalign, float& yalign)
487 {
488   gtk_button_get_alignment(gobj(), &(xalign), &(yalign));
489 }
490
491 void Button::set_image(Widget& image)
492 {
493   gtk_button_set_image(gobj(), (image).gobj());
494 }
495
496 Widget* Button::get_image()
497 {
498   return Glib::wrap(gtk_button_get_image(gobj()));
499 }
500
501 const Widget* Button::get_image() const
502 {
503   return Glib::wrap(gtk_button_get_image(const_cast<GtkButton*>(gobj())));
504 }
505
506
507 Glib::SignalProxy0< void > Button::signal_pressed()
508 {
509   return Glib::SignalProxy0< void >(this, &Button_signal_pressed_info);
510 }
511
512 Glib::SignalProxy0< void > Button::signal_released()
513 {
514   return Glib::SignalProxy0< void >(this, &Button_signal_released_info);
515 }
516
517 Glib::SignalProxy0< void > Button::signal_clicked()
518 {
519   return Glib::SignalProxy0< void >(this, &Button_signal_clicked_info);
520 }
521
522 Glib::SignalProxy0< void > Button::signal_enter()
523 {
524   return Glib::SignalProxy0< void >(this, &Button_signal_enter_info);
525 }
526
527 Glib::SignalProxy0< void > Button::signal_leave()
528 {
529   return Glib::SignalProxy0< void >(this, &Button_signal_leave_info);
530 }
531
532 Glib::SignalProxy0< void > Button::signal_activate()
533 {
534   return Glib::SignalProxy0< void >(this, &Button_signal_activate_info);
535 }
536
537
538 Glib::PropertyProxy<Glib::ustring> Button::property_label() 
539 {
540   return Glib::PropertyProxy<Glib::ustring>(this, "label");
541 }
542
543 Glib::PropertyProxy_ReadOnly<Glib::ustring> Button::property_label() const
544 {
545   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "label");
546 }
547
548 Glib::PropertyProxy<ReliefStyle> Button::property_relief() 
549 {
550   return Glib::PropertyProxy<ReliefStyle>(this, "relief");
551 }
552
553 Glib::PropertyProxy_ReadOnly<ReliefStyle> Button::property_relief() const
554 {
555   return Glib::PropertyProxy_ReadOnly<ReliefStyle>(this, "relief");
556 }
557
558 Glib::PropertyProxy<bool> Button::property_use_underline() 
559 {
560   return Glib::PropertyProxy<bool>(this, "use-underline");
561 }
562
563 Glib::PropertyProxy_ReadOnly<bool> Button::property_use_underline() const
564 {
565   return Glib::PropertyProxy_ReadOnly<bool>(this, "use-underline");
566 }
567
568 Glib::PropertyProxy<bool> Button::property_use_stock() 
569 {
570   return Glib::PropertyProxy<bool>(this, "use-stock");
571 }
572
573 Glib::PropertyProxy_ReadOnly<bool> Button::property_use_stock() const
574 {
575   return Glib::PropertyProxy_ReadOnly<bool>(this, "use-stock");
576 }
577
578 Glib::PropertyProxy<bool> Button::property_focus_on_click() 
579 {
580   return Glib::PropertyProxy<bool>(this, "focus-on-click");
581 }
582
583 Glib::PropertyProxy_ReadOnly<bool> Button::property_focus_on_click() const
584 {
585   return Glib::PropertyProxy_ReadOnly<bool>(this, "focus-on-click");
586 }
587
588 Glib::PropertyProxy<float> Button::property_xalign() 
589 {
590   return Glib::PropertyProxy<float>(this, "xalign");
591 }
592
593 Glib::PropertyProxy_ReadOnly<float> Button::property_xalign() const
594 {
595   return Glib::PropertyProxy_ReadOnly<float>(this, "xalign");
596 }
597
598 Glib::PropertyProxy<float> Button::property_yalign() 
599 {
600   return Glib::PropertyProxy<float>(this, "yalign");
601 }
602
603 Glib::PropertyProxy_ReadOnly<float> Button::property_yalign() const
604 {
605   return Glib::PropertyProxy_ReadOnly<float>(this, "yalign");
606 }
607
608 Glib::PropertyProxy<Gtk::Widget*> Button::property_image() 
609 {
610   return Glib::PropertyProxy<Gtk::Widget*>(this, "image");
611 }
612
613 Glib::PropertyProxy_ReadOnly<Gtk::Widget*> Button::property_image() const
614 {
615   return Glib::PropertyProxy_ReadOnly<Gtk::Widget*>(this, "image");
616 }
617
618
619 void Gtk::Button::on_pressed()
620 {
621   BaseClassType *const base = static_cast<BaseClassType*>(
622       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
623   );
624
625   if(base && base->pressed)
626     (*base->pressed)(gobj());
627 }
628
629 void Gtk::Button::on_released()
630 {
631   BaseClassType *const base = static_cast<BaseClassType*>(
632       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
633   );
634
635   if(base && base->released)
636     (*base->released)(gobj());
637 }
638
639 void Gtk::Button::on_clicked()
640 {
641   BaseClassType *const base = static_cast<BaseClassType*>(
642       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
643   );
644
645   if(base && base->clicked)
646     (*base->clicked)(gobj());
647 }
648
649 void Gtk::Button::on_enter()
650 {
651   BaseClassType *const base = static_cast<BaseClassType*>(
652       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
653   );
654
655   if(base && base->enter)
656     (*base->enter)(gobj());
657 }
658
659 void Gtk::Button::on_leave()
660 {
661   BaseClassType *const base = static_cast<BaseClassType*>(
662       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
663   );
664
665   if(base && base->leave)
666     (*base->leave)(gobj());
667 }
668
669 void Gtk::Button::on_activate()
670 {
671   BaseClassType *const base = static_cast<BaseClassType*>(
672       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
673   );
674
675   if(base && base->activate)
676     (*base->activate)(gobj());
677 }
678
679
680 } // namespace Gtk
681
682