summaryrefslogtreecommitdiff
path: root/libs/gtkmm2/gtk/gtkmm/container.cc
blob: c3db4bd7eff75a09315dd21e1ab1d39b1e394cab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
// Generated by gtkmmproc -- DO NOT MODIFY!

#include <gtkmm/container.h>
#include <gtkmm/private/container_p.h>

// -*- c++ -*-
/* $Id$ */

/* Copyright 1998-2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gtkmm/adjustment.h>
#include <gtk/gtkcontainer.h>


namespace
{


void container_foreach_callback(GtkWidget* widget_gobj, void* data)
{
  try
  {
    Gtk::Container::ForeachSlot& slot = *static_cast<Gtk::Container::ForeachSlot*>(data);
    Gtk::Widget *const widget = Glib::wrap(widget_gobj);

    g_return_if_fail(widget != 0);

    slot(*widget);
  }
  catch(...)
  {
    Glib::exception_handlers_invoke();
  }
}

} // anonymous namespace


namespace Gtk
{

void Container_Class::remove_callback_custom(GtkContainer* self, GtkWidget* p0)
{
  //GTKMM_LIFECYCLE

#ifdef GLIBMM_DEBUG_REFCOUNTING
  g_warning("Container_Class::remove_callback_custom() C self=%p: C child=%p\n", (void*)self, (void*)p0);
  g_warning("gtypename self: %s\n, gtypename child: %s", G_OBJECT_TYPE_NAME(G_OBJECT(self)), G_OBJECT_TYPE_NAME(G_OBJECT(p0)));
#endif
  
  //Don't call wrap() on a GTK+ instance whose gtkmm instance has been deleted - just call the original C callback.
  bool gtkmm_child_already_deleted = Glib::_gobject_cppinstance_already_deleted((GObject*)p0);

  if(!gtkmm_child_already_deleted)
  {
    //Call the regular, generated callback:
    Container_Class::remove_callback(self, p0);
  }
  else
  {
    BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

    //Call the original underlying C function:
    if(base && base->remove)
      (*base->remove)(self, p0);
  }
}

void Container::foreach(const Container::ForeachSlot& slot)
{
  ForeachSlot slot_copy (slot);
  gtk_container_foreach(gobj(), &container_foreach_callback, &slot_copy);
}

void  Container::add(Widget& widget)
{
  gtk_container_add(gobj(), widget.gobj());
}

bool Container::has_focus_chain() const
{
  return gtk_container_get_focus_chain(const_cast<GtkContainer*>(gobj()), 0);
}

Glib::ListHandle<Widget*> Container::get_focus_chain()
{
  GList* list = 0;
  gtk_container_get_focus_chain(gobj(), &list);

  return Glib::ListHandle<Widget*>(list, Glib::OWNERSHIP_SHALLOW);
}

Glib::ListHandle<const Widget*> Container::get_focus_chain() const
{
  GList* list = 0;
  gtk_container_get_focus_chain(const_cast<GtkContainer*>(gobj()), &list);

  return Glib::ListHandle<const Widget*>(list, Glib::OWNERSHIP_SHALLOW);
}


void Container::show_all_children(bool recursive)
{
  // Plain C version if this turns out to be performance-critical:
  //GtkCallback callback = (GtkCallback) ((recursive) ? &gtk_widget_show_all : &gtk_widget_show);
  //gtk_container_foreach(gobj(), callback, 0);

  // This could also be done with get_children() and an explicit loop,
  // if any problems should arise.  In gtkmm-1.2, foreach() is known to
  // cause segfaults eventually, but it seems to work now.

  foreach(sigc::mem_fun((recursive) ? &Widget::show_all : &Widget::show));
}

void Container::remove(Widget& widget)
{
  //If this is a managed widget,
  //then do an extra ref so that it will
  //not be destroyed when adding to another container
  //This should leave it in much the same state as when it was instantiated,
  //before being added to the first container.
  if(widget.is_managed_())
    widget.reference();
    
  gtk_container_remove(gobj(), widget.gobj());
}

// static
void Container_Class::destroy_callback(GtkObject* self)
{
#ifdef GLIBMM_DEBUG_REFCOUNTING
  g_warning("Container_Class::destroy_callback() gobject_=%10X\n", self);
  if(self)
    g_warning("gtypename: %s\n", G_OBJECT_TYPE_NAME(G_OBJECT(self)));
#endif

  //Call the normal C destroy implementation, such as gtk_button_destroy:
  //This will chain to gtk_container_destroy(), which will gtk_widget_destroy() any remaining child widgets.
  GtkObjectClass *const base = static_cast<GtkObjectClass*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)));

  if(base->destroy)
    (*base->destroy)(self);
}

} // namespace Gtk


namespace
{

void Container_signal_add_callback(GtkContainer* self, GtkWidget* p0,void* data)
{
  using namespace Gtk;
  typedef sigc::slot< void,Widget* > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    try
    {
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
);
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }
}

const Glib::SignalProxyInfo Container_signal_add_info =
{
  "add",
  (GCallback) &Container_signal_add_callback,
  (GCallback) &Container_signal_add_callback
};


void Container_signal_remove_callback(GtkContainer* self, GtkWidget* p0,void* data)
{
  using namespace Gtk;
  typedef sigc::slot< void,Widget* > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    try
    {
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
);
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }
}

const Glib::SignalProxyInfo Container_signal_remove_info =
{
  "remove",
  (GCallback) &Container_signal_remove_callback,
  (GCallback) &Container_signal_remove_callback
};


const Glib::SignalProxyInfo Container_signal_check_resize_info =
{
  "check_resize",
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};


void Container_signal_set_focus_child_callback(GtkContainer* self, GtkWidget* p0,void* data)
{
  using namespace Gtk;
  typedef sigc::slot< void,Widget* > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    try
    {
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
);
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }
}

const Glib::SignalProxyInfo Container_signal_set_focus_child_info =
{
  "set_focus_child",
  (GCallback) &Container_signal_set_focus_child_callback,
  (GCallback) &Container_signal_set_focus_child_callback
};

} // anonymous namespace


namespace Glib
{

Gtk::Container* wrap(GtkContainer* object, bool take_copy)
{
  return dynamic_cast<Gtk::Container *> (Glib::wrap_auto ((GObject*)(object), take_copy));
}

} /* namespace Glib */

