~ubuntu-branches/ubuntu/vivid/ardour/vivid-proposed

« back to all changes in this revision

Viewing changes to libs/gtkmm2/gtk/gtkmm/container.cc

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler, Jaromír Mikeš, Felipe Sateler
  • Date: 2014-05-22 14:39:25 UTC
  • mfrom: (29 sid)
  • mto: This revision was merged to the branch mainline in revision 30.
  • Revision ID: package-import@ubuntu.com-20140522143925-vwqfo9287pmkrroe
Tags: 1:2.8.16+git20131003-3
* Team upload

[ Jaromír Mikeš ]
* Add -dbg package

[ Felipe Sateler ]
* Upload to experimental

Show diffs side-by-side

added added

removed removed

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