add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / container.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <gtkmm/container.h>
5 #include <gtkmm/private/container_p.h>
6
7 // -*- c++ -*-
8 /* $Id$ */
9
10 /* Copyright 1998-2002 The gtkmm Development Team
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Library General Public
14  * License as published by the Free Software Foundation; either
15  * version 2 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Library General Public License for more details.
21  *
22  * You should have received a copy of the GNU Library General Public
23  * License along with this library; if not, write to the Free
24  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25  */
26
27 #include <gtkmm/adjustment.h>
28 #include <gtk/gtkcontainer.h>
29
30
31 namespace
32 {
33
34 static void container_foreach_callback(GtkWidget* widget_gobj, void* data)
35 {
36   #ifdef GLIBMM_EXCEPTIONS_ENABLED
37   try
38   {
39   #endif //GLIBMM_EXCEPTIONS_ENABLED
40     Gtk::Container::ForeachSlot& slot = *static_cast<Gtk::Container::ForeachSlot*>(data);
41     Gtk::Widget *const widget = Glib::wrap(widget_gobj);
42
43     g_return_if_fail(widget != 0);
44
45     slot(*widget);
46   #ifdef GLIBMM_EXCEPTIONS_ENABLED
47   }
48   catch(...)
49   {
50     Glib::exception_handlers_invoke();
51   }
52   #endif //GLIBMM_EXCEPTIONS_ENABLED
53 }
54
55
56 //Copy of generated callback:
57 static void Container_signal_remove_callback_normal(GtkContainer* self, GtkWidget* p0,void* data)
58 {
59   using namespace Gtk;
60   typedef sigc::slot< void,Widget* > SlotType;
61
62   // Do not try to call a signal on a disassociated wrapper.
63   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
64   {
65     #ifdef GLIBMM_EXCEPTIONS_ENABLED
66     try
67     {
68     #endif //GLIBMM_EXCEPTIONS_ENABLED
69       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
70         (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
71 );
72     #ifdef GLIBMM_EXCEPTIONS_ENABLED
73     }
74     catch(...)
75     {
76       Glib::exception_handlers_invoke();
77     }
78     #endif //GLIBMM_EXCEPTIONS_ENABLED
79   }
80 }
81
82 static void Container_signal_remove_callback(GtkContainer* self, GtkWidget* p0, void* data)
83 {
84   //GTKMM_LIFECYCLE
85
86 #ifdef GLIBMM_DEBUG_REFCOUNTING
87   g_warning("Container_signal_remove_callback()");
88 #endif
89
90   //Don't call wrap() on a GTK+ instance whose gtkmm instance has been deleted - just call the original C callback.
91   const bool gtkmm_child_already_deleted = Glib::_gobject_cppinstance_already_deleted((GObject*)p0);
92
93   if(!gtkmm_child_already_deleted)
94   {
95     //Call the regular, generated callback:
96     Container_signal_remove_callback_normal(self, p0, data);
97   }
98   else
99   {
100     //Do nothing.
101   }
102 }
103
104 } // anonymous namespace
105
106
107 namespace Gtk
108 {
109
110 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
111 //Copy of generated callback:
112 void Container_Class::remove_callback_normal(GtkContainer* self, GtkWidget* p0)
113 {
114   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
115       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
116
117   // Non-gtkmmproc-generated custom classes implicitly call the default
118   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
119   // generated classes can use this optimisation, which avoids the unnecessary
120   // parameter conversions if there is no possibility of the virtual function
121   // being overridden:
122   if(obj && obj->is_derived_())
123   {
124     #ifdef GLIBMM_EXCEPTIONS_ENABLED
125     try // Trap C++ exceptions which would normally be lost because this is a C callback.
126     {
127     #endif //GLIBMM_EXCEPTIONS_ENABLED
128       // Call the virtual member method, which derived classes might override.
129       obj->on_remove(Glib::wrap(p0)
130 );
131     #ifdef GLIBMM_EXCEPTIONS_ENABLED
132     }
133     catch(...)
134     {
135       Glib::exception_handlers_invoke();
136     }
137     #endif //GLIBMM_EXCEPTIONS_ENABLED
138   }
139   else
140   {
141     BaseClassType *const base = static_cast<BaseClassType*>(
142         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
143     );
144
145     // Call the original underlying C function:
146     if(base && base->remove)
147       (*base->remove)(self, p0);
148   }
149 }
150
151 //Custom hand-coded callback:
152 void Container_Class::remove_callback(GtkContainer* self, GtkWidget* p0)
153 {
154   //GTKMM_LIFECYCLE
155
156 #ifdef GLIBMM_DEBUG_REFCOUNTING
157   g_warning("Container_Class::remove_callback_custom() C self=%p: C child=%p\n", (void*)self, (void*)p0);
158   g_warning("gtypename self: %s\n, gtypename child: %s", G_OBJECT_TYPE_NAME(G_OBJECT(self)), G_OBJECT_TYPE_NAME(G_OBJECT(p0)));
159 #endif
160   
161   //Don't call wrap() on a GTK+ instance whose gtkmm instance has been deleted - just call the original C callback.
162   const bool gtkmm_child_already_deleted = Glib::_gobject_cppinstance_already_deleted((GObject*)p0);
163
164   if(!gtkmm_child_already_deleted)
165   {
166     //Call the regular, generated callback:
167     Container_Class::remove_callback_normal(self, p0);
168   }
169   else
170   {
171     BaseClassType *const base = static_cast<BaseClassType*>(
172         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
173     );
174
175     //Call the original underlying C function:
176     if(base && base->remove)
177       (*base->remove)(self, p0);
178   }
179 }
180 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
181
182 void Container::foreach(const Container::ForeachSlot& slot)
183 {
184   ForeachSlot slot_copy (slot);
185   gtk_container_foreach(gobj(), &container_foreach_callback, &slot_copy);
186 }
187
188 void  Container::add(Widget& widget)
189 {
190   gtk_container_add(gobj(), widget.gobj());
191 }
192
193 bool Container::has_focus_chain() const
194 {
195   return gtk_container_get_focus_chain(const_cast<GtkContainer*>(gobj()), 0);
196 }
197
198 Glib::ListHandle<Widget*> Container::get_focus_chain()
199 {
200   GList* list = 0;
201   gtk_container_get_focus_chain(gobj(), &list);
202
203   return Glib::ListHandle<Widget*>(list, Glib::OWNERSHIP_SHALLOW);
204 }
205
206 Glib::ListHandle<const Widget*> Container::get_focus_chain() const
207 {
208   GList* list = 0;
209   gtk_container_get_focus_chain(const_cast<GtkContainer*>(gobj()), &list);
210
211   return Glib::ListHandle<const Widget*>(list, Glib::OWNERSHIP_SHALLOW);
212 }
213
214
215 void Container::show_all_children(bool recursive)
216 {
217   // Plain C version if this turns out to be performance-critical:
218   //GtkCallback callback = (GtkCallback) ((recursive) ? &gtk_widget_show_all : &gtk_widget_show);
219   //gtk_container_foreach(gobj(), callback, 0);
220
221   // This could also be done with get_children() and an explicit loop,
222   // if any problems should arise.  In gtkmm-1.2, foreach() is known to
223   // cause segfaults eventually, but it seems to work now.
224
225   foreach(sigc::mem_fun((recursive) ? &Widget::show_all : &Widget::show));
226 }
227
228 void Container::remove(Widget& widget)
229 {
230   //If this is a managed widget,
231   //then do an extra ref so that it will
232   //not be destroyed when adding to another container
233   //This should leave it in much the same state as when it was instantiated,
234   //before being added to the first container.
235   if(widget.is_managed_())
236     widget.reference();
237     
238   gtk_container_remove(gobj(), widget.gobj());
239 }
240
241 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
242 // static
243 void Container_Class::destroy_callback(GtkObject* self)
244 {
245 #ifdef GLIBMM_DEBUG_REFCOUNTING
246   g_warning("Container_Class::destroy_callback() gobject_=%10X\n", self);
247   if(self)
248     g_warning("gtypename: %s\n", G_OBJECT_TYPE_NAME(G_OBJECT(self)));
249 #endif
250
251   //Call the normal C destroy implementation, such as gtk_button_destroy:
252   //This will chain to gtk_container_destroy(), which will gtk_widget_destroy() any remaining child widgets.
253   GtkObjectClass *const base = static_cast<GtkObjectClass*>(
254       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)));
255
256   if(base->destroy)
257     (*base->destroy)(self);
258 }
259 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
260
261 } // namespace Gtk
262
263
264 namespace
265 {
266
267
268 static void Container_signal_add_callback(GtkContainer* self, GtkWidget* p0,void* data)
269 {
270   using namespace Gtk;
271   typedef sigc::slot< void,Widget* > SlotType;
272
273   // Do not try to call a signal on a disassociated wrapper.
274   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
275   {
276     #ifdef GLIBMM_EXCEPTIONS_ENABLED
277     try
278     {
279     #endif //GLIBMM_EXCEPTIONS_ENABLED
280       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
281         (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
282 );
283     #ifdef GLIBMM_EXCEPTIONS_ENABLED
284     }
285     catch(...)
286     {
287       Glib::exception_handlers_invoke();
288     }
289     #endif //GLIBMM_EXCEPTIONS_ENABLED
290   }
291 }
292
293 static const Glib::SignalProxyInfo Container_signal_add_info =
294 {
295   "add",
296   (GCallback) &Container_signal_add_callback,
297   (GCallback) &Container_signal_add_callback
298 };
299
300
301 static const Glib::SignalProxyInfo Container_signal_remove_info =
302 {
303   "remove",
304   (GCallback) &Container_signal_remove_callback,
305   (GCallback) &Container_signal_remove_callback
306 };
307
308
309 static const Glib::SignalProxyInfo Container_signal_check_resize_info =
310 {
311   "check_resize",
312   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
313   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
314 };
315
316
317 static void Container_signal_set_focus_child_callback(GtkContainer* self, GtkWidget* p0,void* data)
318 {
319   using namespace Gtk;
320   typedef sigc::slot< void,Widget* > SlotType;
321
322   // Do not try to call a signal on a disassociated wrapper.
323   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
324   {
325     #ifdef GLIBMM_EXCEPTIONS_ENABLED
326     try
327     {
328     #endif //GLIBMM_EXCEPTIONS_ENABLED
329       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
330         (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
331 );
332     #ifdef GLIBMM_EXCEPTIONS_ENABLED
333     }
334     catch(...)
335     {
336       Glib::exception_handlers_invoke();
337     }
338     #endif //GLIBMM_EXCEPTIONS_ENABLED
339   }
340 }
341
342 static const Glib::SignalProxyInfo Container_signal_set_focus_child_info =
343 {
344   "set_focus_child",
345   (GCallback) &Container_signal_set_focus_child_callback,
346   (GCallback) &Container_signal_set_focus_child_callback
347 };
348
349
350 } // anonymous namespace
351
352
353 namespace Glib
354 {
355
356 Gtk::Container* wrap(GtkContainer* object, bool take_copy)
357 {
358   return dynamic_cast<Gtk::Container *> (Glib::wrap_auto ((GObject*)(object), take_copy));
359 }
360
361 } /* namespace Glib */
362
363 namespace Gtk
364 {
365
366
367 /* The *_Class implementation: */
368
369 const Glib::Class& Container_Class::init()
370 {
371   if(!gtype_) // create the GType if necessary
372   {
373     // Glib::Class has to know the class init function to clone custom types.
374     class_init_func_ = &Container_Class::class_init_function;
375
376     // This is actually just optimized away, apparently with no harm.
377     // Make sure that the parent type has been created.
378     //CppClassParent::CppObjectType::get_type();
379
380     // Create the wrapper type, with the same class/instance size as the base type.
381     register_derived_type(gtk_container_get_type());
382
383     // Add derived versions of interfaces, if the C type implements any interfaces:
384   }
385
386   return *this;
387 }
388
389 void Container_Class::class_init_function(void* g_class, void* class_data)
390 {
391   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
392   CppClassParent::class_init_function(klass, class_data);
393
394 #ifdef GLIBMM_VFUNCS_ENABLED
395   klass->child_type = &child_type_vfunc_callback;
396   klass->forall = &forall_vfunc_callback;
397   klass->composite_name = &composite_name_vfunc_callback;
398   klass->set_child_property = &set_child_property_vfunc_callback;
399   klass->get_child_property = &get_child_property_vfunc_callback;
400 #endif //GLIBMM_VFUNCS_ENABLED
401
402 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
403   klass->add = &add_callback;
404   klass->remove = &remove_callback;
405   klass->check_resize = &check_resize_callback;
406   klass->set_focus_child = &set_focus_child_callback;
407     reinterpret_cast<GtkObjectClass*>(klass)->destroy = &destroy_callback;
408   #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
409 }
410
411 #ifdef GLIBMM_VFUNCS_ENABLED
412 GtkType Container_Class::child_type_vfunc_callback(GtkContainer* self)
413 {
414   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
415       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
416
417   // Non-gtkmmproc-generated custom classes implicitly call the default
418   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
419   // generated classes can use this optimisation, which avoids the unnecessary
420   // parameter conversions if there is no possibility of the virtual function
421   // being overridden:
422   if(obj_base && obj_base->is_derived_())
423   {
424     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
425     if(obj) // This can be NULL during destruction.
426     {
427       #ifdef GLIBMM_EXCEPTIONS_ENABLED
428       try // Trap C++ exceptions which would normally be lost because this is a C callback.
429       {
430       #endif //GLIBMM_EXCEPTIONS_ENABLED
431         // Call the virtual member method, which derived classes might override.
432         return obj->child_type_vfunc();
433       #ifdef GLIBMM_EXCEPTIONS_ENABLED
434       }
435       catch(...)
436       {
437         Glib::exception_handlers_invoke();
438       }
439       #endif //GLIBMM_EXCEPTIONS_ENABLED
440     }
441   }
442   
443   BaseClassType *const base = static_cast<BaseClassType*>(
444       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
445   );
446
447   // Call the original underlying C function:
448   if(base && base->child_type)
449     return (*base->child_type)(self);
450
451
452   typedef GtkType RType;
453   return RType();
454 }
455 void Container_Class::forall_vfunc_callback(GtkContainer* self, gboolean include_internals, GtkCallback callback, gpointer callback_data)
456 {
457   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
458       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
459
460   // Non-gtkmmproc-generated custom classes implicitly call the default
461   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
462   // generated classes can use this optimisation, which avoids the unnecessary
463   // parameter conversions if there is no possibility of the virtual function
464   // being overridden:
465   if(obj_base && obj_base->is_derived_())
466   {
467     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
468     if(obj) // This can be NULL during destruction.
469     {
470       #ifdef GLIBMM_EXCEPTIONS_ENABLED
471       try // Trap C++ exceptions which would normally be lost because this is a C callback.
472       {
473       #endif //GLIBMM_EXCEPTIONS_ENABLED
474         // Call the virtual member method, which derived classes might override.
475         obj->forall_vfunc(include_internals, callback, callback_data);
476         return;
477       #ifdef GLIBMM_EXCEPTIONS_ENABLED
478       }
479       catch(...)
480       {
481         Glib::exception_handlers_invoke();
482       }
483       #endif //GLIBMM_EXCEPTIONS_ENABLED
484     }
485   }
486   
487   BaseClassType *const base = static_cast<BaseClassType*>(
488       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
489   );
490
491   // Call the original underlying C function:
492   if(base && base->forall)
493     (*base->forall)(self, include_internals, callback, callback_data);
494
495 }
496 gchar* Container_Class::composite_name_vfunc_callback(GtkContainer* self, GtkWidget* child)
497 {
498   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
499       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
500
501   // Non-gtkmmproc-generated custom classes implicitly call the default
502   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
503   // generated classes can use this optimisation, which avoids the unnecessary
504   // parameter conversions if there is no possibility of the virtual function
505   // being overridden:
506   if(obj_base && obj_base->is_derived_())
507   {
508     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
509     if(obj) // This can be NULL during destruction.
510     {
511       #ifdef GLIBMM_EXCEPTIONS_ENABLED
512       try // Trap C++ exceptions which would normally be lost because this is a C callback.
513       {
514       #endif //GLIBMM_EXCEPTIONS_ENABLED
515         // Call the virtual member method, which derived classes might override.
516         return obj->composite_name_vfunc(child);
517       #ifdef GLIBMM_EXCEPTIONS_ENABLED
518       }
519       catch(...)
520       {
521         Glib::exception_handlers_invoke();
522       }
523       #endif //GLIBMM_EXCEPTIONS_ENABLED
524     }
525   }
526   
527   BaseClassType *const base = static_cast<BaseClassType*>(
528       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
529   );
530
531   // Call the original underlying C function:
532   if(base && base->composite_name)
533     return (*base->composite_name)(self, child);
534
535
536   typedef gchar* RType;
537   return RType();
538 }
539 void Container_Class::set_child_property_vfunc_callback(GtkContainer* self, GtkWidget* child, guint property_id, const GValue* value, GParamSpec* pspec)
540 {
541   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
542       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
543
544   // Non-gtkmmproc-generated custom classes implicitly call the default
545   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
546   // generated classes can use this optimisation, which avoids the unnecessary
547   // parameter conversions if there is no possibility of the virtual function
548   // being overridden:
549   if(obj_base && obj_base->is_derived_())
550   {
551     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
552     if(obj) // This can be NULL during destruction.
553     {
554       #ifdef GLIBMM_EXCEPTIONS_ENABLED
555       try // Trap C++ exceptions which would normally be lost because this is a C callback.
556       {
557       #endif //GLIBMM_EXCEPTIONS_ENABLED
558         // Call the virtual member method, which derived classes might override.
559         obj->set_child_property_vfunc(child, property_id, value, pspec);
560         return;
561       #ifdef GLIBMM_EXCEPTIONS_ENABLED
562       }
563       catch(...)
564       {
565         Glib::exception_handlers_invoke();
566       }
567       #endif //GLIBMM_EXCEPTIONS_ENABLED
568     }
569   }
570   
571   BaseClassType *const base = static_cast<BaseClassType*>(
572       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
573   );
574
575   // Call the original underlying C function:
576   if(base && base->set_child_property)
577     (*base->set_child_property)(self, child, property_id, value, pspec);
578
579 }
580 void Container_Class::get_child_property_vfunc_callback(GtkContainer* self, GtkWidget* child, guint property_id, GValue* value, GParamSpec* pspec)
581 {
582   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
583       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
584
585   // Non-gtkmmproc-generated custom classes implicitly call the default
586   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
587   // generated classes can use this optimisation, which avoids the unnecessary
588   // parameter conversions if there is no possibility of the virtual function
589   // being overridden:
590   if(obj_base && obj_base->is_derived_())
591   {
592     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
593     if(obj) // This can be NULL during destruction.
594     {
595       #ifdef GLIBMM_EXCEPTIONS_ENABLED
596       try // Trap C++ exceptions which would normally be lost because this is a C callback.
597       {
598       #endif //GLIBMM_EXCEPTIONS_ENABLED
599         // Call the virtual member method, which derived classes might override.
600         obj->get_child_property_vfunc(child, property_id, value, pspec);
601         return;
602       #ifdef GLIBMM_EXCEPTIONS_ENABLED
603       }
604       catch(...)
605       {
606         Glib::exception_handlers_invoke();
607       }
608       #endif //GLIBMM_EXCEPTIONS_ENABLED
609     }
610   }
611   
612   BaseClassType *const base = static_cast<BaseClassType*>(
613       g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
614   );
615
616   // Call the original underlying C function:
617   if(base && base->get_child_property)
618     (*base->get_child_property)(self, child, property_id, value, pspec);
619
620 }
621 #endif //GLIBMM_VFUNCS_ENABLED
622
623 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
624 void Container_Class::add_callback(GtkContainer* self, GtkWidget* p0)
625 {
626   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
627       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
628
629   // Non-gtkmmproc-generated custom classes implicitly call the default
630   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
631   // generated classes can use this optimisation, which avoids the unnecessary
632   // parameter conversions if there is no possibility of the virtual function
633   // being overridden:
634   if(obj_base && obj_base->is_derived_())
635   {
636     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
637     if(obj) // This can be NULL during destruction.
638     {
639       #ifdef GLIBMM_EXCEPTIONS_ENABLED
640       try // Trap C++ exceptions which would normally be lost because this is a C callback.
641       {
642       #endif //GLIBMM_EXCEPTIONS_ENABLED
643         // Call the virtual member method, which derived classes might override.
644         obj->on_add(Glib::wrap(p0)
645 );
646         return;
647       #ifdef GLIBMM_EXCEPTIONS_ENABLED
648       }
649       catch(...)
650       {
651         Glib::exception_handlers_invoke();
652       }
653       #endif //GLIBMM_EXCEPTIONS_ENABLED
654     }
655   }
656   
657   BaseClassType *const base = static_cast<BaseClassType*>(
658         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
659     );
660
661   // Call the original underlying C function:
662   if(base && base->add)
663     (*base->add)(self, p0);
664 }
665 void Container_Class::check_resize_callback(GtkContainer* self)
666 {
667   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
668       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
669
670   // Non-gtkmmproc-generated custom classes implicitly call the default
671   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
672   // generated classes can use this optimisation, which avoids the unnecessary
673   // parameter conversions if there is no possibility of the virtual function
674   // being overridden:
675   if(obj_base && obj_base->is_derived_())
676   {
677     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
678     if(obj) // This can be NULL during destruction.
679     {
680       #ifdef GLIBMM_EXCEPTIONS_ENABLED
681       try // Trap C++ exceptions which would normally be lost because this is a C callback.
682       {
683       #endif //GLIBMM_EXCEPTIONS_ENABLED
684         // Call the virtual member method, which derived classes might override.
685         obj->on_check_resize();
686         return;
687       #ifdef GLIBMM_EXCEPTIONS_ENABLED
688       }
689       catch(...)
690       {
691         Glib::exception_handlers_invoke();
692       }
693       #endif //GLIBMM_EXCEPTIONS_ENABLED
694     }
695   }
696   
697   BaseClassType *const base = static_cast<BaseClassType*>(
698         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
699     );
700
701   // Call the original underlying C function:
702   if(base && base->check_resize)
703     (*base->check_resize)(self);
704 }
705 void Container_Class::set_focus_child_callback(GtkContainer* self, GtkWidget* p0)
706 {
707   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
708       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
709
710   // Non-gtkmmproc-generated custom classes implicitly call the default
711   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
712   // generated classes can use this optimisation, which avoids the unnecessary
713   // parameter conversions if there is no possibility of the virtual function
714   // being overridden:
715   if(obj_base && obj_base->is_derived_())
716   {
717     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
718     if(obj) // This can be NULL during destruction.
719     {
720       #ifdef GLIBMM_EXCEPTIONS_ENABLED
721       try // Trap C++ exceptions which would normally be lost because this is a C callback.
722       {
723       #endif //GLIBMM_EXCEPTIONS_ENABLED
724         // Call the virtual member method, which derived classes might override.
725         obj->on_set_focus_child(Glib::wrap(p0)
726 );
727         return;
728       #ifdef GLIBMM_EXCEPTIONS_ENABLED
729       }
730       catch(...)
731       {
732         Glib::exception_handlers_invoke();
733       }
734       #endif //GLIBMM_EXCEPTIONS_ENABLED
735     }
736   }
737   
738   BaseClassType *const base = static_cast<BaseClassType*>(
739         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
740     );
741
742   // Call the original underlying C function:
743   if(base && base->set_focus_child)
744     (*base->set_focus_child)(self, p0);
745 }
746 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
747
748
749 Glib::ObjectBase* Container_Class::wrap_new(GObject* o)
750 {
751   return manage(new Container((GtkContainer*)(o)));
752
753 }
754
755
756 /* The implementation: */
757
758 Container::Container(const Glib::ConstructParams& construct_params)
759 :
760   Gtk::Widget(construct_params)
761 {
762   }
763
764 Container::Container(GtkContainer* castitem)
765 :
766   Gtk::Widget((GtkWidget*)(castitem))
767 {
768   }
769
770 Container::~Container()
771 {
772   destroy_();
773 }
774
775 Container::CppClassType Container::container_class_; // initialize static member
776
777 GType Container::get_type()
778 {
779   return container_class_.init().get_type();
780 }
781
782 GType Container::get_base_type()
783 {
784   return gtk_container_get_type();
785 }
786
787
788 void Container::set_border_width(guint border_width)
789 {
790 gtk_container_set_border_width(gobj(), border_width); 
791 }
792
793 guint Container::get_border_width() const
794 {
795   return gtk_container_get_border_width(const_cast<GtkContainer*>(gobj()));
796 }
797
798 void Container::set_resize_mode(ResizeMode resize_mode)
799 {
800 gtk_container_set_resize_mode(gobj(), ((GtkResizeMode)(resize_mode))); 
801 }
802
803 ResizeMode Container::get_resize_mode() const
804 {
805   return ((ResizeMode)(gtk_container_get_resize_mode(const_cast<GtkContainer*>(gobj()))));
806 }
807
808 void Container::check_resize()
809 {
810 gtk_container_check_resize(gobj()); 
811 }
812
813 Glib::ListHandle<Widget*> Container::get_children()
814 {
815   return Glib::ListHandle<Widget*>(gtk_container_get_children(gobj()), Glib::OWNERSHIP_SHALLOW);
816 }
817
818 Glib::ListHandle<const Widget*> Container::get_children() const
819 {
820   return Glib::ListHandle<const Widget*>(gtk_container_get_children(const_cast<GtkContainer*>(gobj())), Glib::OWNERSHIP_SHALLOW);
821 }
822
823 void Container::propagate_expose(Widget& child, GdkEventExpose* event)
824 {
825 gtk_container_propagate_expose(gobj(), (child).gobj(), event); 
826 }
827
828 void Container::set_focus_chain(const Glib::ListHandle<Widget*>& focusable_widgets)
829 {
830 gtk_container_set_focus_chain(gobj(), focusable_widgets.data()); 
831 }
832
833 void Container::unset_focus_chain()
834 {
835 gtk_container_unset_focus_chain(gobj()); 
836 }
837
838 void Container::set_reallocate_redraws(bool needs_redraws)
839 {
840 gtk_container_set_reallocate_redraws(gobj(), static_cast<int>(needs_redraws)); 
841 }
842
843 void Container::set_focus_child(Widget& widget)
844 {
845 gtk_container_set_focus_child(gobj(), (widget).gobj()); 
846 }
847
848 void Container::set_focus_vadjustment(Adjustment& adjustment)
849 {
850 gtk_container_set_focus_vadjustment(gobj(), (adjustment).gobj()); 
851 }
852
853 Adjustment* Container::get_focus_vadjustment()
854 {
855   return Glib::wrap(gtk_container_get_focus_vadjustment(gobj()));
856 }
857
858 const Adjustment* Container::get_focus_vadjustment() const
859 {
860   return const_cast<Container*>(this)->get_focus_vadjustment();
861 }
862
863 void Container::set_focus_hadjustment(Adjustment& adjustment)
864 {
865 gtk_container_set_focus_hadjustment(gobj(), (adjustment).gobj()); 
866 }
867
868 Adjustment* Container::get_focus_hadjustment()
869 {
870   return Glib::wrap(gtk_container_get_focus_hadjustment(gobj()));
871 }
872
873 const Adjustment* Container::get_focus_hadjustment() const
874 {
875   return const_cast<Container*>(this)->get_focus_hadjustment();
876 }
877
878 void Container::resize_children()
879 {
880 gtk_container_resize_children(gobj()); 
881 }
882
883 GType Container::child_type() const
884 {
885   return gtk_container_child_type(const_cast<GtkContainer*>(gobj()));
886 }
887
888 Container::Container()
889 :
890   // Mark this class as non-derived to allow C++ vfuncs to be skipped.
891   Glib::ObjectBase(0),
892   Gtk::Widget(Glib::ConstructParams(container_class_.init()))
893 {
894   }
895
896
897 Glib::SignalProxy1< void,Widget* > Container::signal_add()
898 {
899   return Glib::SignalProxy1< void,Widget* >(this, &Container_signal_add_info);
900 }
901
902
903 Glib::SignalProxy1< void,Widget* > Container::signal_remove()
904 {
905   return Glib::SignalProxy1< void,Widget* >(this, &Container_signal_remove_info);
906 }
907
908
909 Glib::SignalProxy0< void > Container::signal_check_resize()
910 {
911   return Glib::SignalProxy0< void >(this, &Container_signal_check_resize_info);
912 }
913
914
915 Glib::SignalProxy1< void,Widget* > Container::signal_set_focus_child()
916 {
917   return Glib::SignalProxy1< void,Widget* >(this, &Container_signal_set_focus_child_info);
918 }
919
920
921 #ifdef GLIBMM_PROPERTIES_ENABLED
922 Glib::PropertyProxy<guint> Container::property_border_width() 
923 {
924   return Glib::PropertyProxy<guint>(this, "border-width");
925 }
926 #endif //GLIBMM_PROPERTIES_ENABLED
927
928 #ifdef GLIBMM_PROPERTIES_ENABLED
929 Glib::PropertyProxy_ReadOnly<guint> Container::property_border_width() const
930 {
931   return Glib::PropertyProxy_ReadOnly<guint>(this, "border-width");
932 }
933 #endif //GLIBMM_PROPERTIES_ENABLED
934
935 #ifdef GLIBMM_PROPERTIES_ENABLED
936 Glib::PropertyProxy<ResizeMode> Container::property_resize_mode() 
937 {
938   return Glib::PropertyProxy<ResizeMode>(this, "resize-mode");
939 }
940 #endif //GLIBMM_PROPERTIES_ENABLED
941
942 #ifdef GLIBMM_PROPERTIES_ENABLED
943 Glib::PropertyProxy_ReadOnly<ResizeMode> Container::property_resize_mode() const
944 {
945   return Glib::PropertyProxy_ReadOnly<ResizeMode>(this, "resize-mode");
946 }
947 #endif //GLIBMM_PROPERTIES_ENABLED
948
949 #ifdef GLIBMM_PROPERTIES_ENABLED
950 Glib::PropertyProxy_WriteOnly<Widget*> Container::property_child() 
951 {
952   return Glib::PropertyProxy_WriteOnly<Widget*>(this, "child");
953 }
954 #endif //GLIBMM_PROPERTIES_ENABLED
955
956
957 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
958 void Gtk::Container::on_add(Widget* widget)
959 {
960   BaseClassType *const base = static_cast<BaseClassType*>(
961       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
962   );
963
964   if(base && base->add)
965     (*base->add)(gobj(),(GtkWidget*)Glib::unwrap(widget));
966 }
967 void Gtk::Container::on_remove(Widget* widget)
968 {
969   BaseClassType *const base = static_cast<BaseClassType*>(
970       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
971   );
972
973   if(base && base->remove)
974     (*base->remove)(gobj(),(GtkWidget*)Glib::unwrap(widget));
975 }
976 void Gtk::Container::on_check_resize()
977 {
978   BaseClassType *const base = static_cast<BaseClassType*>(
979       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
980   );
981
982   if(base && base->check_resize)
983     (*base->check_resize)(gobj());
984 }
985 void Gtk::Container::on_set_focus_child(Widget* widget)
986 {
987   BaseClassType *const base = static_cast<BaseClassType*>(
988       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
989   );
990
991   if(base && base->set_focus_child)
992     (*base->set_focus_child)(gobj(),(GtkWidget*)Glib::unwrap(widget));
993 }
994 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
995
996 #ifdef GLIBMM_VFUNCS_ENABLED
997 GtkType Gtk::Container::child_type_vfunc() const
998 {
999   BaseClassType *const base = static_cast<BaseClassType*>(
1000       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1001   );
1002
1003   if(base && base->child_type)
1004     return (*base->child_type)(const_cast<GtkContainer*>(gobj()));
1005
1006   typedef GtkType RType;
1007   return RType();
1008 }
1009 void Gtk::Container::forall_vfunc(gboolean include_internals, GtkCallback callback, gpointer callback_data) 
1010 {
1011   BaseClassType *const base = static_cast<BaseClassType*>(
1012       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1013   );
1014
1015   if(base && base->forall)
1016     (*base->forall)(gobj(),include_internals,callback,callback_data);
1017 }
1018 char* Gtk::Container::composite_name_vfunc(GtkWidget* child) 
1019 {
1020   BaseClassType *const base = static_cast<BaseClassType*>(
1021       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1022   );
1023
1024   if(base && base->composite_name)
1025     return (*base->composite_name)(gobj(),child);
1026
1027   typedef char* RType;
1028   return RType();
1029 }
1030 void Gtk::Container::set_child_property_vfunc(GtkWidget* child, guint property_id, const GValue* value, GParamSpec* pspec) 
1031 {
1032   BaseClassType *const base = static_cast<BaseClassType*>(
1033       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1034   );
1035
1036   if(base && base->set_child_property)
1037     (*base->set_child_property)(gobj(),child,property_id,value,pspec);
1038 }
1039 void Gtk::Container::get_child_property_vfunc(GtkWidget* child, guint property_id, GValue* value, GParamSpec* pspec) const
1040 {
1041   BaseClassType *const base = static_cast<BaseClassType*>(
1042       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1043   );
1044
1045   if(base && base->get_child_property)
1046     (*base->get_child_property)(const_cast<GtkContainer*>(gobj()),child,property_id,value,pspec);
1047 }
1048 #endif //GLIBMM_VFUNCS_ENABLED
1049
1050
1051 } // namespace Gtk
1052
1053