namespace Gtk
{


/* The *_Class implementation: */

const Glib::Class& Container_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Class has to know the class init function to clone custom types.
    class_init_func_ = &Container_Class::class_init_function;

    // This is actually just optimized away, apparently with no harm.
    // Make sure that the parent type has been created.
    //CppClassParent::CppObjectType::get_type();

    // Create the wrapper type, with the same class/instance size as the base type.
    register_derived_type(gtk_container_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:
  }

  return *this;
}

void Container_Class::class_init_function(void* g_class, void* class_data)
{
  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
  CppClassParent::class_init_function(klass, class_data);

  klass->child_type = &child_type_vfunc_callback;
  klass->forall = &forall_vfunc_callback;
  klass->composite_name = &composite_name_vfunc_callback;
  klass->set_child_property = &set_child_property_vfunc_callback;
  klass->get_child_property = &get_child_property_vfunc_callback;
  klass->add = &add_callback;
  klass->remove = &remove_callback;
  klass->check_resize = &check_resize_callback;
  klass->set_focus_child = &set_focus_child_callback;
    reinterpret_cast<GtkObjectClass*>(klass)->destroy = &destroy_callback;
      klass->remove = &remove_callback_custom;

    if(G_OBJECT_CLASS_TYPE(klass) == Gtk::Container::get_type())
    { 
      //Remove the parent class's (GtkContainer) remove callback - it just prints a warning.
      //This prevents that warning when people derive directly from Gtk::Container.
      BaseClassType *const base = static_cast<BaseClassType*>( g_type_class_peek_parent(klass) );
      base->remove = 0;
    }
                
  }

GtkType Container_Class::child_type_vfunc_callback(GtkContainer* self)
{
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj && obj->is_derived_())
  {
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
    {
      // Call the virtual member method, which derived classes might override.
      return obj->child_type_vfunc();
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }
  else
  {
    BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

    // Call the original underlying C function:
    if(base && base->child_type)
      return (*base->child_type)(self);
  }

  typedef GtkType RType;
  return RType();
}

void Container_Class::forall_vfunc_callback(GtkContainer* self, gboolean include_internals, GtkCallback callback, gpointer callback_data)
{
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj && obj->is_derived_())
  {
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
    {
      // Call the virtual member method, which derived classes might override.
      obj->forall_vfunc(include_internals, callback, callback_data);
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }
  else
  {
    BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

    // Call the original underlying C function:
    if(base && base->forall)
      (*base->forall)(self, include_internals, callback, callback_data);
  }
}

gchar* Container_Class::composite_name_vfunc_callback(GtkContainer* self, GtkWidget* child)
{
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj && obj->is_derived_())
  {
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
    {
      // Call the virtual member method, which derived classes might override.
      return obj->composite_name_vfunc(child);
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }
  else
  {
    BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

    // Call the original underlying C function:
    if(base && base->composite_name)
      return (*base->composite_name)(self, child);
  }

  typedef gchar* RType;
  return RType();
}

void Container_Class::set_child_property_vfunc_callback(GtkContainer* self, GtkWidget* child, guint property_id, const GValue* value, GParamSpec* pspec)
{
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj && obj->is_derived_())
  {
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
    {
      // Call the virtual member method, which derived classes might override.
      obj->set_child_property_vfunc(child, property_id, value, pspec);
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }
  else
  {
    BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

    // Call the original underlying C function:
    if(base && base->set_child_property)
      (*base->set_child_property)(self, child, property_id, value, pspec);
  }
}

void Container_Class::get_child_property_vfunc_callback(GtkContainer* self, GtkWidget* child, guint property_id, GValue* value, GParamSpec* pspec)
{
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj && obj->is_derived_())
  {
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
    {
      // Call the virtual member method, which derived classes might override.
      obj->get_child_property_vfunc(child, property_id, value, pspec);
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }
  else
  {
    BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

    // Call the original underlying C function:
    if(base && base->get_child_property)
      (*base->get_child_property)(self, child, property_id, value, pspec);
  }
}


void Container_Class::add_callback(GtkContainer* self, GtkWidget* p0)
{
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj && obj->is_derived_())
  {
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
    {
      // Call the virtual member method, which derived classes might override.
      obj->on_add(Glib::wrap(p0)
);
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }
  else
  {
    BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

    // Call the original underlying C function:
    if(base && base->add)
      (*base->add)(self, p0);
  }
}

void Container_Class::remove_callback(GtkContainer* self, GtkWidget* p0)
{
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj && obj->is_derived_())
  {
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
    {
      // Call the virtual member method, which derived classes might override.
      obj->on_remove(Glib::wrap(p0)
);
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }
  else
  {
    BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

    // Call the original underlying C function:
    if(base && base->remove)
      (*base->remove)(self, p0);
  }
}

void Container_Class::check_resize_callback(GtkContainer* self)
{
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj && obj->is_derived_())
  {
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
    {
      // Call the virtual member method, which derived classes might override.
      obj->on_check_resize();
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }
  else
  {
    BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

    // Call the original underlying C function:
    if(base && base->check_resize)
      (*base->check_resize)(self);
  }
}

void Container_Class::set_focus_child_callback(GtkContainer* self, GtkWidget* p0)
{
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj && obj->is_derived_())
  {
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
    {
      // Call the virtual member method, which derived classes might override.
      obj->on_set_focus_child(Glib::wrap(p0)
);
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }
  else
  {
    BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

    // Call the original underlying C function:
    if(base && base->set_focus_child)
      (*base->set_focus_child)(self, p0);
  }
}


Glib::ObjectBase* Container_Class::wrap_new(GObject* o)
{
  return manage(new Container((GtkContainer*)(o)));

}


/* The implementation: */

Container::Container(const Glib::ConstructParams& construct_params)
:
  Gtk::Widget(construct_params)
{
  }

Container::Container(GtkContainer* castitem)
:
  Gtk::Widget((GtkWidget*)(castitem))
{
  }

Container::~Container()
{
  destroy_();
}

Container::CppClassType Container::container_class_; // initialize static member

GType Container::get_type()
{
  return container_class_.init().get_type();
}

GType Container::get_base_type()
{
  return gtk_container_get_type();
}


void Container::set_border_width(guint border_width)
{
  gtk_container_set_border_width(gobj(), border_width);
}

guint Container::get_border_width() const
{
  return gtk_container_get_border_width(const_cast<GtkContainer*>(gobj()));
}

void Container::set_resize_mode(ResizeMode resize_mode)
{
  gtk_container_set_resize_mode(gobj(), ((GtkResizeMode)(resize_mode)));
}

ResizeMode Container::get_resize_mode() const
{
  return ((ResizeMode)(gtk_container_get_resize_mode(const_cast<GtkContainer*>(gobj()))));
}

void Container::check_resize()
{
  gtk_container_check_resize(gobj());
}

Glib::ListHandle<Widget*> Container::get_children()
{
  return Glib::ListHandle<Widget*>(gtk_container_get_children(gobj()), Glib::OWNERSHIP_SHALLOW);
}

Glib::ListHandle<const Widget*> Container::get_children() const
{
  return Glib::ListHandle<const Widget*>(gtk_container_get_children(const_cast<GtkContainer*>(gobj())), Glib::OWNERSHIP_SHALLOW);
}

void Container::propagate_expose(Widget& child, GdkEventExpose* event)
{
  gtk_container_propagate_expose(gobj(), (child).gobj(), event);
}

void Container::set_focus_chain(const Glib::ListHandle<Widget*>& focusable_widgets)
{
  gtk_container_set_focus_chain(gobj(), focusable_widgets.data());
}

void Container::unset_focus_chain()
{
  gtk_container_unset_focus_chain(gobj());
}

void Container::set_reallocate_redraws(bool needs_redraws)
{
  gtk_container_set_reallocate_redraws(gobj(), static_cast<int>(needs_redraws));
}

void Container::set_focus_child(Widget& widget)
{
  gtk_container_set_focus_child(gobj(), (widget).gobj());
}

void Container::set_focus_vadjustment(Adjustment& adjustment)
{
  gtk_container_set_focus_vadjustment(gobj(), (adjustment).gobj());
}

Adjustment* Container::get_focus_vadjustment()
{
  return Glib::wrap(gtk_container_get_focus_vadjustment(gobj()));
}

const Adjustment* Container::get_focus_vadjustment() const
{
  return Glib::wrap(gtk_container_get_focus_vadjustment(const_cast<GtkContainer*>(gobj())));
}

void Container::set_focus_hadjustment(Adjustment& adjustment)
{
  gtk_container_set_focus_hadjustment(gobj(), (adjustment).gobj());
}

Adjustment* Container::get_focus_hadjustment()
{
  return Glib::wrap(gtk_container_get_focus_hadjustment(gobj()));
}

const Adjustment* Container::get_focus_hadjustment() const
{
  return Glib::wrap(gtk_container_get_focus_hadjustment(const_cast<GtkContainer*>(gobj())));
}

void Container::resize_children()
{
  gtk_container_resize_children(gobj());
}

GType Container::child_type() const
{
  return gtk_container_child_type(const_cast<GtkContainer*>(gobj()));
}

Container::Container()
:
  Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
  Gtk::Widget(Glib::ConstructParams(container_class_.init()))
{
  }


Glib::SignalProxy1< void,Widget* > Container::signal_add()
{
  return Glib::SignalProxy1< void,Widget* >(this, &Container_signal_add_info);
}

Glib::SignalProxy1< void,Widget* > Container::signal_remove()
{
  return Glib::SignalProxy1< void,Widget* >(this, &Container_signal_remove_info);
}

Glib::SignalProxy0< void > Container::signal_check_resize()
{
  return Glib::SignalProxy0< void >(this, &Container_signal_check_resize_info);
}

Glib::SignalProxy1< void,Widget* > Container::signal_set_focus_child()
{
  return Glib::SignalProxy1< void,Widget* >(this, &Container_signal_set_focus_child_info);
}


Glib::PropertyProxy<guint> Container::property_border_width() 
{
  return Glib::PropertyProxy<guint>(this, "border-width");
}

Glib::PropertyProxy_ReadOnly<guint> Container::property_border_width() const
{
  return Glib::PropertyProxy_ReadOnly<guint>(this, "border-width");
}

Glib::PropertyProxy<ResizeMode> Container::property_resize_mode() 
{
  return Glib::PropertyProxy<ResizeMode>(this, "resize-mode");
}

Glib::PropertyProxy_ReadOnly<ResizeMode> Container::property_resize_mode() const
{
  return Glib::PropertyProxy_ReadOnly<ResizeMode>(this, "resize-mode");
}

Glib::PropertyProxy_WriteOnly<Widget*> Container::property_child() 
{
  return Glib::PropertyProxy_WriteOnly<Widget*>(this, "child");
}

Glib::PropertyProxy_ReadOnly<Widget*> Container::property_child() const
{
  return Glib::PropertyProxy_ReadOnly<Widget*>(this, "child");
}


void Gtk::Container::on_add(Widget* widget)
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->add)
    (*base->add)(gobj(),(GtkWidget*)Glib::unwrap(widget));
}

void Gtk::Container::on_remove(Widget* widget)
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->remove)
    (*base->remove)(gobj(),(GtkWidget*)Glib::unwrap(widget));
}

void Gtk::Container::on_check_resize()
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->check_resize)
    (*base->check_resize)(gobj());
}

void Gtk::Container::on_set_focus_child(Widget* widget)
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->set_focus_child)
    (*base->set_focus_child)(gobj(),(GtkWidget*)Glib::unwrap(widget));
}


GtkType Gtk::Container::child_type_vfunc() const
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->child_type)
    return (*base->child_type)(const_cast<GtkContainer*>(gobj()));

  typedef GtkType RType;
  return RType();
}

void Gtk::Container::forall_vfunc(gboolean include_internals, GtkCallback callback, gpointer callback_data) 
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->forall)
    (*base->forall)(gobj(),include_internals,callback,callback_data);
}

char* Gtk::Container::composite_name_vfunc(GtkWidget* child) 
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->composite_name)
    return (*base->composite_name)(gobj(),child);

  typedef char* RType;
  return RType();
}

void Gtk::Container::set_child_property_vfunc(GtkWidget* child, guint property_id, const GValue* value, GParamSpec* pspec) 
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->set_child_property)
    (*base->set_child_property)(gobj(),child,property_id,value,pspec);
}

void Gtk::Container::get_child_property_vfunc(GtkWidget* child, guint property_id, GValue* value, GParamSpec* pspec) const
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->get_child_property)
    (*base->get_child_property)(const_cast<GtkContainer*>(gobj()),child,property_id,value,pspec);
}


} // namespace Gtk